diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2226ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +config/config.php +.idea +tmp +composer.lock \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..056115b --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "name": "nox/gmarche", + "authors": [ + { + "name": "nox", + "email": "nox@axiom-team.fr" + } + ], + "autoload": { + "psr-4": { + "Framework\\": "src/Framework", + "App\\": "src", + "Tests\\": "tests" + } + }, + "require": { + "guzzlehttp/psr7": "^1.4", + "http-interop/response-sender": "^1.0", + "zendframework/zend-expressive-fastroute": "^2.0", + "twig/twig": "^2.4", + "php-di/php-di": "^5.4", + "pagerfanta/pagerfanta": "^2.1", + "middlewares/whoops": "0.4.1", + "doctrine/cache": "1.4", + "intervention/image": "2.4", + "swiftmailer/swiftmailer": "^6.0", + "ramsey/uuid": "^3.7" + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.0", + "phpunit/phpunit": "^6.2", + "robmorgan/phinx": "0.8.1", + "fzaninotto/faker": "^1.8" + } +} diff --git a/config.php b/config.php new file mode 100644 index 0000000..212f5fc --- /dev/null +++ b/config.php @@ -0,0 +1,4 @@ + '/news' +]; \ No newline at end of file diff --git a/config/config - sample.php b/config/config - sample.php new file mode 100644 index 0000000..de27a29 --- /dev/null +++ b/config/config - sample.php @@ -0,0 +1,53 @@ + \DI\env('ENV', 'production'), + /*'env' => \DI\env('ENV', 'development'),*/ + 'database.host' => 'localhost', + 'database.username' => 'root', + 'database.password' => '', + 'database.name' => 'gmarche', + 'views.path' => dirname(__DIR__) . '/views', + 'twig.extensions' => [ + \DI\get(RouterTwigExtension::class), + \DI\get(PagerFantaExtension::class), + \DI\get(TextExtension::class), + \DI\get(TimeExtension::class), + \DI\get(FlashExtension::class), + \DI\get(FormExtension::class), + \DI\get(CsrfExtension::class), + \DI\get(UrlExtension::class) + ], + SessionInterface::class => \DI\object(PHPSession::class), + CsrfMiddleware::class => \DI\object()->constructor(\DI\get(SessionInterface::class)), + Router::class => \DI\factory(RouterFactory::class), + RendererInterface::class => \DI\factory(TwigRendererFactory::class), + \PDO::class => function (\Psr\Container\ContainerInterface $c) { + return new PDO( + 'mysql:host='. $c->get('database.host') . ';dbname=' . $c->get('database.name'), + $c->get('database.username'), + $c->get('database.password'), + [ + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION + ] + ); + }, + // MAILER + 'mail.to' => 'admin@gmarche-testmail.com', + 'mail.from' => 'no-reply@admin.fr', + Swift_Mailer::class => \DI\factory(\Framework\SwiftMailerFactory::class) +]; \ No newline at end of file diff --git a/gm.iml b/gm.iml new file mode 100644 index 0000000..a9acd58 --- /dev/null +++ b/gm.iml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phinx.php b/phinx.php new file mode 100644 index 0000000..70fe07c --- /dev/null +++ b/phinx.php @@ -0,0 +1,28 @@ +getModules() as $module) { + if ($module::MIGRATIONS) { + $migrations[] = $module::MIGRATIONS; + } + if ($module::SEEDS) { + $seeds[] = $module::SEEDS; + } +} +return [ + 'paths' => [ + 'migrations' => $migrations, + 'seeds' => $seeds + ], + 'environments' => [ + 'default_database' => 'development', + 'development' => [ + 'adapter' => 'mysql', + 'host' => $app->getContainer()->get('database.host'), + 'name' => $app->getContainer()->get('database.name'), + 'user' => $app->getContainer()->get('database.username'), + 'pass' => $app->getContainer()->get('database.password') + ] + ] +]; diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..d32fc0a --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,14 @@ + + + Mes règles de formattage + + + + + src + public/index.php + + + + + \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..3e942b1 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,7 @@ + + + + tests + + + \ No newline at end of file diff --git a/public/avatar_user.png b/public/avatar_user.png new file mode 100644 index 0000000..b99cb9b Binary files /dev/null and b/public/avatar_user.png differ diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..79d7112 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,199 @@ + +* { + box-sizing: border-box; +} +btn-custom { + background-color: hsl(0, 0%, 79%) !important; + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#134134134", endColorstr="#c9c9c9"); + background-image: -khtml-gradient(linear, left top, left bottom, from(#134134134), to(#c9c9c9)); + background-image: -moz-linear-gradient(top, #134134134, #c9c9c9); + background-image: -ms-linear-gradient(top, #134134134, #c9c9c9); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #134134134), color-stop(100%, #c9c9c9)); + background-image: -webkit-linear-gradient(top, #134134134, #c9c9c9); + background-image: -o-linear-gradient(top, #134134134, #c9c9c9); + background-image: linear-gradient(#134134134, #c9c9c9); + border-color: #c9c9c9 #c9c9c9 hsl(0, 0%, 68.5%); + color: #333 !important; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.69); + -webkit-font-smoothing: antialiased; +} + +img { + max-width: 100%; + height: auto; +} + +a :hover { + background-color: lightgreen; + text-decoration: none; +} + +li { + list-style-type: none; + text-color: black; +} +.liste_regions, .liste_antennes { + background-color: lightblue; +} + +.fond { + background-image: url("../images/bildreich_1275.jpg"); + background-repeat: no-repeat; + background-attachment:fixed; + background-position: center; + background-size: 100% auto; + font-family: Bree serif,"Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 18px; +} +header.header { + width: 389px; + height: 259px; + margin: 0 auto; + margin-bottom: 10px; + text-align: center; +} +header.header img { + width: 389px; + height: 259px; +} +.logo_toile img, .logo_june img { + transition: transform .5s; +} +.logo_toile img:hover, .logo_june img:hover { + transform: scale(1.1) rotate(10deg); +} +.post-header { + width: 820px; + height: 80px; + margin: 0 auto; + color: white; + opacity: 0.9; + font-family: Bree serif, Arial; + font-size: 26px; +} +#la_page { + text-align: center; + width: 1174px; + min-height: 901px; + height:auto; + margin-left: auto; + margin-right: auto; +} + +.article { + width:auto; + height:auto; + font-size: 24px; +} +.article2 { + width:auto; + height:auto; + font-size: 24px; +} +.container { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} +.records_content th, .records_content2 th{ + background-color: lightgray; + color: rgba(0,0,0,0.85); +} +.footer { + width:105px; + margin: 5px auto; + text-align: center; +} +/******************************************************************/ +/* POUR MOBILES */ +/******************************************************************/ +@media only screen and (max-width:560px) { + + .fond { + background-color: black; + background-image: url("../toureiffel.jpeg"); + background-repeat: no-repeat; + background-attachment: fixed; + background-position: left; + background-size: cover; + } + .post-header { + width: auto; + height: auto; + margin-left: 10px; + } + #la_page { + width: auto; + height:auto; + margin-left: auto; + margin-right: auto; + } + .article { + width: auto; + height: auto; + margin-left: 10px; + margin-bottom: 10px; + } + .article2 { + width: auto; + height: auto; + margin-left: 10px; + margin-bottom: 10px; + } + .container button{ + float: left; + } + + /**************************************/ + /* Tableaux responsives */ + /**************************************/ + .table-responsive table, + .table-responsive thead, + .table-responsive tbody, + .table-responsive tr, + .table-responsive th, + .table-responsive td { + display: block; + } + + .table-responsive thead { + display: none; + } + + .table-responsive td { + padding-left: 95px !important; + position: relative; + margin-top: -1px; + background: #FFF; + } + .table-responsive td button{ + margin-top:-7px; + max-height: 30px; + } + .table-responsive td:nth-child(odd) { + background-color: #eee; + } + + .table-responsive td::before { + padding: 10px; + content: attr(data-label); + position: absolute; + top: 0; + left: 0; + width: 85px; + bottom: 0; + background-color: #000; + color: #FFF; + display: flex; + align-items: center; + font-weight: bold; + } + + .table-responsive tr { + margin-bottom: 1rem; + } + + .table-responsive th + td { + padding-left: 10px; + } + +} diff --git a/public/images/attilax.png b/public/images/attilax.png new file mode 100644 index 0000000..f7a7f84 Binary files /dev/null and b/public/images/attilax.png differ diff --git a/public/images/background_contacts.jpg b/public/images/background_contacts.jpg new file mode 100644 index 0000000..ea3211b Binary files /dev/null and b/public/images/background_contacts.jpg differ diff --git a/public/images/bildreich_1275.jpg b/public/images/bildreich_1275.jpg new file mode 100644 index 0000000..2a18e98 Binary files /dev/null and b/public/images/bildreich_1275.jpg differ diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 0000000..064a1fd Binary files /dev/null and b/public/images/favicon.ico differ diff --git a/public/images/ile-de-france.jpg b/public/images/ile-de-france.jpg new file mode 100644 index 0000000..de58a4f Binary files /dev/null and b/public/images/ile-de-france.jpg differ diff --git a/public/images/logo_contacts.jpg b/public/images/logo_contacts.jpg new file mode 100644 index 0000000..c15eed3 Binary files /dev/null and b/public/images/logo_contacts.jpg differ diff --git a/public/images/logo_home.jpg b/public/images/logo_home.jpg new file mode 100644 index 0000000..270d56b Binary files /dev/null and b/public/images/logo_home.jpg differ diff --git a/public/images/logo_region.png b/public/images/logo_region.png new file mode 100644 index 0000000..80b014c Binary files /dev/null and b/public/images/logo_region.png differ diff --git a/public/images/nox.png b/public/images/nox.png new file mode 100644 index 0000000..ca5448b Binary files /dev/null and b/public/images/nox.png differ diff --git a/public/images/poka.png b/public/images/poka.png new file mode 100644 index 0000000..881a56e Binary files /dev/null and b/public/images/poka.png differ diff --git a/public/images/toureiffel.jpeg b/public/images/toureiffel.jpeg new file mode 100644 index 0000000..e69486c Binary files /dev/null and b/public/images/toureiffel.jpeg differ diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..3f31081 --- /dev/null +++ b/public/index.php @@ -0,0 +1,62 @@ +addModule(AdminModule::class) + ->addModule(ContactModule::class) + ->addModule(ProductModule::class) + ->addModule(GmarcheModule::class) + ->addModule(AuthModule::class) + ->addModule(AccountModule::class); + + +$container = $app->getContainer(); + +// Pose problème +$container->get(\Framework\Router::class)->get('/', \App\Gmarche\Actions\RegionIndexAction::class, 'home'); + +$app->pipe(Whoops::class); +$app->pipe(TrailingSlashMiddleware::class); +$app->pipe(\App\Auth\ForbiddenMiddleware::class); + +// admin pose problème +//$app->pipe( +// $container->get('admin.prefix'), +// $container->get(RoleMiddlewareFactory::class)->makeForRole('admin') +// ); + +$app->pipe(MethodMiddleware::class) + ->pipe(RendererRequestMiddleware::class) + // ->pipe(CsrfMiddleware::class) + ->pipe(RouterMiddleware::class) + ->pipe(DispatcherMiddleware::class) + ->pipe(NotFoundMiddleware::class); + + +if (php_sapi_name() !== "cli") { + $response = $app->run(ServerRequest::fromGlobals()); + \Http\Response\send($response); +} diff --git a/public/uploads/products/panier.png b/public/uploads/products/panier.png new file mode 100644 index 0000000..3601125 Binary files /dev/null and b/public/uploads/products/panier.png differ diff --git a/public/uploads/products/panier_thumb.png b/public/uploads/products/panier_thumb.png new file mode 100644 index 0000000..f48fe0d Binary files /dev/null and b/public/uploads/products/panier_thumb.png differ diff --git a/src/Account/AccountModule.php b/src/Account/AccountModule.php new file mode 100644 index 0000000..7010a59 --- /dev/null +++ b/src/Account/AccountModule.php @@ -0,0 +1,27 @@ +addPath('account', __DIR__ . '/views'); + $router->get('/inscription', SignupAction::class, 'account.signup'); + $router->post('/inscription', SignupAction::class); + $router->get('/mon-profil', [LoggedInMiddleware::class, AccountAction::class], 'account'); + $router->post('/mon-profil', [LoggedInMiddleware::class, AccountEditAction::class]); + } +} diff --git a/src/Account/Action/AccountAction.php b/src/Account/Action/AccountAction.php new file mode 100644 index 0000000..f78da06 --- /dev/null +++ b/src/Account/Action/AccountAction.php @@ -0,0 +1,34 @@ +renderer = $renderer; + $this->auth = $auth; + } + + public function __invoke(ServerRequestInterface $request) + { + $user = $this->auth->getUser(); + return $this->renderer->render('@account/account', compact('user')); + } +} diff --git a/src/Account/Action/AccountEditAction.php b/src/Account/Action/AccountEditAction.php new file mode 100644 index 0000000..0f09a47 --- /dev/null +++ b/src/Account/Action/AccountEditAction.php @@ -0,0 +1,67 @@ +renderer = $renderer; + $this->auth = $auth; + $this->flashService = $flashService; + $this->userTable = $userTable; + } + + public function __invoke(ServerRequestInterface $request) + { + $user = $this->auth->getUser(); + $params = $request->getParsedBody(); + $validator = (new Validator($params)) + ->confirm('password') + ->required('firstname', 'lastname'); + if ($validator->isValid()) { + $userParams = [ + 'firstname' => $params['firstname'], + 'lastname' => $params['lastname'] + ]; + if (!empty($params['password'])) { + $userParams['password'] = password_hash($params['password'], PASSWORD_DEFAULT); + } + $this->userTable->update($user->id, $userParams); + $this->flashService->success('Votre compte a bien été mis à jour'); + return new RedirectResponse($request->getUri()->getPath()); + } + $errors = $validator->getErrors(); + return $this->renderer->render('@account/account', compact('user', 'errors')); + } +} diff --git a/src/Account/Action/SignupAction.php b/src/Account/Action/SignupAction.php new file mode 100644 index 0000000..1338700 --- /dev/null +++ b/src/Account/Action/SignupAction.php @@ -0,0 +1,99 @@ +renderer = $renderer; + $this->userTable = $userTable; + $this->router = $router; + $this->auth = $auth; + $this->flashService = $flashService; + } + + public function __invoke(ServerRequestInterface $request) + { + if ($request->getMethod() === 'GET') { + return $this->renderer->render('@account/signup'); + } + $params = $request->getParsedBody(); + $validator = (new Validator($params)) + ->required('username', 'email', 'password', 'password_confirm', 'firstname', 'lastname', 'created_at') + ->length('username', 3) + ->length('firstname', 2) + ->length('lastname', 2) + ->email('email') + ->confirm('password') + ->length('password', 4) + ->unique('username', $this->userTable) + ->unique('email', $this->userTable); + if ($validator->isValid()) { + $userParams = [ + 'username' => $params['username'], + 'firstname'=> $params['firstname'], + 'lastname'=> $params['lastname'], + 'email' => $params['email'], + 'password' => password_hash($params['password'], PASSWORD_DEFAULT), + 'created_at' => $params['created_at'], + 'role' => 'user' + ]; + $this->userTable->insert($userParams); + $user = Hydrator::hydrate($userParams, User::class); + $user->id = $this->userTable->getPdo()->lastInsertId(); + $this->auth->setUser($user); + $this->flashService->success('Votre compte a bien été créé'); + return new RedirectResponse($this->router->generateUri('account')); + } + $errors = $validator->getErrors(); + return $this->renderer->render('@account/signup', [ + 'errors' => $errors, + 'user' => [ + 'username' => $params['username'], + 'email' => $params['email'], + 'firstname'=> $params['firstname'], + 'lastname'=> $params['lastname'], + 'created_at' => $params['created_at'] + ] + ]); + } +} diff --git a/src/Account/User.php b/src/Account/User.php new file mode 100644 index 0000000..1f631aa --- /dev/null +++ b/src/Account/User.php @@ -0,0 +1,74 @@ +role]; + } + + /** + * @return string + */ + public function getFirstname(): string + { + return $this->firstname; + } + + /** + * @param string $firstname + */ + public function setFirstname(string $firstname) + { + $this->firstname = $firstname; + } + + /** + * @return string + */ + public function getLastname(): string + { + return $this->lastname; + } + + /** + * @param string $lastname + */ + public function setLastname(string $lastname) + { + $this->lastname = $lastname; + } + + /** + * @return mixed + */ + public function getRole() + { + return $this->role; + } + + /** + * @param mixed $role + */ + public function setRole($role) + { + $this->role = $role; + } +} diff --git a/src/Account/definitions.php b/src/Account/definitions.php new file mode 100644 index 0000000..e6002e1 --- /dev/null +++ b/src/Account/definitions.php @@ -0,0 +1,4 @@ + \App\Account\User::class +]; diff --git a/src/Account/views/account.twig b/src/Account/views/account.twig new file mode 100644 index 0000000..faad56f --- /dev/null +++ b/src/Account/views/account.twig @@ -0,0 +1,18 @@ +{% extends 'layout.twig' %} + +{% block body %} +
+

Mon compte

+
+ {{ csrf_input() }} + {{ field('firstname', user.firstname, 'Prénom') }} + {{ field('lastname', user.lastname, 'Nom') }} +

Changer de mot de passe

+

Laissez vide pour ne rien changer

+ {{ field('password', null, 'Mot de passe', {type: 'password'}) }} + {{ field('password_confirm', null, 'Confirmer le mot de passe', {type: 'password'}) }} + +
+
+ +{% endblock %} \ No newline at end of file diff --git a/src/Account/views/signup.twig b/src/Account/views/signup.twig new file mode 100644 index 0000000..2cafe48 --- /dev/null +++ b/src/Account/views/signup.twig @@ -0,0 +1,16 @@ +{% extends 'layout.twig' %} + +{% block body %} +
+
+ {{ csrf_input() }} + {{ field('username', user.username, "Pseudo") }} + {{ field('firstname', user.firstname, "Prénom") }} {{ field('lastname', user.lastname, "Nom") }} + {{ field('email', user.email, "Email", {type: 'email'}) }} + {{ field('password', null, "Mot de passe", {type: 'password'}) }} + {{ field('password_confirm', null, "Confirmez le mot de passe", {type: 'password'}) }} + {{ field('created_at', date(), null, {type: 'hidden'}) }} + +
+
+{% endblock %} \ No newline at end of file diff --git a/src/Admin/AdminModule.php b/src/Admin/AdminModule.php new file mode 100644 index 0000000..8f28a30 --- /dev/null +++ b/src/Admin/AdminModule.php @@ -0,0 +1,31 @@ +addPath('admin', __DIR__ . '/views'); + + //$router->get('/machin', ProductCrudAction::class, 'machin.bidule'); // ProductIndexAction + /*if ($renderer instanceof TwigRenderer) { + $renderer->getTwig()->addExtension($adminTwigExtension); + }*/ + } +} diff --git a/src/Admin/AdminTwigExtension.php b/src/Admin/AdminTwigExtension.php new file mode 100644 index 0000000..7b5ab90 --- /dev/null +++ b/src/Admin/AdminTwigExtension.php @@ -0,0 +1,30 @@ +widgets = $widgets; + } + + public function getFunctions(): array + { + return [ + new \Twig_SimpleFunction('admin_menu', [$this, 'renderMenu'], ['is_safe' => ['html']]) + ]; + } + + public function renderMenu(): string + { + return array_reduce($this->widgets, function (string $html, AdminWidgetInterface $widget) { + return $html . $widget->renderMenu(); + }, ''); + } +} diff --git a/src/Admin/AdminWidgetInterface.php b/src/Admin/AdminWidgetInterface.php new file mode 100644 index 0000000..9f8510b --- /dev/null +++ b/src/Admin/AdminWidgetInterface.php @@ -0,0 +1,10 @@ + '/admin', + 'admin.widgets' => [], + \App\Admin\AdminTwigExtension::class => \DI\object()->constructor(\DI\get('admin.widgets')), + AdminModule::class => \DI\object()->constructorParameter('prefix', \DI\get('admin.prefix')) + //DashboardAction::class => \DI\object()->constructorParameter('widgets', \DI\get('admin.widgets')) +]; diff --git a/src/Admin/views/layout.twig b/src/Admin/views/layout.twig new file mode 100644 index 0000000..93024c9 --- /dev/null +++ b/src/Admin/views/layout.twig @@ -0,0 +1,60 @@ + + + + {% block title "Mon site " %} + + + + + + + + +
+ + {% if flash('success') %} +
+ {{ flash('success') }} +
+ {% endif %} + + {% if flash('error') %} +
+ {{ flash('error') }} +
+ {% endif %} + + {% block body %}{% endblock %} + +
+ + + + + + + + \ No newline at end of file diff --git a/src/Auth/Action/LoginAction.php b/src/Auth/Action/LoginAction.php new file mode 100644 index 0000000..8a11870 --- /dev/null +++ b/src/Auth/Action/LoginAction.php @@ -0,0 +1,24 @@ +renderer = $renderer; + } + + public function __invoke(ServerRequestInterface $request) + { + return $this->renderer->render('@auth/login'); + } +} diff --git a/src/Auth/Action/LoginAttemptAction.php b/src/Auth/Action/LoginAttemptAction.php new file mode 100644 index 0000000..036f4c1 --- /dev/null +++ b/src/Auth/Action/LoginAttemptAction.php @@ -0,0 +1,62 @@ +renderer = $renderer; + $this->auth = $auth; + $this->router = $router; + $this->session = $session; + } + + public function __invoke(ServerRequestInterface $request) + { + $params = $request->getParsedBody(); + $user = $this->auth->login($params['username'], $params['password']); + if ($user) { + $path = $this->session->get('auth.redirect') ?: $this->router->generateUri('gmarche.index'); + $this->session->delete('auth.redirect'); + return new RedirectResponse($path); + } else { + (new FlashService($this->session))->error('Identifiant ou mot de passe incorrect'); + return $this->redirect('auth.login'); + } + } +} diff --git a/src/Auth/Action/LogoutAction.php b/src/Auth/Action/LogoutAction.php new file mode 100644 index 0000000..caa15f4 --- /dev/null +++ b/src/Auth/Action/LogoutAction.php @@ -0,0 +1,39 @@ +renderer = $renderer; + $this->auth = $auth; + $this->flashService = $flashService; + } + + public function __invoke(ServerRequestInterface $request) + { + $this->auth->logout(); + $this->flashService->success('Vous êtes maintenant déconnecté'); + return new RedirectResponse('/gmarche'); + } +} diff --git a/src/Auth/Action/PasswordForgetAction.php b/src/Auth/Action/PasswordForgetAction.php new file mode 100644 index 0000000..cc34761 --- /dev/null +++ b/src/Auth/Action/PasswordForgetAction.php @@ -0,0 +1,73 @@ +renderer = $renderer; + $this->userTable = $userTable; + $this->mailer = $mailer; + $this->flashService = $flashService; + } + + public function __invoke(ServerRequestInterface $request) + { + if ($request->getMethod() === 'GET') { + return $this->renderer->render('@auth/password'); + } + $params = $request->getParsedBody(); + $validator = (new Validator($params)) + ->notEmpty('email') + ->email('email'); + if ($validator->isValid()) { + try { + $user = $this->userTable->findBy('email', $params['email']); + $token = $this->userTable->resetPassword($user->id); + $this->mailer->send($user->email, [ + 'id' => $user->id, + 'token' => $token + ]); + $this->flashService->success('Un email vous a été envoyé'); + return new RedirectResponse($request->getUri()->getPath()); + } catch (NoRecordException $e) { + $errors = ['email' => 'Aucun utilisateur ne correspon à cet email']; + } + } else { + $errors = $validator->getErrors(); + } + return $this->renderer->render('@auth/password', compact('errors')); + } +} diff --git a/src/Auth/Action/PasswordResetAction.php b/src/Auth/Action/PasswordResetAction.php new file mode 100644 index 0000000..c23a7be --- /dev/null +++ b/src/Auth/Action/PasswordResetAction.php @@ -0,0 +1,75 @@ +renderer = $renderer; + $this->userTable = $userTable; + $this->router = $router; + $this->flashService = $flashService; + } + + public function __invoke(ServerRequestInterface $request) + { + /** @var User $user */ + $user = $this->userTable->find($request->getAttribute('id')); + if ($user->getPasswordReset() !== null && + $user->getPasswordReset() === $request->getAttribute('token') && + time() - $user->getPasswordResetAt()->getTimestamp() < 600 + ) { + if ($request->getMethod() === 'GET') { + return $this->renderer->render('@auth/reset'); + } else { + $params = $request->getParsedBody(); + $validator = (new Validator($params)) + ->length('password', 4) + ->confirm('password'); + if ($validator->isValid()) { + $this->userTable->updatePassword($user->getId(), $params['password']); + $this->flashService->success('Votre mot de passe a bien été changé'); + return new RedirectResponse($this->router->generateUri('auth.login')); + } else { + $errors = $validator->getErrors(); + return $this->renderer->render('@auth/reset', compact('errors')); + } + } + } else { + $this->flashService->error('Token invalid'); + return new RedirectResponse($this->router->generateUri('auth.password')); + } + } +} diff --git a/src/Auth/AuthModule.php b/src/Auth/AuthModule.php new file mode 100644 index 0000000..2620adb --- /dev/null +++ b/src/Auth/AuthModule.php @@ -0,0 +1,33 @@ +addPath('auth', __DIR__ . '/views'); + $router->get($container->get('auth.login'), LoginAction::class, 'auth.login'); + $router->post($container->get('auth.login'), LoginAttemptAction::class); + $router->post('/logout', LogoutAction::class, 'auth.logout'); + $router->any('/password', PasswordForgetAction::class, 'auth.password'); + $router->any('/password/reset/{id:\d+}/{token}', PasswordResetAction::class, 'auth.reset'); + } +} diff --git a/src/Auth/AuthTwigExtension.php b/src/Auth/AuthTwigExtension.php new file mode 100644 index 0000000..c7e08f9 --- /dev/null +++ b/src/Auth/AuthTwigExtension.php @@ -0,0 +1,25 @@ +auth = $auth; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('current_user', [$this->auth, 'getUser']) + ]; + } +} diff --git a/src/Auth/DatabaseAuth.php b/src/Auth/DatabaseAuth.php new file mode 100644 index 0000000..e0890e1 --- /dev/null +++ b/src/Auth/DatabaseAuth.php @@ -0,0 +1,81 @@ +userTable = $userTable; + $this->session = $session; + } + + public function login(string $username, string $password): ?User + { + if (empty($username) || empty($password)) { + return null; + } + + /** @var \App\Auth\User $user */ + $user = $this->userTable->findBy('username', $username); + if ($user && password_verify($password, $user->password)) { + $this->setUser($user); + return $user; + } + + return null; + } + + public function logout(): void + { + + $this->session->delete('auth.user'); + } + + /** + * @return User|null + */ + public function getUser(): ?User + { + if ($this->user) { + return $this->user; + } + $userId = $this->session->get('auth.user'); + if ($userId) { + try { + $this->user = $this->userTable->find($userId); + return $this->user; + } catch (NoRecordException $exception) { + $this->session->delete('auth.user'); + return null; + } + } + return null; + } + + public function setUser(\App\Auth\User $user): void + { + $this->session->set('auth.user', $user->id); + $this->user = $user; + } +} diff --git a/src/Auth/ForbiddenMiddleware.php b/src/Auth/ForbiddenMiddleware.php new file mode 100644 index 0000000..7e89ea5 --- /dev/null +++ b/src/Auth/ForbiddenMiddleware.php @@ -0,0 +1,58 @@ +loginPath = $loginPath; + $this->session = $session; + } + + /** + * @param ServerRequestInterface $request + * @param DelegateInterface $delegate + * @return ResponseInterface + * @throws \TypeError + */ + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + try { + return $delegate->process($request); + } catch (ForbiddenException $exception) { + return $this->redirectLogin($request); + } catch (\TypeError $error) { + if (strpos($error->getMessage(), \Framework\Auth\User::class) !== false) { + return $this->redirectLogin($request); + } + throw $error; + } + } + + public function redirectLogin(ServerRequestInterface $request): ResponseInterface + { + $this->session->set('auth.redirect', $request->getUri()->getPath()); + (new FlashService($this->session))->error('Vous devez posséder un compte pour accéder à cette page'); + return new RedirectResponse($this->loginPath); + } +} diff --git a/src/Auth/Mailer/PasswordResetMailer.php b/src/Auth/Mailer/PasswordResetMailer.php new file mode 100644 index 0000000..df5aa8b --- /dev/null +++ b/src/Auth/Mailer/PasswordResetMailer.php @@ -0,0 +1,40 @@ +mailer = $mailer; + $this->renderer = $renderer; + $this->from = $from; + } + + public function send(string $to, array $params) + { + $message = new \Swift_Message( + 'Réinitialisation de votre mot de passe', + $this->renderer->render('@auth/email/password.text', $params) + ); + $message->addPart($this->renderer->render('@auth/email/password.html', $params), 'text/html'); + $message->setTo($to); + $message->setFrom($this->from); + $this->mailer->send($message); + } +} diff --git a/src/Auth/User.php b/src/Auth/User.php new file mode 100644 index 0000000..03da9ab --- /dev/null +++ b/src/Auth/User.php @@ -0,0 +1,135 @@ +firstname; + } + + /** + * @return mixed + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * @return string + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * @return string[] + */ + public function getRoles(): array + { + return []; + } + + /** + * @return mixed + */ + public function getPasswordReset() + { + return $this->passwordReset; + } + + /** + * @param mixed $passwordReset + */ + public function setPasswordReset($passwordReset) + { + $this->passwordReset = $passwordReset; + } + + public function setPasswordResetAt($date) + { + if (is_string($date)) { + $this->passwordResetAt = new \DateTime($date); + } else { + $this->passwordResetAt = $date; + } + } + + /** + * @return mixed + */ + public function getPasswordResetAt(): ?\DateTime + { + return $this->passwordResetAt; + } + + /** + * @return mixed + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param mixed $email + */ + public function setEmail($email) + { + $this->email = $email; + } + + /** + * @return mixed + */ + public function getPassword() + { + return $this->password; + } + + /** + * @param mixed $password + */ + public function setPassword($password) + { + $this->password = $password; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } +} diff --git a/src/Auth/UserTable.php b/src/Auth/UserTable.php new file mode 100644 index 0000000..eb5fec4 --- /dev/null +++ b/src/Auth/UserTable.php @@ -0,0 +1,36 @@ +entity = $entity; + parent::__construct($pdo); + } + + public function resetPassword(int $id): string + { + $token = Uuid::uuid4()->toString(); + $this->update($id, [ + 'password_reset' => $token, + 'password_reset_at' => date('Y-m-d H:i:s') + ]); + return $token; + } + + public function updatePassword(int $id, string $password): void + { + $this->update($id, [ + 'password' => password_hash($password, PASSWORD_DEFAULT), + 'password_reset' => null, + 'password_reset_at' => null + ]); + } +} diff --git a/src/Auth/config.php b/src/Auth/config.php new file mode 100644 index 0000000..730599b --- /dev/null +++ b/src/Auth/config.php @@ -0,0 +1,22 @@ + '/login', + 'auth.entity' => \App\Auth\User::class, + 'twig.extensions' => \DI\add([ + \Di\get(\App\Auth\AuthTwigExtension::class) + ]), + Auth\User::class => \DI\factory(function (Auth $auth) { + return $auth->getUser(); + })->parameter('auth', \DI\get(Auth::class)), + Auth::class => \DI\get(DatabaseAuth::class), + + \App\Auth\UserTable::class => \DI\object()->constructorParameter('entity', \DI\get('auth.entity')), + ForbiddenMiddleware::class => \DI\object()->constructorParameter('loginPath', \DI\get('auth.login')), + PasswordResetMailer::class => \DI\object()->constructorParameter('from', \DI\get('mail.from')) +]; diff --git a/src/Auth/db/seeds/UserSeeder.php b/src/Auth/db/seeds/UserSeeder.php new file mode 100644 index 0000000..e6a1a25 --- /dev/null +++ b/src/Auth/db/seeds/UserSeeder.php @@ -0,0 +1,17 @@ +table('users') + ->insert([ + 'username' => 'admin', + 'email' => 'admin@admin.fr', + 'password' => password_hash('admin', PASSWORD_DEFAULT) + ]) + ->save(); + } +} diff --git a/src/Auth/views/email/password.html.twig b/src/Auth/views/email/password.html.twig new file mode 100644 index 0000000..be16cff --- /dev/null +++ b/src/Auth/views/email/password.html.twig @@ -0,0 +1,6 @@ +

+ Vous avez demandé la réinitialisation de votre de mot de passe. +

+

+ {{ domain }}{{ path('auth.reset', {id: id, token: token}) }} +

\ No newline at end of file diff --git a/src/Auth/views/email/password.text.twig b/src/Auth/views/email/password.text.twig new file mode 100644 index 0000000..4595714 --- /dev/null +++ b/src/Auth/views/email/password.text.twig @@ -0,0 +1,3 @@ +Vous avez demandé la réinitialisation de votre de mot de passe. + +{{ domain }}{{ path('auth.reset', {id: id, token: token}) }} \ No newline at end of file diff --git a/src/Auth/views/login.twig b/src/Auth/views/login.twig new file mode 100644 index 0000000..cdc4ede --- /dev/null +++ b/src/Auth/views/login.twig @@ -0,0 +1,27 @@ +{% extends 'layout.twig' %} + + +{% block body %} + + + {% if flash('error') %} +
+ {{ flash('error') }} +
+ {% endif %} + + +
+
+ {{ csrf_input() }} + {{ field('username', null, 'Nom d\'utilisateur') }} + {{ field('password', null, 'Mot de passe', {type: 'password'}) }} +

Mot de passe oublié ?

+ +
+
+{% endblock %} diff --git a/src/Auth/views/password.twig b/src/Auth/views/password.twig new file mode 100644 index 0000000..66eebf5 --- /dev/null +++ b/src/Auth/views/password.twig @@ -0,0 +1,24 @@ +{% extends 'layout.twig' %} + + +{% block body %} + + + {% if flash('error') %} +
+ {{ flash('error') }} +
+ {% endif %} + +
+
+ {{ csrf_input() }} + {{ field('email', null, 'Email', {type: 'email'}) }} + +
+
+{% endblock %} diff --git a/src/Auth/views/reset.twig b/src/Auth/views/reset.twig new file mode 100644 index 0000000..c99dc5c --- /dev/null +++ b/src/Auth/views/reset.twig @@ -0,0 +1,20 @@ +{% extends 'layout.twig' %} + + +{% block body %} + + + {% if flash('error') %} +
+ {{ flash('error') }} +
+ {% endif %} + +
+ {{ csrf_input() }} + {{ field('password', null, 'Mot de passe', {type: 'password'}) }} + {{ field('password_confirm', null, 'Confirmer le mot de passe', {type: 'password'}) }} + +
+ +{% endblock %} diff --git a/src/Contact/ContactAction.php b/src/Contact/ContactAction.php new file mode 100644 index 0000000..4519215 --- /dev/null +++ b/src/Contact/ContactAction.php @@ -0,0 +1,32 @@ +renderer = $renderer; + } + + /** + * @param ServerRequestInterface $request + * @return RedirectResponse|string + */ + public function __invoke(ServerRequestInterface $request) + { + if ($request->getMethod() === 'GET') { + return $this->renderer->render('@contact/contact'); + } + } +} diff --git a/src/Contact/ContactModule.php b/src/Contact/ContactModule.php new file mode 100644 index 0000000..7042247 --- /dev/null +++ b/src/Contact/ContactModule.php @@ -0,0 +1,19 @@ +addPath('contact', __DIR__); + $router->get('/contact', ContactAction::class, 'contact'); + //$router->post('/contact', ContactAction::class); + } +} diff --git a/src/Contact/contact.twig b/src/Contact/contact.twig new file mode 100644 index 0000000..88576e2 --- /dev/null +++ b/src/Contact/contact.twig @@ -0,0 +1,133 @@ +{% extends 'layout.twig' %} + +{% block title "Ğ1-Marché - Contact" %} +{% block body %} + + {% if explodeUrl()[1]=='contact' %} + + {% endif %} +
+
+ Ğ1-Marché +
+

+

QUI SOMMES-NOUS ?

+

+
+
+ + NOX +
+
+ + POKA +
+
+ + ATTILAX +
+
+
+
+
+

Utilisateurs et membres de la Monnaie Libre depuis deux ans, nous + avons voulu créer un outil permettant de gérer et d'organiser les + G-marchés dans toute la France.

+

Avec Ğ1-MARCHÉ, vous pouvez proposer à l'avance, consulter, + pré-acheter, faire une demande en vue du prochain G-Marché près de + chez vous... Votre ville n'apparaît pas ? Il suffit de nous en faire + la demande, et nous l'intégrons dans le site. Nous vous fournissons + une redirection, un dossier générique avec le code source, vous + n'avez plus qu'à changer l'image du fond et le logo par ceux de + votre choix pour symboliser votre ville, et votre Ğ1-marché local + est prêt...

+

Pour nous contacter : gmarche@axiom-team.fr

+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/src/Contact/definitions.php b/src/Contact/definitions.php new file mode 100644 index 0000000..bf5615d --- /dev/null +++ b/src/Contact/definitions.php @@ -0,0 +1,5 @@ + \DI\get('mail.to'), + // \App\Contact\ContactAction::class => \DI\object()->constructorParameter('to', \DI\get('contact.to')) +]; diff --git a/src/Framework/Actions/CrudAction.php b/src/Framework/Actions/CrudAction.php new file mode 100644 index 0000000..a71f166 --- /dev/null +++ b/src/Framework/Actions/CrudAction.php @@ -0,0 +1,255 @@ + "L'élément truc a bien été créé", /* truc sera remplacé par le vrai nom ensuite */ + 'edit' => "L'élément truc a bien été modifié", /* truc sera remplacé par le vrai nom ensuite */ + 'delete' => "L'élément truc a bien été supprimé" /* truc sera remplacé par le vrai nom ensuite */ + ]; + + /** + * @var array + */ + protected $acceptedParams = []; + + use RouterAwareAction; + + public function __construct( + RendererInterface $renderer, + Router $router, + Table $table, + FlashService $flash + ) { + $this->renderer = $renderer; + $this->router = $router; + $this->table = $table; + $this->flash = $flash; + } + + public function __invoke(Request $request) + { + $this->renderer->addGlobal('viewPath', $this->viewPath); + $this->renderer->addGlobal('routePrefix', $this->routePrefix); + if ($request->getMethod() === 'DELETE') { + return $this->delete($request); + } + if (substr((string)$request->getUri(), -3) === 'new') { + return $this->create($request); + } + if ($request->getAttribute('id')) { + return $this->edit($request); + } + return $this->index($request); + } + + /** + * Affiche la liste des éléments + * @param Request $request + * @return string + */ + public function index(Request $request): string + { + $params = $request->getQueryParams(); + $items = $this->table->findAll()->paginate(12, $params['p'] ?? 1); + return $this->renderer->render($this->viewPath . '/index', compact('items')); + } + + /** + * Edite un élément + * @param Request $request + * @return ResponseInterface|string + */ + public function edit(Request $request) + { + $id = (int)$request->getAttribute('id'); + $item = $this->table->find($id); + $antenne = $item->antenneId; + + if ($request->getMethod() === 'POST') { + $validator = $this->getValidator($request); + if ($validator->isValid()) { + $this->table->update($id, $this->prePersist($request, $item)); + $this->postPersist($request, $item); + // On récupère le nom du produit pour l'afficher dans le message de success + $requete = $this->prePersist($request, $item); + $occurrence = $requete['name']; + $message_edit = $this->messages['edit']; + $message_edit = str_replace('truc', "'".$occurrence."'", $message_edit ); + $this->flash->success($message_edit); + $region = $request->getAttribute('region'); + $slug = $request->getAttribute('slug'); + return $this->redirect($this->routePrefix . '.index',compact('region','slug','antenne' )); + } + $errors = $validator->getErrors(); + Hydrator::hydrate($request->getParsedBody(), $item); + } + $errors = $errors ?? ''; + return $this->renderer->render( + $this->viewPath . '/edit', + $this->formParams(compact('item', 'errors')) + ); + } + + /** + * Crée un nouvel élément + * @param Request $request + * @return ResponseInterface|string + */ + public function create(Request $request) + { + $item = $this->getNewEntity(); + + if ($request->getMethod() === 'POST') { + $validator = $this->getValidator($request); + if ($validator->isValid()) { + $this->table->insert($this->prePersist($request, $item)); + $region = $request->getAttribute('region'); + $slug = $request->getAttribute('slug'); + $antenne = $request->getParsedBody()['antenne_id']; + $this->postPersist($request, $item); + // On récupère le nom du produit pour l'afficher dans le message de success + $requete = $this->prePersist($request, $item); + $occurrence = $requete['name']; + $message_create = $this->messages['create']; + $message_create = str_replace('truc', "'".$occurrence."'", $message_create ); + $this->flash->success($this->messages['create']); + + return $this->redirect($this->routePrefix . '.index',compact('region','slug','antenne' )); + } + Hydrator::hydrate($request->getParsedBody(), $item); + $errors = $validator->getErrors(); + } + $errors = $errors ?? ''; + return $this->renderer->render( + $this->viewPath . '/create', + $this->formParams(compact('item', 'errors')) + ); + } + + /** + * Action de suppression + * + * @param Request $request + * @return ResponseInterface + */ + public function delete(Request $request) + { + $this->table->delete($request->getAttribute('id')); + $region = $request->getAttribute('region'); + $slug = $request->getAttribute('slug'); + $antenne = $request->getParsedBody()['antenne_id']; + // On récupère le nom du produit pour l'afficher dans le message de success + $occurrence = $request->getParsedBody()['produit_name']; + $message_delete = $this->messages['delete']; + $message_delete = str_replace('truc', "'".$occurrence."'", $message_delete ); + $this->flash->success($message_delete); + return $this->redirect($this->routePrefix . '.index',compact('region','slug','antenne' )); + } + + /** + * Filtre les paramètres reçus par la requête + * + * @param Request $request + * @return array + */ + protected function prePersist(Request $request, $item): array + { + return array_filter(array_merge($request->getParsedBody(), $request->getUploadedFiles()), function ($key) { + return in_array($key, $this->acceptedParams); + }, ARRAY_FILTER_USE_KEY); + } + + /** + * Permet d'effectuer un traitement après la persistence + * @param Request $request + * @param $item + */ + protected function postPersist(Request $request, $item): void + { + } + + /** + * Génère le validateur pour valider les données + * + * @param Request $request + * @return Validator + */ + protected function getValidator(Request $request) + { + return new Validator(array_merge($request->getParsedBody(), $request->getUploadedFiles())); + } + + /** + * Génère une nouvelle entité pour l'action de création + * + * @return mixed + */ + protected function getNewEntity() + { + $entity = $this->table->getEntity(); + return new $entity(); + } + + /** + * Permet de traiter les paramètres à envoyer à la vue + * + * @param $params + * @return array + */ + protected function formParams(array $params): array + { + return $params; + } +} diff --git a/src/Framework/Actions/RouterAwareAction.php b/src/Framework/Actions/RouterAwareAction.php new file mode 100644 index 0000000..2159128 --- /dev/null +++ b/src/Framework/Actions/RouterAwareAction.php @@ -0,0 +1,30 @@ +router->generateUri($path, $params); + return (new Response()) + ->withStatus(301) + ->withHeader('Location',$redirectUri); + } +} diff --git a/src/Framework/App.php b/src/Framework/App.php new file mode 100644 index 0000000..502ec97 --- /dev/null +++ b/src/Framework/App.php @@ -0,0 +1,150 @@ +isSequential($definitions)) { + $definitions = [$definitions]; + } + $this->definitions = $definitions; + } + + /** + * Rajoute un module à l'application + * + * @param string $module + * @return App + */ + public function addModule(string $module): self + { + $this->modules[] = $module; + return $this; + } + + /** + * Ajoute un middleware + * + * @param string|callable|MiddlewareInterface $routePrefix + * @param null|string|callable|MiddlewareInterface $middleware + * @return App + */ + public function pipe($routePrefix, $middleware = null): self + { + if ($middleware === null) { + $this->middlewares[] = $routePrefix; + } else { + $this->middlewares[] = new RoutePrefixedMiddleware($this->getContainer(), $routePrefix, $middleware); + } + return $this; + } + + public function process(ServerRequestInterface $request): ResponseInterface + { + $this->index++; + if ($this->index > 1) { + throw new \Exception(); + } + $middleware = new CombinedMiddleware($this->getContainer(), $this->middlewares); + return $middleware->process($request, $this); + } + + public function run(ServerRequestInterface $request): ResponseInterface + { + foreach ($this->modules as $module) { + $this->getContainer()->get($module); + } + return $this->process($request); + } + + /** + * @return ContainerInterface + */ + public function getContainer(): ContainerInterface + { + if ($this->container === null) { + $builder = new ContainerBuilder(); + $env = getenv('ENV') ?: 'production'; + if ($env === 'production') { + //$builder->setDefinitionCache(new FilesystemCache('tmp/di')); + $builder->writeProxiesToFile(true, 'tmp/proxies'); + } + foreach ($this->definitions as $definition) { + $builder->addDefinitions($definition); + } + foreach ($this->modules as $module) { + if ($module::DEFINITIONS) { + $builder->addDefinitions($module::DEFINITIONS); + } + } + $builder->addDefinitions([ + App::class => $this + ]); + $this->container = $builder->build(); + } + return $this->container; + } + + /** + * @return array + */ + public function getModules(): array + { + return $this->modules; + } + + private function isSequential(array $array): bool + { + if (empty($array)) { + return true; + } + return array_keys($array) === range(0, count($array) - 1); + } +} diff --git a/src/Framework/Auth.php b/src/Framework/Auth.php new file mode 100644 index 0000000..1eb050f --- /dev/null +++ b/src/Framework/Auth.php @@ -0,0 +1,13 @@ +auth = $auth; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + $user = $this->auth->getUser(); + if (is_null($user)) { + throw new ForbiddenException(); + } + return $delegate->process($request->withAttribute('user', $user)); + } +} diff --git a/src/Framework/Auth/RoleMiddleware.php b/src/Framework/Auth/RoleMiddleware.php new file mode 100644 index 0000000..585744d --- /dev/null +++ b/src/Framework/Auth/RoleMiddleware.php @@ -0,0 +1,36 @@ +auth = $auth; + $this->role = $role; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + $user = $this->auth->getUser(); + if ($user === null || !in_array($this->role, $user->getRoles())) { + throw new ForbiddenException(); + } + return $delegate->process($request); + } +} diff --git a/src/Framework/Auth/RoleMiddlewareFactory.php b/src/Framework/Auth/RoleMiddlewareFactory.php new file mode 100644 index 0000000..7b21392 --- /dev/null +++ b/src/Framework/Auth/RoleMiddlewareFactory.php @@ -0,0 +1,24 @@ +auth = $auth; + } + + public function makeForRole($role): RoleMiddleware + { + return new RoleMiddleware($this->auth, $role); + } +} diff --git a/src/Framework/Auth/User.php b/src/Framework/Auth/User.php new file mode 100644 index 0000000..d47f809 --- /dev/null +++ b/src/Framework/Auth/User.php @@ -0,0 +1,17 @@ + $value) { + $method = self::getSetter($key); + if (method_exists($instance, $method)) { + $instance->$method($value); + } else { + $property = lcfirst(self::getProperty($key)); + $instance->$property = $value; + } + } + return $instance; + } + + private static function getSetter(string $fieldName): string + { + return 'set' . self::getProperty($fieldName); + } + + private static function getProperty(string $fieldName): string + { + return join('', array_map('ucfirst', explode('_', $fieldName))); + } +} diff --git a/src/Framework/Database/NoRecordException.php b/src/Framework/Database/NoRecordException.php new file mode 100644 index 0000000..f34a86e --- /dev/null +++ b/src/Framework/Database/NoRecordException.php @@ -0,0 +1,8 @@ +query = $query; + } + + /** + * Returns the number of results. + * + * @return integer The number of results. + */ + public function getNbResults(): int + { + return $this->query->count(); + } + + /** + * Returns an slice of the results. + * + * @param integer $offset The offset. + * @param integer $length The length. + * + * @return \Traversable The slice. + */ + public function getSlice($offset, $length): QueryResult + { + $query = clone $this->query; + return $query->limit($length, $offset)->fetchAll(); + } +} diff --git a/src/Framework/Database/Query.php b/src/Framework/Database/Query.php new file mode 100644 index 0000000..a2f615a --- /dev/null +++ b/src/Framework/Database/Query.php @@ -0,0 +1,275 @@ +pdo = $pdo; + } + + /** + * Definit le FROM + * @param string $table + * @param null|string $alias + * @return Query + */ + public function from(string $table, ?string $alias = null): self + { + if ($alias) { + $this->from[$table] = $alias; + } else { + $this->from[] = $table; + } + return $this; + } + + /** + * Spécifie les champs à récupérer + * @param string[] ...$fields + * @return Query + */ + public function select(string ...$fields): self + { + $this->select = $fields; + return $this; + } + + /** + * Spécifie la limite + * @param int $length + * @param int $offset + * @return Query + */ + public function limit(int $length, int $offset = 0): self + { + $this->limit = "$offset, $length"; + return $this; + } + + /** + * Spécifie l'ordre de récupération + * @param string $order + * @return Query + */ + public function order(string $order): self + { + $this->order[] = $order; + return $this; + } + + /** + * Ajoute une liaison + * @param string $table + * @param string $condition + * @param string $type + * @return Query + */ + public function join(string $table, string $condition, string $type = "left"): self + { + $this->joins[$type][] = [$table, $condition]; + return $this; + } + + /** + * Définit la condition de récupération + * @param string[] ...$condition + * @return Query + */ + public function where(string ...$condition): self + { + $this->where = array_merge($this->where, $condition); + return $this; + } + + /** + * Execute un COUNT() et renvoie la colonne + * @return int + */ + public function count(): int + { + $query = clone $this; + $table = current($this->from); + return $query->select("COUNT($table.id)")->execute()->fetchColumn(); + } + + /** + * Définit les paramètre pour la requête + * @param array $params + * @return Query + */ + public function params(array $params): self + { + $this->params = array_merge($this->params, $params); + return $this; + } + + /** + * Spécifie l'entité à utiliser + * @param string $entity + * @return Query + */ + public function into(string $entity): self + { + $this->entity = $entity; + return $this; + } + + /** + * Récupère un résultat + */ + public function fetch() + { + $record = $this->execute()->fetch(\PDO::FETCH_ASSOC); + if ($record === false) { + return false; + } + if ($this->entity) { + return Hydrator::hydrate($record, $this->entity); + } + return $record; + } + + /** + * Récupère un résultat + * @param int $columnNumber + * @return mixed + */ + public function fetchColumn(int $columnNumber = 0) + { + return $this->execute()->fetchColumn($columnNumber); + } + + /** + * Retournera un résultat ou renvoie une exception + * @return bool|mixed + * @throws NoRecordException + */ + public function fetchOrFail() + { + $record = $this->fetch(); + if ($record === false) { + throw new NoRecordException(); + } + return $record; + } + + /** + * Lance la requête + * @return QueryResult + */ + public function fetchAll(): QueryResult + { + return new QueryResult( + $this->execute()->fetchAll(\PDO::FETCH_ASSOC), + $this->entity + ); + } + + /** + * Pagine les résultats + * @param int $perPage + * @param int $currentPage + * @return Pagerfanta + */ + public function paginate(int $perPage, int $currentPage = 1): Pagerfanta + { + $paginator = new PaginatedQuery($this); + return (new Pagerfanta($paginator))->setMaxPerPage($perPage)->setCurrentPage($currentPage); + } + + /** + * Génère la requête SQL + * @return string + */ + public function __toString() + { + $parts = ['SELECT']; + if ($this->select) { + $parts[] = join(', ', $this->select); + } else { + $parts[] = '*'; + } + $parts[] = 'FROM'; + $parts[] = $this->buildFrom(); + if (!empty($this->joins)) { + foreach ($this->joins as $type => $joins) { + foreach ($joins as [$table, $condition]) { + $parts[] = strtoupper($type) . " JOIN $table ON $condition"; + } + } + } + if (!empty($this->where)) { + $parts[] = "WHERE"; + $parts[] = "(" . join(') AND (', $this->where) . ')'; + } + if (!empty($this->order)) { + $parts[] = 'ORDER BY'; + $parts[] = join(', ', $this->order); + } + if ($this->limit) { + $parts[] = 'LIMIT ' . $this->limit; + } + return join(' ', $parts); + } + + /** + * Construit le FROM a as b .... + * @return string + */ + private function buildFrom(): string + { + $from = []; + foreach ($this->from as $key => $value) { + if (is_string($key)) { + $from[] = "$key as $value"; + } else { + $from[] = $value; + } + } + return join(', ', $from); + } + + /** + * Exécute la requête + * @return \PDOStatement + */ + private function execute() + { + $query = $this->__toString(); + if (!empty($this->params)) { + $statement = $this->pdo->prepare($query); + $statement->execute($this->params); + return $statement; + } + return $this->pdo->query($query); + } + + public function getIterator() + { + return $this->fetchAll(); + } +} diff --git a/src/Framework/Database/QueryResult.php b/src/Framework/Database/QueryResult.php new file mode 100644 index 0000000..f29624b --- /dev/null +++ b/src/Framework/Database/QueryResult.php @@ -0,0 +1,171 @@ +records = $records; + $this->entity = $entity; + } + + /** + * Récupère un éléments à l'index définit + * @param int $index + * @return mixed|null|string + */ + public function get(int $index) + { + if ($this->entity) { + if (!isset($this->hydratedRecords[$index])) { + $this->hydratedRecords[$index] = Hydrator::hydrate($this->records[$index], $this->entity); + } + return $this->hydratedRecords[$index]; + } + return $this->entity; + } + + /** + * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + * @since 5.0.0 + */ + public function current() + { + return $this->get($this->index); + } + + /** + * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + * @since 5.0.0 + */ + public function next(): void + { + $this->index++; + } + + /** + * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. + * @since 5.0.0 + */ + public function key() + { + return $this->index; + } + + /** + * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. + * @since 5.0.0 + */ + public function valid() + { + return isset($this->records[$this->index]); + } + + /** + * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + * @since 5.0.0 + */ + public function rewind() + { + $this->index = 0; + } + + /** + * Whether a offset exists + * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * @param mixed $offset

+ * An offset to check for. + *

+ * @return boolean true on success or false on failure. + *

+ *

+ * The return value will be casted to boolean if non-boolean was returned. + * @since 5.0.0 + */ + public function offsetExists($offset) + { + return isset($this->records[$offset]); + } + + /** + * Offset to retrieve + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param mixed $offset

+ * The offset to retrieve. + *

+ * @return mixed Can return all value types. + * @since 5.0.0 + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Offset to set + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param mixed $offset

+ * The offset to assign the value to. + *

+ * @param mixed $value

+ * The value to set. + *

+ * @return void + * @throws \Exception + * @since 5.0.0 + */ + public function offsetSet($offset, $value) + { + throw new \Exception("Can't alter records"); + } + + /** + * Offset to unset + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param mixed $offset

+ * The offset to unset. + *

+ * @return void + * @throws \Exception + * @since 5.0.0 + */ + public function offsetUnset($offset) + { + throw new \Exception("Can't alter records"); + } +} diff --git a/src/Framework/Database/Table.php b/src/Framework/Database/Table.php new file mode 100644 index 0000000..f8a6243 --- /dev/null +++ b/src/Framework/Database/Table.php @@ -0,0 +1,198 @@ +pdo = $pdo; + } + + /** + * Récupère une liste clef valeur de nos enregistrements + */ + public function findList(): array + { + if ( $this->table === 'users') { + $champ = 'username'; + } else { + $champ = 'name'; + } + //die(); + $results = $this->pdo + ->query("SELECT id, $champ FROM {$this->table}") + ->fetchAll(\PDO::FETCH_NUM); + $list = []; + foreach ($results as $result) { + $list[$result[0]] = $result[1]; + } + return $list; + } + + /** + * @return Query + */ + public function makeQuery(): Query + { + return (new Query($this->pdo)) + ->from($this->table, $this->table[0]) + ->into($this->entity); + } + + /** + * Récupère tous les enregistrements + * + * @return Query + */ + public function findAll(): Query + { + return $this->makeQuery(); + } + + /** + * Récupère une ligne par rapport à un champ + * + * @param string $field + * @param string $value + * @return array + * @throws NoRecordException + */ + public function findBy(string $field, string $value) + { + // echo "field = ".$field; + // die(); + return $this->makeQuery()->where("$field = :field")->params(["field" => $value])->fetchOrFail(); + } + + /** + * Récupère un élément à partir de son ID + * + * @param int $id + * @return mixed + * @throws NoRecordException + */ + public function find(int $id) + { + return $this->makeQuery()->where("id = $id")->fetchOrFail(); + } + + /** + * Récupère le nbre d'enregistrement + * + * @return int + */ + public function count(): int + { + return $this->makeQuery()->count(); + } + + /** + * Met à jour un enregistrement au niveau de la base de données + * + * @param int $id + * @param array $params + * @return bool + */ + public function update(int $id, array $params): bool + { + $fieldQuery = $this->buildFieldQuery($params); + $params["id"] = $id; + $query = $this->pdo->prepare("UPDATE {$this->table} SET $fieldQuery WHERE id = :id"); + return $query->execute($params); + } + + /** + * Crée un nouvel enregistrement + * + * @param array $params + * @return bool + */ + public function insert(array $params): bool + { + $fields = array_keys($params); + $values = join(', ', array_map(function ($field) { + return ':' . $field; + }, $fields)); + $fields = join(', ', $fields); + $query = $this->pdo->prepare("INSERT INTO {$this->table} ($fields) VALUES ($values)"); + // echo 'query ='; + // var_dump($query); + // die(); + return $query->execute($params); + } + + /** + * Supprime un enregistrment + * @param int $id + * @return bool + */ + public function delete(int $id): bool + { + $query = $this->pdo->prepare("DELETE FROM {$this->table} WHERE id = ?"); + return $query->execute([$id]); + } + + private function buildFieldQuery(array $params) + { + return join(', ', array_map(function ($field) { + return "$field = :$field"; + }, array_keys($params))); + } + + /** + * @return mixed + */ + public function getEntity(): string + { + return $this->entity; + } + + /** + * @return string + */ + public function getTable(): string + { + return $this->table; + } + + /** + * Vérifie qu'un enregistrement existe + * @param $id + * @return bool + */ + public function exists($id): bool + { + $query = $this->pdo->prepare("SELECT id FROM {$this->table} WHERE id = ?"); + $query->execute([$id]); + return $query->fetchColumn() !== false; + } + + /** + * @return \PDO + */ + public function getPdo(): \PDO + { + return $this->pdo; + } +} diff --git a/src/Framework/Entity/Timestamp.php b/src/Framework/Entity/Timestamp.php new file mode 100644 index 0000000..56bdb39 --- /dev/null +++ b/src/Framework/Entity/Timestamp.php @@ -0,0 +1,56 @@ +updatedAt; + } + + /** + * @param \DateTime|string|null $datetime + */ + public function setUpdatedAt($datetime): void + { + if (is_string($datetime)) { + $this->updatedAt = new \DateTime($datetime); + } else { + $this->updatedAt = $datetime; + } + } + + /** + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->createdAt; + } + + /** + * @param \DateTime|string|null $datetime + */ + public function setCreatedAt($datetime): void + { + if (is_string($datetime)) { + $this->createdAt = new \DateTime($datetime); + } else { + $this->createdAt = $datetime; + } + } +} diff --git a/src/Framework/Middleware/CombinedMiddleware.php b/src/Framework/Middleware/CombinedMiddleware.php new file mode 100644 index 0000000..3534bb5 --- /dev/null +++ b/src/Framework/Middleware/CombinedMiddleware.php @@ -0,0 +1,33 @@ +container = $container; + $this->middlewares = $middlewares; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + $delegate = new CombinedMiddlewareDelegate($this->container, $this->middlewares, $delegate); + return $delegate->process($request); + } +} diff --git a/src/Framework/Middleware/CombinedMiddlewareDelegate.php b/src/Framework/Middleware/CombinedMiddlewareDelegate.php new file mode 100644 index 0000000..30e5eec --- /dev/null +++ b/src/Framework/Middleware/CombinedMiddlewareDelegate.php @@ -0,0 +1,71 @@ +middlewares = $middlewares; + $this->container = $container; + $this->delegate = $delegate; + } + + public function process(ServerRequestInterface $request): ResponseInterface + { + $middleware = $this->getMiddleware(); + if (is_null($middleware)) { + return $this->delegate->process($request); + } elseif (is_callable($middleware)) { + $response = call_user_func_array($middleware, [$request, [$this, 'process']]); + if (is_string($response)) { + return new Response(200, [], $response); + } + return $response; + } elseif ($middleware instanceof MiddlewareInterface) { + return $middleware->process($request, $this); + } + } + + /** + * @return object + */ + private function getMiddleware() + { + if (array_key_exists($this->index, $this->middlewares)) { + if (is_string($this->middlewares[$this->index])) { + $middleware = $this->container->get($this->middlewares[$this->index]); + } else { + $middleware = $this->middlewares[$this->index]; + } + $this->index++; + return $middleware; + } + return null; + } +} diff --git a/src/Framework/Middleware/CsrfMiddleware.php b/src/Framework/Middleware/CsrfMiddleware.php new file mode 100644 index 0000000..f857168 --- /dev/null +++ b/src/Framework/Middleware/CsrfMiddleware.php @@ -0,0 +1,113 @@ +validSession($session); + $this->session = &$session; + $this->formKey = $formKey; + $this->sessionKey = $sessionKey; + $this->limit = $limit; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + if (in_array($request->getMethod(), ['POST', 'PUT', 'DELETE'])) { + $params = $request->getParsedBody() ?: []; + if (!array_key_exists($this->formKey, $params)) { + $this->reject(); + } else { + $csrfList = $this->session[$this->sessionKey] ?? []; + if (in_array($params[$this->formKey], $csrfList)) { + $this->useToken($params[$this->formKey]); + return $delegate->process($request); + } else { + $this->reject(); + } + } + } else { + return $delegate->process($request); + } + } + + public function generateToken(): string + { + $token = bin2hex(random_bytes(16)); + $csrfList = $this->session[$this->sessionKey] ?? []; + $csrfList[] = $token; + $this->session[$this->sessionKey] = $csrfList; + $this->limitTokens(); + return $token; + } + + private function reject(): void + { + throw new CsrfInvalidException(); + } + + private function useToken($token): void + { + $tokens = array_filter($this->session[$this->sessionKey], function ($t) use ($token) { + return $token !== $t; + }); + $this->session[$this->sessionKey] = $tokens; + } + + private function limitTokens(): void + { + $tokens = $this->session[$this->sessionKey] ?? []; + if (count($tokens) > $this->limit) { + array_shift($tokens); + } + $this->session[$this->sessionKey] = $tokens; + } + + private function validSession($session) + { + if (!is_array($session) && !$session instanceof \ArrayAccess) { + throw new \TypeError('La session passé au middleware CSRF n\'est pas traitable comme un tableau'); + } + } + + /** + * @return string + */ + public function getFormKey(): string + { + return $this->formKey; + } +} diff --git a/src/Framework/Middleware/DispatcherMiddleware.php b/src/Framework/Middleware/DispatcherMiddleware.php new file mode 100644 index 0000000..a470fd9 --- /dev/null +++ b/src/Framework/Middleware/DispatcherMiddleware.php @@ -0,0 +1,37 @@ +container = $container; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate) + { + $route = $request->getAttribute(Router\Route::class); + if (is_null($route)) { + return $delegate->process($request); + } + $callback = $route->getCallback(); + if (!is_array($callback)) { + $callback = [$callback]; + } + return (new CombinedMiddleware($this->container, $callback))->process($request, $delegate); + } +} diff --git a/src/Framework/Middleware/MethodMiddleware.php b/src/Framework/Middleware/MethodMiddleware.php new file mode 100644 index 0000000..8b1940f --- /dev/null +++ b/src/Framework/Middleware/MethodMiddleware.php @@ -0,0 +1,21 @@ +getParsedBody(); + if (array_key_exists('_method', $parsedBody) && + in_array($parsedBody['_method'], ['DELETE', 'PUT']) + ) { + $request = $request->withMethod($parsedBody['_method']); + } + return $next->process($request); + } + +} \ No newline at end of file diff --git a/src/Framework/Middleware/NotFoundMiddleware.php b/src/Framework/Middleware/NotFoundMiddleware.php new file mode 100644 index 0000000..0d92466 --- /dev/null +++ b/src/Framework/Middleware/NotFoundMiddleware.php @@ -0,0 +1,20 @@ + +
+
+

Erreur 404


Cette url n\'existe pas.

+ + Retour à l\'accueil
'); + } +} \ No newline at end of file diff --git a/src/Framework/Middleware/RendererRequestMiddleware.php b/src/Framework/Middleware/RendererRequestMiddleware.php new file mode 100644 index 0000000..d7849a7 --- /dev/null +++ b/src/Framework/Middleware/RendererRequestMiddleware.php @@ -0,0 +1,34 @@ +renderer = $renderer; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + $domain = sprintf( + '%s://%s%s', + $request->getUri()->getScheme(), + $request->getUri()->getHost(), + $request->getUri()->getPort() ? ':' . $request->getUri()->getPort() : '' + ); + $this->renderer->addGlobal('domain', $domain); + return $delegate->process($request); + } +} diff --git a/src/Framework/Middleware/RoutePrefixedMiddleware.php b/src/Framework/Middleware/RoutePrefixedMiddleware.php new file mode 100644 index 0000000..e947e98 --- /dev/null +++ b/src/Framework/Middleware/RoutePrefixedMiddleware.php @@ -0,0 +1,47 @@ +container = $container; + $this->prefix = $prefix; + $this->middleware = $middleware; + } + + public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface + { + $path = $request->getUri()->getPath(); + if (strpos($path, $this->prefix) === 0) { + if (is_string($this->middleware)) { + return $this->container->get($this->middleware)->process($request, $delegate); + } else { + return $this->middleware->process($request, $delegate); + } + } + return $delegate->process($request); + } +} diff --git a/src/Framework/Middleware/RouterMiddleware.php b/src/Framework/Middleware/RouterMiddleware.php new file mode 100644 index 0000000..97fe321 --- /dev/null +++ b/src/Framework/Middleware/RouterMiddleware.php @@ -0,0 +1,33 @@ +router = $router; + } + + public function __invoke(ServerRequestInterface $request, callable $next) + { + $route = $this->router->match($request); + if (is_null($route)) { + return $next($request); + } + $params = $route->getParams(); + $request = array_reduce(array_keys($params), function ($request, $key) use ($params) { + return $request->withAttribute($key, $params[$key]); + }, $request); + $request = $request->withAttribute(get_class($route), $route); + return $next($request); + } + +} \ No newline at end of file diff --git a/src/Framework/Middleware/TrailingSlashMiddleware.php b/src/Framework/Middleware/TrailingSlashMiddleware.php new file mode 100644 index 0000000..262a188 --- /dev/null +++ b/src/Framework/Middleware/TrailingSlashMiddleware.php @@ -0,0 +1,19 @@ +getUri()->getPath(); + if (!empty($uri) && $uri[-1] === "/") { + return (new \GuzzleHttp\Psr7\Response()) + ->withStatus(301) + ->withHeader('Location', substr($uri, 0, -1)); + } + return $next($request); + } + +} \ No newline at end of file diff --git a/src/Framework/Module.php b/src/Framework/Module.php new file mode 100644 index 0000000..81c8486 --- /dev/null +++ b/src/Framework/Module.php @@ -0,0 +1,11 @@ +addPath($defaultPath); + } + } + + /** + * Permet de rajouter un chemin pour charger les vues + * @param string $namespace + * @param null|string $path + */ + public function addPath(string $namespace, ?string $path = null): void + { + if (is_null($path)) { + $this->paths[self::DEFAULT_NAMESPACE] = $namespace; + } else { + $this->paths[$namespace] = $path; + } + } + + /** + * Rend une vue + * Le chemin peut être précisé avec des namespaces rajoutés via addPath() + * $this->render('@gmarche/view'); + * $this->render('view'); + * @param string $view + * @param array $params + * @return string + */ + public function render(string $view, array $params = []): string + { + if ($this->hasNamespace($view)) { + $path = $this->replaceNamespace($view) . '.php'; + } else { + $path = $this->paths[self::DEFAULT_NAMESPACE] . DIRECTORY_SEPARATOR . $view . '.php'; + } + ob_start(); + $renderer = $this; + extract($this->globals); + extract($params); + require($path); + return ob_get_clean(); + } + + /** + * Permet de rajouter des variables globales à toutes les vues + * + * @param string $key + * @param mixed $value + */ + public function addGlobal(string $key, $value): void + { + $this->globals[$key] = $value; + } + + private function hasNamespace(string $view): bool + { + return $view[0] === '@'; + } + + private function getNamespace(string $view): string + { + return substr($view, 1, strpos($view, '/') - 1); + } + + private function replaceNamespace(string $view): string + { + $namespace = $this->getNamespace($view); + return str_replace('@' . $namespace, $this->paths[$namespace], $view); + } +} diff --git a/src/Framework/Renderer/RendererInterface.php b/src/Framework/Renderer/RendererInterface.php new file mode 100644 index 0000000..597075a --- /dev/null +++ b/src/Framework/Renderer/RendererInterface.php @@ -0,0 +1,33 @@ +render('@gmarche/view'); + * $this->render('view'); + * @param string $view + * @param array $params + * @return string + */ + public function render(string $view, array $params = []): string; + + /** + * Rajoute des variables globales à toutes les vues + * + * @param string $key + * @param mixed $value + */ + public function addGlobal(string $key, $value): void; +} diff --git a/src/Framework/Renderer/TwigRenderer.php b/src/Framework/Renderer/TwigRenderer.php new file mode 100644 index 0000000..ee109be --- /dev/null +++ b/src/Framework/Renderer/TwigRenderer.php @@ -0,0 +1,56 @@ +twig = $twig; + } + + /** + * Permet de rajouter un chamin pour charger les vues + * @param string $namespace + * @param null|string $path + */ + public function addPath(string $namespace, ?string $path = null): void + { + $this->twig->getLoader()->addPath($path, $namespace); + } + + /** + * Permet de rendre une vue + * Le chemin peut être précisé avec des namespace rajoutés via addPath() + * $this->render('@blog/view'); + * $this->render('view'); + * @param string $view + * @param array $params + * @return string + */ + public function render(string $view, array $params = []): string + { + return $this->twig->render($view . '.twig', $params); + } + + /** + * Permet de rajouter des variables globales à toutes les vues + * + * @param string $key + * @param mixed $value + */ + public function addGlobal(string $key, $value): void + { + $this->twig->addGlobal($key, $value); + } + + /** + * @return \Twig_Environment + */ + public function getTwig(): \Twig_Environment + { + return $this->twig; + } +} diff --git a/src/Framework/Renderer/TwigRendererFactory.php b/src/Framework/Renderer/TwigRendererFactory.php new file mode 100644 index 0000000..8a8d76f --- /dev/null +++ b/src/Framework/Renderer/TwigRendererFactory.php @@ -0,0 +1,30 @@ +get('env') !== 'production'; + $debug = true; + $viewPath = $container->get('views.path'); + $loader = new \Twig_Loader_Filesystem($viewPath); + $twig = new \Twig_Environment($loader, [ + //'debug' => $debug, + 'debug' => true, + 'cache' => $debug ? false : 'tmp/views', + 'auto_reload' => $debug + ]); + $twig->addExtension(new DebugExtension()); + if ($container->has('twig.extensions')) { + foreach ($container->get('twig.extensions') as $extension) { + $twig->addExtension($extension); + } + } + return new TwigRenderer($twig); + } +} diff --git a/src/Framework/Response/RedirectResponse.php b/src/Framework/Response/RedirectResponse.php new file mode 100644 index 0000000..a728b52 --- /dev/null +++ b/src/Framework/Response/RedirectResponse.php @@ -0,0 +1,13 @@ + $url]); + } +} diff --git a/src/Framework/Router.php b/src/Framework/Router.php new file mode 100644 index 0000000..847b445 --- /dev/null +++ b/src/Framework/Router.php @@ -0,0 +1,125 @@ +router = new FastRouteRouter(null, null, [ + FastRouteRouter::CONFIG_CACHE_ENABLED => !is_null($cache), + FastRouteRouter::CONFIG_CACHE_FILE => $cache + ]); + } + + /** + * @param string $path + * @param string|callable $callable + * @param string $name + */ + public function get(string $path, $callable, ?string $name = null) + { + $this->router->addRoute(new ZendRoute($path, $callable, ['GET'], $name)); + } + + /** + * @param string $path + * @param string|callable $callable + * @param string $name + */ + public function post(string $path, $callable, ?string $name = null) + { + $this->router->addRoute(new ZendRoute($path, $callable, ['POST'], $name)); + } + + /** + * @param string $path + * @param string|callable $callable + * @param string $name + */ + public function delete(string $path, $callable, ?string $name = null) + { + $this->router->addRoute(new ZendRoute($path, $callable, ['DELETE'], $name)); + } + + /** + * @param string $path + * @param $callable + * @param null|string $name + */ + public function any(string $path, $callable, ?string $name = null) + { + $this->router->addRoute(new ZendRoute($path, $callable, ['DELETE', 'POST', 'GET', 'PUT'], $name)); + } + + /** + * Génère les routes du CRUD + * + * @param string $prefixPath + * @param $callable + * @param string $prefixName + */ + public function crud(string $prefixPath, $callable, string $prefixName) + { + $this->get("$prefixPath", $callable, "$prefixName.index"); + $this->get("$prefixPath/new", $callable, "$prefixName.create"); + $this->post("$prefixPath/new", $callable); + $this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit"); + $this->post("$prefixPath/{id:\d+}", $callable); + $this->delete("$prefixPath/{id:\d+}", $callable, "$prefixName.delete"); + } + + + + /* public function crud_product(string $prefixPath, $callable, string $prefixName) + { + $this->get("$prefixPath", $callable, "$prefixName.index"); + $this->get("$prefixPath/new", $callable, "$prefixName.create"); + $this->post("$prefixPath/new", $callable); + $this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit"); + $this->post("$prefixPath/{id:\d+}", $callable); + $this->delete("$prefixPath/{id:\d+}", $callable, "$prefixName.delete"); + }*/ + /** + * @param ServerRequestInterface $request + * @return Route|null + */ + public function match(ServerRequestInterface $request): ?Route + { + //echo "
request = "; + //echo "
"; + //var_dump($request); + //die(); + $result = $this->router->match($request); + if ($result->isSuccess()) { + return new Route( + $result->getMatchedRouteName(), + $result->getMatchedMiddleware(), + $result->getMatchedParams() + ); + } + return null; + } + + public function generateUri(string $name, array $params = [], array $queryParams = []): ?string + { + $uri = $this->router->generateUri($name, $params); + if (!empty($queryParams)) { + return $uri . '?' . http_build_query($queryParams); + } + return $uri; + } +} diff --git a/src/Framework/Router/Route.php b/src/Framework/Router/Route.php new file mode 100644 index 0000000..7acb878 --- /dev/null +++ b/src/Framework/Router/Route.php @@ -0,0 +1,63 @@ +name = $name; + $this->callback = $callback; + $this->parameters = $parameters; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @return string|callable + */ + public function getCallback() + { + return $this->callback; + } + + /** + * Retrieve the URL parameters + * @return string[] + */ + public function getParams(): array + { + return $this->parameters; + } +} diff --git a/src/Framework/Router/RouterFactory.php b/src/Framework/Router/RouterFactory.php new file mode 100644 index 0000000..6b74edf --- /dev/null +++ b/src/Framework/Router/RouterFactory.php @@ -0,0 +1,18 @@ +get('env') === 'production') { + $cache = 'tmp/routes'; + } + return new Router($cache); + } +} diff --git a/src/Framework/Router/RouterTwigExtension.php b/src/Framework/Router/RouterTwigExtension.php new file mode 100644 index 0000000..4634b2c --- /dev/null +++ b/src/Framework/Router/RouterTwigExtension.php @@ -0,0 +1,39 @@ +router = $router; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('path', [$this, 'pathFor']), + new \Twig_SimpleFunction('is_subpath', [$this, 'isSubPath']) + ]; + } + + public function pathFor(string $path, array $params = []): string + { + return $this->router->generateUri($path, $params); + } + + public function isSubpath(string $path): bool + { + $uri = $_SERVER['REQUEST_URI'] ?? '/'; + $expectedUri = $this->router->generateUri($path); + return strpos($uri, $expectedUri) !== false; + } +} diff --git a/src/Framework/Session/ArraySession.php b/src/Framework/Session/ArraySession.php new file mode 100644 index 0000000..088f717 --- /dev/null +++ b/src/Framework/Session/ArraySession.php @@ -0,0 +1,44 @@ +session)) { + return $this->session[$key]; + } + return $default; + } + + /** + * Ajoute une information en Session + * + * @param string $key + * @param $value + * @return mixed + */ + public function set(string $key, $value): void + { + $this->session[$key] = $value; + } + + /** + * Supprime une clef en session + * @param string $key + */ + public function delete(string $key): void + { + unset($this->session[$key]); + } +} diff --git a/src/Framework/Session/FlashService.php b/src/Framework/Session/FlashService.php new file mode 100644 index 0000000..232631b --- /dev/null +++ b/src/Framework/Session/FlashService.php @@ -0,0 +1,47 @@ +session = $session; + } + + public function success(string $message) + { + $flash = $this->session->get($this->sessionKey, []); + $flash['success'] = $message; + $this->session->set($this->sessionKey, $flash); + } + + public function error(string $message) + { + $flash = $this->session->get($this->sessionKey, []); + $flash['error'] = $message; + $this->session->set($this->sessionKey, $flash); + } + + public function get(string $type): ?string + { + if (is_null($this->messages)) { + $this->messages = $this->session->get($this->sessionKey, []); + $this->session->delete($this->sessionKey); + } + if (array_key_exists($type, $this->messages)) { + return $this->messages[$type]; + } + return null; + } +} diff --git a/src/Framework/Session/PHPSession.php b/src/Framework/Session/PHPSession.php new file mode 100644 index 0000000..7556d93 --- /dev/null +++ b/src/Framework/Session/PHPSession.php @@ -0,0 +1,118 @@ +ensureStarted(); + if (array_key_exists($key, $_SESSION)) { + return $_SESSION[$key]; + } + return $default; + } + + /** + * Ajoute une information en Session + * + * @param string $key + * @param $value + * @return mixed + */ + public function set(string $key, $value): void + { + $this->ensureStarted(); + $_SESSION[$key] = $value; + } + + /** + * Supprime une clef en session + * @param string $key + */ + public function delete(string $key): void + { + $this->ensureStarted(); + unset($_SESSION[$key]); + } + + /** + * Whether a offset exists + * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * @param mixed $offset

+ * An offset to check for. + *

+ * @return boolean true on success or false on failure. + *

+ *

+ * The return value will be casted to boolean if non-boolean was returned. + * @since 5.0.0 + */ + public function offsetExists($offset) + { + $this->ensureStarted(); + return array_key_exists($offset, $_SESSION); + } + + /** + * Offset to retrieve + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param mixed $offset

+ * The offset to retrieve. + *

+ * @return mixed Can return all value types. + * @since 5.0.0 + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Offset to set + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param mixed $offset

+ * The offset to assign the value to. + *

+ * @param mixed $value

+ * The value to set. + *

+ * @return void + * @since 5.0.0 + */ + public function offsetSet($offset, $value) + { + return $this->set($offset, $value); + } + + /** + * Offset to unset + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param mixed $offset

+ * The offset to unset. + *

+ * @return void + * @since 5.0.0 + */ + public function offsetUnset($offset) + { + $this->delete($offset); + } +} diff --git a/src/Framework/Session/SessionInterface.php b/src/Framework/Session/SessionInterface.php new file mode 100644 index 0000000..a0ff636 --- /dev/null +++ b/src/Framework/Session/SessionInterface.php @@ -0,0 +1,29 @@ +get('env') === 'production') { + $transport = new \Swift_SendmailTransport(); + } else { + $transport = new \Swift_SmtpTransport('localhost', 1025); + } + return new \Swift_Mailer($transport); + } +} diff --git a/src/Framework/Twig/AntenneExtension.php b/src/Framework/Twig/AntenneExtension.php new file mode 100644 index 0000000..c951f8e --- /dev/null +++ b/src/Framework/Twig/AntenneExtension.php @@ -0,0 +1,98 @@ +antenne_slug = $antenne_slug; + $this->table = $table; + $this->productTable = $productTable; + $this->regionTable = $regionTable; + $this->antenneTable = $antenneTable; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('current_antenne', [$this, 'currentAntenne']) + ]; + } + + /* public function pathFor(string $path, array $params = []): string + { + return $this->router->generateUri($path, $params); + }*/ + + + /** + * @return \PDO + */ + public function getPdo(): \PDO + { + return $this->pdo; + } + + public function currentAntenne(?\PDO $pdo = null, string $antenne_slug): int + { + //echo "antenne_slug=".$antenne_slug; + // die(); + //$params = $request->getQueryParams(); + echo "pdo"; + var_dump($pdo); + die(); + if (self::getPdo()) { + echo 'PDO true'; + die(); + } else { + echo 'PDO false'; + die(); + } + $region_id = $this->antenneTable->findBy('slug', 'paris')->id; + echo 'region_id'; + var_dump($region_id); + // $test = $this->antenneTable->findWithAntenne('paris'); + //$test2 = $this->table->findAllbyRegion(8); + $test1 = $this->productTable; + echo 'test1'; + var_dump($test1); + $test2 = $this->table; + echo 'test2'; + var_dump($test2); + die(); + $test = $this->productTable->findBy('slug', 'badge'); + echo 'test = '; + var_dump($test); + die(); + echo 'test2 = '.var_dump($test2); + die(); + //return $this->antenneTable->findBy('slug', 'paris')->id; + // return(1); + } + + +} + diff --git a/src/Framework/Twig/CsrfExtension.php b/src/Framework/Twig/CsrfExtension.php new file mode 100644 index 0000000..5974399 --- /dev/null +++ b/src/Framework/Twig/CsrfExtension.php @@ -0,0 +1,32 @@ +csrfMiddleware = $csrfMiddleware; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('csrf_input', [$this, 'csrfInput'], ['is_safe' => ['html']]) + ]; + } + + public function csrfInput() + { + return ''; + } +} diff --git a/src/Framework/Twig/FlashExtension.php b/src/Framework/Twig/FlashExtension.php new file mode 100644 index 0000000..d0cdf42 --- /dev/null +++ b/src/Framework/Twig/FlashExtension.php @@ -0,0 +1,30 @@ +flashService = $flashService; + } + + public function getFunctions(): array + { + return [ + new \Twig_SimpleFunction('flash', [$this, 'getFlash']) + ]; + } + + public function getFlash($type): ?string + { + return $this->flashService->get($type); + } +} diff --git a/src/Framework/Twig/FormExtension.php b/src/Framework/Twig/FormExtension.php new file mode 100644 index 0000000..b5a4934 --- /dev/null +++ b/src/Framework/Twig/FormExtension.php @@ -0,0 +1,167 @@ + ['html'], + 'needs_context' => true + ]) + ]; + } + + /** + * Génère le code HTML d'un champs + * @param array $context Contexte de la vue Twig + * @param string $key Clef du champs + * @param mixed $value Valeur du champs + * @param string|null $label Label à utiliser + * @param array $options + * @param array $attributes + * @return string + */ + public function field( + array $context, + string $key, + $value, + ?string $label = null, + array $options = [], + array $attributes = [] + ): string { + $type = $options['type'] ?? 'text'; + $error = $this->getErrorHtml($context, $key); + $class = 'form-group'; + $value = $this->convertValue($value); + $attributes = array_merge([ + 'class' => trim('form-control ' . ($options['class'] ?? '')), + 'name' => $key, + 'id' => $key + ], $attributes); + + if ($error) { + $class .= ' has-danger'; + $attributes['class'] .= ' form-control-danger'; + } + if ($type === 'textarea') { + $input = $this->textarea($value, $attributes); + } elseif ($type === 'file') { + $input = $this->file($attributes); + } elseif ($type === 'checkbox') { + $input = $this->checkbox($value, $attributes); + } elseif (array_key_exists('options', $options)) { + $input = $this->select($value, $options['options'], $attributes); + } else { + $attributes['type'] = $options['type'] ?? 'text'; + $input = $this->input($value, $attributes); + } + return "
+ + {$input} + {$error} +
"; + } + + private function convertValue($value): string + { + if ($value instanceof \DateTime) { + return $value->format('Y-m-d H:i:s'); + } + return (string)$value; + } + + /** + * Génère l'HTML en fonction des erreurs du contexte + * @param $context + * @param $key + * @return string + */ + private function getErrorHtml($context, $key) + { + $error = $context['errors'][$key] ?? false; + if ($error) { + return "{$error}"; + } + return ""; + } + + /** + * Génère un + * @param null|string $value + * @param array $attributes + * @return string + */ + private function input(?string $value, array $attributes): string + { + return "getHtmlFromArray($attributes) . " value=\"{$value}\">"; + } + + /** + * Génère un + * @param null|string $value + * @param array $attributes + * @return string + */ + private function checkbox(?string $value, array $attributes): string + { + $html = ''; + if ($value) { + $attributes['checked'] = true; + } + return $html . "getHtmlFromArray($attributes) . " value=\"1\">"; + } + + private function file($attributes) + { + return "getHtmlFromArray($attributes) . ">"; + } + + /** + * Génère un "; + } + + /** + * Génère un getHtmlFromArray($attributes) . ">$htmlOptions"; + } + + /** + * Transforme un tableau $clef => $valeur en attribut HTML + * @param array $attributes + * @return string + */ + private function getHtmlFromArray(array $attributes) + { + $htmlParts = []; + foreach ($attributes as $key => $value) { + if ($value === true) { + $htmlParts[] = (string)$key; + } elseif ($value !== false) { + $htmlParts[] = "$key=\"$value\""; + } + } + return implode(' ', $htmlParts); + } +} diff --git a/src/Framework/Twig/FormExtension_old.php b/src/Framework/Twig/FormExtension_old.php new file mode 100644 index 0000000..9b0f5f1 --- /dev/null +++ b/src/Framework/Twig/FormExtension_old.php @@ -0,0 +1,160 @@ + ['html'], + 'needs_context' => true + ]) + ]; + } + + /** + * Génère le code HTML d'un champs + * @param array $context Contexte de la vue Twig + * @param string $key Clef du champs + * @param mixed $value Valeur du champs + * @param string|null $label Label à utiliser + * @param array $options + * @return string + */ + public function field(array $context, string $key, $value, ?string $label = null, array $options = []): string + { + $type = $options['type'] ?? 'text'; + $error = $this->getErrorHtml($context, $key); + $class = 'form-group'; + $value = $this->convertValue($value); + $attributes = [ + 'class' => trim('form-control ' . ($options['class'] ?? '')), + 'name' => $key, + 'id' => $key + ]; + + if ($error) { + $class .= ' has-danger'; + $attributes['class'] .= ' form-control-danger'; + } + if ($type === 'textarea') { + $input = $this->textarea($value, $attributes); + } elseif ($type === 'file') { + $input = $this->file($attributes); + } elseif ($type === 'checkbox') { + $input = $this->checkbox($value, $attributes); + } elseif (array_key_exists('options', $options)) { + $input = $this->select($value, $options['options'], $attributes); + } else { + $attributes['type'] = $options['type'] ?? 'text'; + $input = $this->input($value, $attributes); + } + return "
+ + {$input} + {$error} +
"; + } + + private function convertValue($value): string + { + if ($value instanceof \DateTime) { + return $value->format('Y-m-d H:i:s'); + } + return (string)$value; + } + + /** + * Génère l'HTML en fonction des erreurs du contexte + * @param $context + * @param $key + * @return string + */ + private function getErrorHtml($context, $key) + { + $error = $context['errors'][$key] ?? false; + if ($error) { + return "{$error}"; + } + return ""; + } + + /** + * Génère un + * @param null|string $value + * @param array $attributes + * @return string + */ + private function input(?string $value, array $attributes): string + { + return "getHtmlFromArray($attributes) . " value=\"{$value}\">"; + } + + /** + * Génère un + * @param null|string $value + * @param array $attributes + * @return string + */ + private function checkbox(?string $value, array $attributes): string + { + $html = ''; + if ($value) { + $attributes['checked'] = true; + } + return $html . "getHtmlFromArray($attributes) . " value=\"1\">"; + } + + private function file($attributes) + { + return "getHtmlFromArray($attributes) . ">"; + } + + /** + * Génère un "; + } + + /** + * Génère un getHtmlFromArray($attributes) . ">$htmlOptions"; + } + + /** + * Transforme un tableau $clef => $valeur en attribut HTML + * @param array $attributes + * @return string + */ + private function getHtmlFromArray(array $attributes) + { + $htmlParts = []; + foreach ($attributes as $key => $value) { + if ($value === true) { + $htmlParts[] = (string) $key; + } elseif ($value !== false) { + $htmlParts[] = "$key=\"$value\""; + } + } + return implode(' ', $htmlParts); + } +} diff --git a/src/Framework/Twig/PagerFantaExtension.php b/src/Framework/Twig/PagerFantaExtension.php new file mode 100644 index 0000000..d4c1518 --- /dev/null +++ b/src/Framework/Twig/PagerFantaExtension.php @@ -0,0 +1,51 @@ +router = $router; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('paginate', [$this, 'paginate'], ['is_safe' => ['html']]) + ]; + } + + /** + * Génère la pagination + * @param Pagerfanta $paginatedResults + * @param string $route + * @param array $routerParams + * @param array $queryArgs + * @return string + */ + public function paginate( + Pagerfanta $paginatedResults, + string $route, + array $routerParams = [], + array $queryArgs = [] + ): string { + + $view = new TwitterBootstrap4View(); + return $view->render($paginatedResults, function (int $page) use ($route, $routerParams, $queryArgs) { + if ($page > 1) { + $queryArgs['p'] = $page; + } + return $this->router->generateUri($route, $routerParams, $queryArgs); + }); + } +} diff --git a/src/Framework/Twig/TextExtension.php b/src/Framework/Twig/TextExtension.php new file mode 100644 index 0000000..8ebb23c --- /dev/null +++ b/src/Framework/Twig/TextExtension.php @@ -0,0 +1,38 @@ + $maxLength) { + $excerpt = mb_substr($content, 0, $maxLength); + $lastSpace = mb_strrpos($excerpt, ' '); + return mb_substr($excerpt, 0, $lastSpace) . '...'; + } + return $content; + } +} diff --git a/src/Framework/Twig/TimeExtension.php b/src/Framework/Twig/TimeExtension.php new file mode 100644 index 0000000..065c108 --- /dev/null +++ b/src/Framework/Twig/TimeExtension.php @@ -0,0 +1,23 @@ + ['html']]) + ]; + } + + public function ago(\DateTime $date, string $format = 'd/m/Y H:i') + { + return '' . + $date->format($format) . + ''; + } +} diff --git a/src/Framework/Twig/UrlExtension.php b/src/Framework/Twig/UrlExtension.php new file mode 100644 index 0000000..e4d1d0a --- /dev/null +++ b/src/Framework/Twig/UrlExtension.php @@ -0,0 +1,36 @@ +url = $url; + } + + public function getFunctions() + { + return [ + //new \Twig_SimpleFunction('url', [$this, 'getUrl']), + new \Twig_SimpleFunction('explodeUrl', [$this, 'explodeUrl']) + ]; + } + + /* public function getUrl(): string + { + return $_SERVER['REQUEST_URI'] ?? '/'; + }*/ + public function explodeUrl(): array + { + $url = $_SERVER['REQUEST_URI'] ?? '/'; + $url_parts = explode('/', $url); + return $url_parts; + } +} diff --git a/src/Framework/Upload.php b/src/Framework/Upload.php new file mode 100644 index 0000000..caeab2a --- /dev/null +++ b/src/Framework/Upload.php @@ -0,0 +1,98 @@ +path = $path; + } + } + + /** + * @param UploadedFileInterface $file + * @param null|string $oldFile + * @return null|string + */ + public function upload(UploadedFileInterface $file, ?string $oldFile = null): ?string + { + //echo "getError = "; + //var_dump($file->getError()); + + if ($file->getError() === UPLOAD_ERR_OK) { + // echo 'Erreur !'; + // echo "oldFile = ".$oldFile; + // die(); + $this->delete($oldFile); + //$targetPath = $this->addCopySuffix($this->path . DIRECTORY_SEPARATOR . $file->getClientFilename()); + $targetPath = $this->path . DIRECTORY_SEPARATOR . $file->getClientFilename(); + $dirname = pathinfo($targetPath, PATHINFO_DIRNAME); + if (!file_exists($dirname)) { + mkdir($dirname, 777, true); + } + $file->moveTo($targetPath); + $this->generateFormats($targetPath); + return pathinfo($targetPath)['basename']; + } + return null; + } + + private function addCopySuffix(string $targetPath): string + { + if (file_exists($targetPath)) { + return $this->addCopySuffix($this->getPathWithSuffix($targetPath, 'copy')); + } + return $targetPath; + } + + public function delete(?string $oldFile): void + { + if ($oldFile) { + $oldFile = $this->path . DIRECTORY_SEPARATOR . $oldFile; + if (file_exists($oldFile)) { + unlink($oldFile); + } + foreach ($this->formats as $format => $_) { + $oldFileWithFormat = $this->getPathWithSuffix($oldFile, $format); + if (file_exists($oldFileWithFormat)) { + unlink($oldFileWithFormat); + } + } + } + } + + private function getPathWithSuffix(string $path, string $suffix): string + { + $info = pathinfo($path); + return $info['dirname'] . DIRECTORY_SEPARATOR . + $info['filename'] . '_' . $suffix .'.' . $info['extension']; + } + + private function generateFormats($targetPath) + { + foreach ($this->formats as $format => $size) { + $manager = new ImageManager(['driver' => 'imagick']); + + $destination = $this->getPathWithSuffix($targetPath, $format); + //echo "destination"; + //var_dump($destination); + //echo "


"; + [$width , $height] = $size; + //echo 'size ='; + //var_dump($size); + //echo "


"; + //echo "targetPath ="; + //var_dump($targetPath); + $manager->make($targetPath)->fit($width, $height)->save($destination); + } + } +} diff --git a/src/Framework/Validator.php b/src/Framework/Validator.php new file mode 100644 index 0000000..157ad58 --- /dev/null +++ b/src/Framework/Validator.php @@ -0,0 +1,271 @@ + 'image/jpeg', + 'png' => 'image/png', + 'pdf' => 'application/pdf' + ]; + + /** + * @var array + */ + private $params; + + /** + * @var string[] + */ + private $errors = []; + + public function __construct(array $params) + { + $this->params = $params; + } + + /** + * Vérifie que les champs soient présents dans le tableau + * + * @param string[] ...$keys + * @return Validator + */ + public function required(string ...$keys): self + { + foreach ($keys as $key) { + $value = $this->getValue($key); + if (is_null($value)) { + $this->addError($key, 'required'); + } + } + return $this; + } + + /** + * Vérifie que le champ n'est pas vide + * + * @param string[] ...$keys + * @return Validator + */ + public function notEmpty(string ...$keys): self + { + foreach ($keys as $key) { + $value = $this->getValue($key); + if (is_null($value) || empty($value)) { + $this->addError($key, 'empty'); + } + } + return $this; + } + + public function length(string $key, ?int $min, ?int $max = null): self + { + $value = $this->getValue($key); + $length = mb_strlen($value); + if (!is_null($min) && + !is_null($max) && + ($length < $min || $length > $max) + ) { + $this->addError($key, 'betweenLength', [$min, $max]); + return $this; + } + if (!is_null($min) && + $length < $min + ) { + $this->addError($key, 'minLength', [$min]); + return $this; + } + if (!is_null($max) && + $length > $max + ) { + $this->addError($key, 'maxLength', [$max]); + } + return $this; + } + + /** + * Vérifie que l'élément est un slug + * + * @param string $key + * @return Validator + */ + public function slug(string $key): self + { + $value = $this->getValue($key); + $pattern = '/^[a-z0-9]+(-[a-z0-9]+)*$/'; + if (!is_null($value) && !preg_match($pattern, $value)) { + $this->addError($key, 'slug'); + } + return $this; + } + + /** + * Vérifie qu'une date correspond au format demandé + * + * @param string $key + * @param string $format + * @return Validator + */ + public function dateTime(string $key, string $format = "Y-m-d H:i:s"): self + { + $value = $this->getValue($key); + $date = \DateTime::createFromFormat($format, $value); + $errors = \DateTime::getLastErrors(); + if ($errors['error_count'] > 0 || $errors['warning_count'] > 0 || $date === false) { + $this->addError($key, 'datetime', [$format]); + } + return $this; + } + + /** + * Vérifie que la clef existe dans la table donnée + * + * @param string $key + * @param string $table + * @param \PDO $pdo + * @return Validator + */ + public function exists(string $key, string $table, \PDO $pdo): self + { + $value = $this->getValue($key); + $statement = $pdo->prepare("SELECT id FROM $table WHERE id = ?"); + $statement->execute([$value]); + if ($statement->fetchColumn() === false) { + $this->addError($key, 'exists', [$table]); + } + return $this; + } + + /** + * Vérifie que la clef est unique dans la base de données + * + * @param string $key + * @param string|Table $table + * @param \PDO $pdo + * @param int|null $exclude + * @return Validator + */ + public function unique(string $key, $table, ?\PDO $pdo = null, ?int $exclude = null): self + { + if ($table instanceof Table) { + $pdo = $table->getPdo(); + $table = $table->getTable(); + } + $value = $this->getValue($key); + $query = "SELECT id FROM $table WHERE $key = ?"; + $params = [$value]; + if ($exclude !== null) { + $query .= " AND id != ?"; + $params[] = $exclude; + } + $statement = $pdo->prepare($query); + $statement->execute($params); + if ($statement->fetchColumn() !== false) { + $this->addError($key, 'unique', [$value]); + } + return $this; + } + + /** + * Vérifie si le fichier a bien été uploadé + * @param string $key + * @return Validator + */ + public function uploaded(string $key): self + { + $file = $this->getValue($key); + if ($file === null || $file->getError() !== UPLOAD_ERR_OK) { + $this->addError($key, 'uploaded'); + } + return $this; + } + + /** + * Vérifie si l'email est valide + * @param string $key + * @return Validator + */ + public function email(string $key): self + { + $value = $this->getValue($key); + if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) { + $this->addError($key, 'email'); + } + return $this; + } + + public function confirm(string $key): self + { + $value = $this->getValue($key); + $valueConfirm = $this->getValue($key . '_confirm'); + if ($valueConfirm !== $value) { + $this->addError($key, 'confirm'); + } + return $this; + } + + /** + * Vérifie le format de fichier + * @param string $key + * @param array $extensions + * @return Validator + */ + public function extension(string $key, array $extensions): self + { + /** @var UploadedFileInterface $file */ + $file = $this->getValue($key); + if ($file !== null && $file->getError() === UPLOAD_ERR_OK) { + $type = $file->getClientMediaType(); + $extension = mb_strtolower(pathinfo($file->getClientFilename(), PATHINFO_EXTENSION)); + $expectedType = self::MIME_TYPES[$extension] ?? null; + if (!in_array($extension, $extensions) || $expectedType !== $type) { + $this->addError($key, 'filetype', [join(',', $extensions)]); + } + } + + return $this; + } + + /** + * @return bool + */ + public function isValid(): bool + { + return empty($this->errors); + } + + /** + * Récupère les erreurs + * @return ValidationError[] + */ + public function getErrors(): array + { + return $this->errors; + } + + /** + * Ajoute une erreur + * + * @param string $key + * @param string $rule + * @param array $attributes + */ + private function addError(string $key, string $rule, array $attributes = []): void + { + $this->errors[$key] = new ValidationError($key, $rule, $attributes); + } + + private function getValue(string $key) + { + if (array_key_exists($key, $this->params)) { + return $this->params[$key]; + } + return null; + } +} diff --git a/src/Framework/Validator/ValidationError.php b/src/Framework/Validator/ValidationError.php new file mode 100644 index 0000000..88ffd15 --- /dev/null +++ b/src/Framework/Validator/ValidationError.php @@ -0,0 +1,46 @@ + 'Le champ %s est requis', + 'empty' => 'Le champ %s ne peut être vide', + 'slug' => 'Le champ %s n\'est pas un slug valide', + 'minLength' => 'Le champ %s doit contenir au moins %d caractères', + 'maxLength' => 'Le champ %s doit contenir moins de %d caractères', + 'betweenLength' => 'Le champ %s doit contenir entre %d et %d caractères', + 'datetime' => 'Le champ %s doit être une date valide (%s)', + 'exists' => 'Le champ %s n\'existe pas sur dans la table %s', + 'unique' => 'Le champ %s doit être unique', + 'filetype' => 'Le champ %s n\'est pas au format valide (%s)', + 'uploaded' => 'Vous devez uploader un fichier', + 'email' => 'Cet email ne semble pas valide', + 'confirm' => 'Vous n\'avez pas confirmé le champ %s' + ]; + /** + * @var array + */ + private $attributes; + + public function __construct(string $key, string $rule, array $attributes = []) + { + $this->key = $key; + $this->rule = $rule; + $this->attributes = $attributes; + } + + public function __toString() + { + if (!array_key_exists($this->rule, $this->messages)) { + return "Le champs {$this->key} ne correspond pas à la règle {$this->rule}"; + } else { + $params = array_merge([$this->messages[$this->rule], $this->key], $this->attributes); + return (string)call_user_func_array('sprintf', $params); + } + } +} diff --git a/src/Gmarche/Actions/AntenneShowAction.php b/src/Gmarche/Actions/AntenneShowAction.php new file mode 100644 index 0000000..4c438d2 --- /dev/null +++ b/src/Gmarche/Actions/AntenneShowAction.php @@ -0,0 +1,67 @@ +renderer = $renderer; + $this->regionTable = $regionTable; + $this->antenneTable = $antenneTable; + } + + public function __invoke(Request $request) + { + $params = $request->getQueryParams(); + // On récupère l'id de la région cliquée + $region_id = $this->regionTable->findBy('slug', $request->getAttribute('slug'))->id; + $slug = $request->getAttribute('slug'); + $page = $params['p'] ?? 1; // Si la page n'est pas définie, on l'initialise à 1 + $antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(10, $page); + //echo "Antennes1="; + //var_dump($this->antenneTable->findAllbyRegion($region_id)); + //echo "


Antennes="; + //var_dump($antennes); + //die(); + $region=$this->regionTable->findBy('slug', $request->getAttribute('slug')); + $antenne = 1; + /*if ($region->slug !== $slug) { + return $this->redirect('gmarche.show', [ + 'slug' => $region->slug, + 'id' => $region->id + ]); + }*/ + return $this->renderer->render('@gmarche/antenne', compact('slug', 'region', 'antennes','antenne', 'page')); + } +} diff --git a/src/Gmarche/Actions/RegionIndexAction.php b/src/Gmarche/Actions/RegionIndexAction.php new file mode 100644 index 0000000..420ddf5 --- /dev/null +++ b/src/Gmarche/Actions/RegionIndexAction.php @@ -0,0 +1,39 @@ +renderer = $renderer; + $this->regionTable = $regionTable; + } + + public function __invoke(Request $request) + { + $params = $request->getQueryParams(); + $regions = $this->regionTable->findAll()->paginate(15, $params['p'] ?? 1); + + return $this->renderer->render('@gmarche/index', compact('regions')); + } +} diff --git a/src/Gmarche/Entity/Antenne.php b/src/Gmarche/Entity/Antenne.php new file mode 100644 index 0000000..c6a1bbc --- /dev/null +++ b/src/Gmarche/Entity/Antenne.php @@ -0,0 +1,37 @@ +createdAt = new \DateTime($datetime); + } + } + + public function setUpdatedAt($datetime) + { + if (is_string($datetime)) { + //$this->updatedAt = new \DateTime($datetime); + } + } +} diff --git a/src/Gmarche/Entity/Region.php b/src/Gmarche/Entity/Region.php new file mode 100644 index 0000000..53a504c --- /dev/null +++ b/src/Gmarche/Entity/Region.php @@ -0,0 +1,28 @@ + $filename, 'extension' => $extension] = pathinfo($this->image); + return '/uploads/regions/' . $filename . '_thumb.' . $extension; + } + + public function getImageUrl() + { + return '/uploads/regions/' . $this->image; + } +} diff --git a/src/Gmarche/GmarcheModule.php b/src/Gmarche/GmarcheModule.php new file mode 100644 index 0000000..ff2f670 --- /dev/null +++ b/src/Gmarche/GmarcheModule.php @@ -0,0 +1,30 @@ +get('gmarche.prefix'); + $container->get(RendererInterface::class)->addPath('gmarche', __DIR__ . '/views'); + $router = $container->get(Router::class); + $router->get( $gmarchePrefix, RegionIndexAction::class, 'gmarche.index'); + $router->get("$gmarchePrefix/{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne'); + } +} diff --git a/src/Gmarche/RegionUpload.php b/src/Gmarche/RegionUpload.php new file mode 100644 index 0000000..8913c70 --- /dev/null +++ b/src/Gmarche/RegionUpload.php @@ -0,0 +1,14 @@ + [320, 180] + ]; +} diff --git a/src/Gmarche/Table/AntenneTable.php b/src/Gmarche/Table/AntenneTable.php new file mode 100644 index 0000000..dceb4f8 --- /dev/null +++ b/src/Gmarche/Table/AntenneTable.php @@ -0,0 +1,43 @@ +pdo); + return $this->makeQuery() + ->join($region->getTable() . ' as r', 'a.region_id = r.id') + ->select('a.*') + ->where("a.region_id = $region_id") + ->order('a.name ASC'); + } + /* public function getAntenne(string $antenne_slug): Query + { + //$antenne = new AntenneTable($this->pdo); + return $this->makeQuery() + ->select('a.*') + ->where("a.slug = $antenne_slug") + ->order('a.name ASC'); + } + public function findPublic(): Query + { + return $this->findAll(); + } + + + public function findWithAntenne(int $antenne_slug): Antenne + { + return $this->findPublic()->where("a.slug = $antenne_slug")->fetch(); + }*/ +} diff --git a/src/Gmarche/Table/RegionTable.php b/src/Gmarche/Table/RegionTable.php new file mode 100644 index 0000000..d9f774c --- /dev/null +++ b/src/Gmarche/Table/RegionTable.php @@ -0,0 +1,21 @@ +makeQuery() + ->select('r.*') + ->order('r.name ASC'); + } +} diff --git a/src/Gmarche/config.php b/src/Gmarche/config.php new file mode 100644 index 0000000..8d1d0a3 --- /dev/null +++ b/src/Gmarche/config.php @@ -0,0 +1,9 @@ + '/gmarche' +]; diff --git a/src/Gmarche/db/migrations/20190814181851_create_regions_table.php b/src/Gmarche/db/migrations/20190814181851_create_regions_table.php new file mode 100644 index 0000000..f2db0af --- /dev/null +++ b/src/Gmarche/db/migrations/20190814181851_create_regions_table.php @@ -0,0 +1,37 @@ +table('regions') + ->addColumn('name', 'string',['limit' => 40]) + ->addColumn('slug', 'string',['limit' => 40]) + ->addColumn('code_iso','string',['limit' => 6]) + ->addColumn('image', 'string', ['null' => true, 'limit' => 120]) + ->create(); + } +} diff --git a/src/Gmarche/db/migrations/20190815221851_create_antennes_table.php b/src/Gmarche/db/migrations/20190815221851_create_antennes_table.php new file mode 100644 index 0000000..d8ee932 --- /dev/null +++ b/src/Gmarche/db/migrations/20190815221851_create_antennes_table.php @@ -0,0 +1,42 @@ +table('antennes') + ->addColumn('name', 'string',['limit' => 60]) + ->addColumn('slug', 'string') + ->addColumn('admin', 'string', ['limit' => 150]) + ->addColumn('content', 'string', ['limit' => 255]) + ->addColumn('image','string',['limit' => 150 ]) + ->addColumn('created_at', 'datetime') + ->addColumn('region_id', 'integer', ['null' => true]) + ->addForeignKey('region_id', 'regions', 'id', [ + 'delete' => 'SET NULL']) + ->create(); + } +} diff --git a/src/Gmarche/db/migrations/20190824020208_create_products_table.php b/src/Gmarche/db/migrations/20190824020208_create_products_table.php new file mode 100644 index 0000000..28995d4 --- /dev/null +++ b/src/Gmarche/db/migrations/20190824020208_create_products_table.php @@ -0,0 +1,27 @@ +table('products') + ->addColumn('name', 'string',['limit' => 60]) + ->addColumn('slug', 'string') + ->addColumn('quantite', 'integer') + ->addColumn('prix', 'float') + ->addColumn('content', 'text', ['limit' => 3000]) + ->addColumn('image','string',['limit' => 255 ]) + ->addColumn('created_at', 'datetime', ['null' => true]) + ->addColumn('updated_at', 'datetime', ['null' => true]) + ->addColumn('sold_at', 'datetime', ['null' => true]) + ->addColumn('acheteur_id', 'integer', ['null' => true]) + ->addColumn('user_id', 'integer') + ->addForeignKey('user_id', 'users', 'id') + ->addColumn('antenne_id', 'integer') + ->addForeignKey('antenne_id', 'antennes', 'id') + ->create(); + } +} diff --git a/src/Gmarche/db/seeds/20190816225744_create_users_table.php b/src/Gmarche/db/seeds/20190816225744_create_users_table.php new file mode 100644 index 0000000..320fe05 --- /dev/null +++ b/src/Gmarche/db/seeds/20190816225744_create_users_table.php @@ -0,0 +1,44 @@ +table('users') + ->addColumn('username','string', ['limit' => 30]) + ->addColumn('email','string', ['limit' => 130]) + ->addColumn('password' ,'string', ['limit' => 64]) + ->addColumn('firstname' ,'string', ['limit' => 50]) + ->addColumn('lastname' ,'string', ['limit' => 50]) + ->addColumn('created_at','datetime') + ->addColumn('role', 'string') + ->addColumn('password_reset', 'string', ['null' => true]) + ->addColumn('password_reset_at', 'datetime', ['null' => true]) + ->addIndex(['email', 'username'], ['unique' => true]) + ->create(); + } +} + diff --git a/src/Gmarche/db/seeds/ProduitSeeder.php b/src/Gmarche/db/seeds/ProduitSeeder.php new file mode 100644 index 0000000..e3ac579 --- /dev/null +++ b/src/Gmarche/db/seeds/ProduitSeeder.php @@ -0,0 +1,340 @@ + $faker->userName, + 'password' => $faker->password, + 'nom' => $faker->lastName, + 'prenom' => $faker->firstName, + 'created_at' => date('Y-m-d H:i:s', $date), + 'role' => rand(1,2) + ]; + } + $this->table('users')->insert($data)->save(); + + // Seeding des produits + $data = []; + $faker = Factory::create('fr_FR'); + for ($i = 0; $i < 10; ++$i) { + $date = $faker->unixTime('now'); + $data[] = [ + 'name' => $faker->text(60), + 'slug' => $faker->slug, + 'cle_pub' => $faker->text(32), + 'nb_unites' => rand(1,12), + 'prix' => $faker->randomFloat($nbMaxDecimals = 2, $min = 0, $max = 200), + 'content' => $faker->text(100), + 'image' => $faker->imageUrl(200, 100, 'cats', true, 'Faker', true), + 'updated_at' => date('Y-m-d H:i:s', $date), + 'created_at' => date('Y-m-d H:i:s', $date), + 'user_id' => rand(1,7) + ]; + } + $this->table('produits') + ->insert($data) + ->save(); + + // Seeding des régions + $data[] = [ + 'name' => 'Auvergne-Rhône-Alpes', + 'slug' => 'auvergne-rhone-alpes', + 'code_iso' => 'FR-ARA', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Bourgogne-Franche-Comté', + 'slug' => 'bourgogne-franche-comte', + 'code_iso' => 'FR-BFC', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Bretagne', + 'slug' => 'bretagne', + 'code_iso' => 'FR-BRE', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Centre-Val de Loire', + 'slug' => 'centre-val-de-loire', + 'code_iso' => 'FR-CVL', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Corse', + 'slug' => 'corse', + 'code_iso' => 'FR-COR', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Grand Est', + 'slug' => 'grand-est', + 'code_iso' => 'FR-GES', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Hauts-de-France', + 'slug' => 'hauts-de-france', + 'code_iso' => 'FR-HDF', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Ile-de-France', + 'slug' => 'ile-de-france', + 'code_iso' => 'FR-IDF', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Normandie', + 'slug' => 'normandie', + 'code_iso' => 'FR-NOR', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Nouvelle-Aquitaine', + 'slug' => 'nouvelle-aquitaine', + 'code_iso' => 'FR-NAQ', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Occitanie', + 'slug' => 'occitanie', + 'code_iso' => 'FR-OCC', + 'image' => 'null' + ]; + $data[] = [ + 'name' => 'Pays de la Loire', + 'slug' => 'pays-de-la-loire', + 'code_iso' => 'FR-PDL', + 'image' => 'null' + ]; + $data[] = [ + 'name' => "Provence-Alpes-Côte d'Azur", + 'slug' => 'provence-alpes-cote-d-azur', + 'code_iso' => 'FR-PAC', + 'image' => 'null' + ]; + $this->table('regions')->insert($data)->save(); +*/ + + // Seeding des antennes + $faker = Factory::create('fr_FR'); + $date = $faker->unixTime('now'); + $data[] = [ + 'name' => 'Paris', + 'slug' => 'paris', + 'admin' => 'Attilax', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Montreuil', + 'slug' => 'montreuil', + 'admin' => 'Attilax', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Clamart', + 'slug' => 'clamart', + 'admin' => 'nox', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Malakoff', + 'slug' => 'malakoff', + 'admin' => 'yyy', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Pantin', + 'slug' => 'pantin', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Antony', + 'slug' => 'antony', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Chelles', + 'slug' => 'chelles', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Châtillon', + 'slug' => 'chatillon', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Créteil', + 'slug' => 'creteil', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Nemours', + 'slug' => 'nemours', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Meaux', + 'slug' => 'meaux', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Melun', + 'slug' => 'melun', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Versailles', + 'slug' => 'versailles', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Rambouillet', + 'slug' => 'rambouillet', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Gagny', + 'slug' => 'gagny', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => "L'isle-Adam", + 'slug' => 'l-isle-adam', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Palaiseau', + 'slug' => 'palaiseau', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Fontainebleau', + 'slug' => 'fontainebleau', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Torcy', + 'slug' => 'torcy', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Beauvais', + 'slug' => 'beauvais', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Creil', + 'slug' => 'creil', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $data[] = [ + 'name' => 'Massy', + 'slug' => 'massy', + 'admin' => 'null', + 'content' => 'null', + 'image' => 'null', + 'created_at' => date('Y-m-d H:i:s', $date), + 'region_id' => '8' + ]; + $this->table('antennes')->insert($data)->save(); + } +} diff --git a/src/Gmarche/views/antenne.twig b/src/Gmarche/views/antenne.twig new file mode 100644 index 0000000..a39ec5e --- /dev/null +++ b/src/Gmarche/views/antenne.twig @@ -0,0 +1,37 @@ +{% extends 'layout.twig' %} + +{% block title %} + Ğ1-Marché - {{ region.name }} {% if page > 1 %} - Page {{ page }}{% endif %} +{% endblock %} +{% block body %} +
+ +
+ {% if region.name == 'Ile-de-France' %} + + {% endif %} + + +
+
+
+
Antennes {{ region.name }} :
+
+
+ +
+ {% if antennes %} + {{ paginate(antennes, 'gmarche.antenne', {slug: slug}) }} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/src/Gmarche/views/index.twig b/src/Gmarche/views/index.twig new file mode 100644 index 0000000..7da33c4 --- /dev/null +++ b/src/Gmarche/views/index.twig @@ -0,0 +1,22 @@ +{% extends 'layout.twig' %} + +{% block title %} + Ğ1-Marché : Régions {% if page > 1 %}, page {{ page }} {% endif %} +{% endblock %} +{% block body %} +
+ +
+ +
+
+ +{% endblock %} diff --git a/src/Product/Actions/ProductCrudAction.php b/src/Product/Actions/ProductCrudAction.php new file mode 100644 index 0000000..e4a6870 --- /dev/null +++ b/src/Product/Actions/ProductCrudAction.php @@ -0,0 +1,133 @@ +userTable = $userTable; + $this->productUpload = $productUpload; + $this->session = $session; + } + + public function delete(ServerRequestInterface $request) + { + $product = $this->table->find($request->getAttribute('id')); + $this->productUpload->delete($product->image); + return parent::delete($request); + } + + protected function formParams(array $params): array + { + //$params['categories'] = $this->userTable->findList(); + $params['users'] = $this->userTable->findList(); + //$params['categories']['1231232'] = 'User fake'; + $params['users']['1231232'] = 'User fake'; + return $params; + } + + protected function getNewEntity() + { + /*$product = new Product(); + $product->created_at = new \DateTime(); + return $product;*/ + $entity = parent::getNewEntity(); + $entity->setCreatedAt(new \DateTime()); + //$entity->setAntenneId(''); + return $entity; + } + + /** + * @param ServerRequestInterface $request + * @param Product $product + * @return array + */ + protected function prePersist(ServerRequestInterface $request, $product): array + { + $params = array_merge($request->getParsedBody(), $request->getUploadedFiles()); + // Uploader le fichier + $image = $this->productUpload->upload($params['image'], $product->image); + if ($image) { + $params['image'] = $image; + } else { + unset($params['image']); + } + $date_actu = date('d-m-Y'); + if ($request->getAttribute('id')) { // Lors d'une modif + $ajout_params = []; + } else { // Lors d'une création + // $params = $request->getQueryParams(); + $str_created_at = $date_actu; + $ajout_params = ['created_at' => date('Y-m-d H:i:s'), + 'str_created_at' => $str_created_at]; + } + $str_updated_at = $date_actu; + + $userId = $this->session->get('auth.user'); + + $params = array_filter($params, function ($key) { + return in_array($key, ['name', 'quantite', 'prix', 'slug', 'content', 'created_at', 'image','antenne_id']); + }, ARRAY_FILTER_USE_KEY); + return array_merge($params, $ajout_params,['user_id' => $userId, + // 'updated_at' => date('Y-m-d H:i:s'), + 'str_updated_at' =>$str_updated_at ]); + } + + protected function getValidator(ServerRequestInterface $request) + { + $validator = parent::getValidator($request) + ->required('content', 'name', 'slug', 'quantite', 'prix') + // ->length('content', 10) + ->length('name', 2, 80) + ->length('slug', 2, 50); + //->exists('user_id', $this->userTable->getTable(), $this->userTable->getPdo()) + //->dateTime('created_at') + //->extension('image', ['jpg', 'png']) + //->slug('slug') + + if (is_null($request->getAttribute('id'))) { + $validator->uploaded('image'); + } + return $validator; + } +} diff --git a/src/Product/Actions/ProductIndexAction.php b/src/Product/Actions/ProductIndexAction.php new file mode 100644 index 0000000..a57a376 --- /dev/null +++ b/src/Product/Actions/ProductIndexAction.php @@ -0,0 +1,59 @@ +renderer = $renderer; + $this->productTable = $productTable; + $this->antenneTable = $antenneTable; + + } + /*public function findAllUsers(): Query + { + return $this->userTable->makeQuery() + ->select('*') + ->where('id=1') + ->order('username ASC'); + }*/ + public function __invoke(Request $request) + { + $params = $request->getQueryParams(); + $antenne_slug =$request->getAttribute('slug'); + // $region =$request->getAttribute('region'); + $requete = $this->antenneTable->findBy('slug', $antenne_slug); + $antenne_name = $requete->name; + $antenne_id = $requete->id; + + $page = $params['p'] ?? 1; + //$routePrefix = 'product.admin'; + $routePrefix = 'product.admin'; + $viewPath = '@product/admin/products'; + $items = $this->productTable->findByAntenneId('antenne_id', $antenne_id)->paginate(20, $page); + + return $this->renderer->render($viewPath.'/index', compact('antenne_id','antenne_slug','antenne_name','routePrefix','viewPath', 'items' )); + } +} diff --git a/src/Product/Entity/Product.php b/src/Product/Entity/Product.php new file mode 100644 index 0000000..2aacc27 --- /dev/null +++ b/src/Product/Entity/Product.php @@ -0,0 +1,110 @@ +userId; + } + + /** + * @param mixed $userId + */ + public function setUserId(int $userId) + { + $this->userId = $userId; + } + + + public function getAntenneId(): ?int + { + return $this->antenneId; + } + + public function setAntenneId(int $antenneId): void + { + $this->antenneId = $antenneId; + } + + /** + * @return \DateTime|null + */ + public function getCreatedAt(): ?\DateTime + { + return $this->createdAt; + } + + public function setCreatedAt($datetime) + { + if (is_string($datetime)) { + $this->createdAt = new \DateTime($datetime); + } else { + $this->createdAt = $datetime; + } + } + + public function setUpdatedAt($datetime) + { + if (is_string($datetime)) { + $this->updatedAt = new \DateTime($datetime); + } else { + $this->updatedAt = $datetime; + } + } + + public function setSoldAt($datetime) + { + if (is_string($datetime)) { + $this->soldAt = new \DateTime($datetime); + } else { + $this->soldAt = $datetime; + } + } + + public function getThumb() + { + ['filename' => $filename, 'extension' => $extension] = pathinfo($this->image); + return '/uploads/products/' . $filename . '_thumb.' . $extension; + } + + public function getImageUrl() + { + return '/uploads/products/' . $this->image; + } +} diff --git a/src/Product/ProductModule.php b/src/Product/ProductModule.php new file mode 100644 index 0000000..a0627cd --- /dev/null +++ b/src/Product/ProductModule.php @@ -0,0 +1,36 @@ +get('product.prefix'); + $gmarchePrefix = $container->get('gmarche.prefix'); + + $container->get(RendererInterface::class)->addPath('product', __DIR__ . '/views'); + $router = $container->get(Router::class); + + $router->get("/gmarche/{region:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}/{antenne:[0-9]{1,}}", ProductIndexAction::class, 'product.index'); + + $router->crud("/gmarche/{region:[a-z\-]+}/{slug:[a-z\-0-9]+}/{antenne:[0-9]{1,}}",[LoggedInMiddleware::class, ProductCrudAction::class],'product.admin'); + + } +} diff --git a/src/Product/ProductUpload.php b/src/Product/ProductUpload.php new file mode 100644 index 0000000..2200b7f --- /dev/null +++ b/src/Product/ProductUpload.php @@ -0,0 +1,14 @@ + [320, 180] + ]; +} \ No newline at end of file diff --git a/src/Product/ProductWidget.php b/src/Product/ProductWidget.php new file mode 100644 index 0000000..3da7708 --- /dev/null +++ b/src/Product/ProductWidget.php @@ -0,0 +1,38 @@ +renderer = $renderer; + $this->productTable = $productTable; + } + + public function render(): string + { + $count = $this->productTable->count(); + return $this->renderer->render('@product/widget', compact('count')); + } + + public function renderMenu(): string + { + return $this->renderer->render('@product/admin/menu'); + } +} + diff --git a/src/Product/Table/ProductTable.php b/src/Product/Table/ProductTable.php new file mode 100644 index 0000000..b7093d4 --- /dev/null +++ b/src/Product/Table/ProductTable.php @@ -0,0 +1,65 @@ +pdo); + $antenne = new AntenneTable($this->pdo); + $region = new RegionTable($this->pdo); + return $this->makeQuery() + ->join($user->getTable().' as u' , 'u.id = p.user_id') + ->join($antenne->getTable().' as a' , 'a.id = p.antenne_id') + ->join($region->getTable().' as r' , 'r.id = a.region_id') + ->select('p.*, u.username, a.name as antenne_name, r.name as region_name' ) + ->order('p.created_at DESC'); + } + + public function findByAntenneId($field, $value): Query + { + $user = new UserTable($this->pdo); + $antenne = new AntenneTable($this->pdo); + $region = new RegionTable($this->pdo); + return $this->makeQuery() + ->join($user->getTable().' as u' , 'u.id = p.user_id') + ->join($antenne->getTable().' as a' , 'a.id = p.antenne_id') + ->join($region->getTable().' as r' , 'r.id = a.region_id') + ->select('p.*, u.username, a.name as antenne_name, r.name as region_name' ) + ->where("$field = $value" ) + ->order('p.created_at DESC'); + } + /* public function findPublic(): Query + { + return $this->makeQuery() + ->where('created_at < NOW()'); + } + public function findPaginatedProduct(string $table, int $perPage, int $currentPage): Pagerfanta + { + $query = new PaginatedQuery( + $this->pdo, + "SELECT * + FROM {$this->table} + ORDER BY name ASC", + "SELECT COUNT(id) FROM {$this->table}", + $this->entity + ); + return (new Pagerfanta($query)) + ->setMaxPerPage($perPage) + ->setCurrentPage($currentPage); + }*/ + +} diff --git a/src/Product/config.php b/src/Product/config.php new file mode 100644 index 0000000..1e64310 --- /dev/null +++ b/src/Product/config.php @@ -0,0 +1,13 @@ + '/product' + //'admin.prefix' => '/admin' + //'admin.widgets' => [], + //\App\Admin\AdminTwigExtension::class => \DI\object()->constructor(\DI\get('admin.widgets')), + //ProductModule::class => \DI\object()->constructorParameter('prefix', \DI\get('product.prefix')) +]; diff --git a/src/Product/views/admin/products/create.twig b/src/Product/views/admin/products/create.twig new file mode 100644 index 0000000..940dfe7 --- /dev/null +++ b/src/Product/views/admin/products/create.twig @@ -0,0 +1,16 @@ +{% extends 'layout.twig' %} + +{% block title "Ğ1-Marché - Ajouter un produit" %} + +{% block body %} +
+

Ajouter un produit

+ +
+ + {% include viewPath ~ '/form.twig' %} + + +
+
+{% endblock %} diff --git a/src/Product/views/admin/products/edit.twig b/src/Product/views/admin/products/edit.twig new file mode 100644 index 0000000..9046ff7 --- /dev/null +++ b/src/Product/views/admin/products/edit.twig @@ -0,0 +1,16 @@ +{% extends 'layout.twig' %} + +{% block title "{{ item.antenne_name }}" %} + +{% block body %} +
+

Editer le produit : {{ item.name }}

+ +
+ + {% include viewPath ~ '/form.twig' %} + + +
+
+{% endblock %} diff --git a/src/Product/views/admin/products/form.twig b/src/Product/views/admin/products/form.twig new file mode 100644 index 0000000..9ff7ab2 --- /dev/null +++ b/src/Product/views/admin/products/form.twig @@ -0,0 +1,34 @@ +{{ csrf_input }} +
+
+ {{ field('name', item.name, "Nom du produit") }} + +
+
+ {{ field('quantite', item.quantite, "Quantité") }} + +
+
+ {{ field('prix', item.prix, "Prix") }} + +
+
+
+
+ {% if item.image %} + + {% endif %} +
+
+ {{ field('image', item.slug, "Image", {type: 'file'}) }} +
+ +
+ {{ field('slug', item.slug, "Lien") }} +
+
+{{ field('content', item.content, "Description", {type: 'textarea'}) }} + +{{ field('updated_at', item.updatedAt, "", {type: 'hidden'}) }} +{{ field('created_at', date(), "", {type: 'hidden'}) }} +{{ field('antenne_id', explodeUrl()[4], "", {type: 'hidden'}) }} diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig new file mode 100644 index 0000000..70ba95d --- /dev/null +++ b/src/Product/views/admin/products/index.twig @@ -0,0 +1,115 @@ +{% extends 'layout.twig' %} +{% block title "Ğ1-Marché - Produits" %} + +{% block body %} + +
+
+

G-Marché de : {{ antenne_name }}

+
+ {% if antenne_name == 'Paris' %} + + {% endif %} + +

+ + Ajouter un produit + + {{ items[name] }} +

+ + + + + + + + + + + + + + {% set token_input = csrf_input %} + + {% for item in items %} + + + + + + + + + + + {% endfor %} + + +
ProduitPhotoVendeurQuantitéPrixMàj leActions
{{ item.name }} {% if item.image %} + + {% endif %} + {{ item.username }} {{ item.quantite }} {{ item.prix }} {{ item.strUpdatedAt }} + {% if current_user().id == item.userId %} + Editer + {% else %} + + {% endif %} + + {% if current_user().id == item.userId %} +
+ + + {{ field('antenne_id', explodeUrl()[4], "", {type: 'hidden'}) }} + {{ field('produit_name', item.name, "", {type: 'hidden'}) }} + {{ token_input | raw }} +
+ {% else %} + + {% endif %} +
+ + {{ paginate(items, routePrefix ~ '.index', {id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }} +
+{% endblock %} diff --git a/src/Product/views/menu.twig b/src/Product/views/menu.twig new file mode 100644 index 0000000..d9ad1e6 --- /dev/null +++ b/src/Product/views/menu.twig @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/src/Product/views/widget.twig b/src/Product/views/widget.twig new file mode 100644 index 0000000..761afa7 --- /dev/null +++ b/src/Product/views/widget.twig @@ -0,0 +1,9 @@ +
+
+
+

{{ count }}

+

Produit{% if count > 1 %}s{% endif %}

+ Gérer les produits +
+
+
\ No newline at end of file diff --git a/tests/Blog/Actions/BlogActionTest.php b/tests/Blog/Actions/BlogActionTest.php new file mode 100644 index 0000000..21a03ef --- /dev/null +++ b/tests/Blog/Actions/BlogActionTest.php @@ -0,0 +1,81 @@ +renderer = $this->prophesize(RendererInterface::class); + $this->regionTable = $this->prophesize(RegionTable::class); + // PDO + $this->router = $this->prophesize(Router::class); + $this->action = new GmarcheAction( + $this->renderer->reveal(), + $this->router->reveal(), + $this->regionTable->reveal() + ); + } + + public function makeRegion(int $id, string $slug): \stdClass + { + // Région + $region = new \stdClass(); + $region->id = $id; + $region->slug = $slug; + return $region; + } + + public function testShowRedirect() + { + $region = $this->makeRegion(9, "azezae-azeazae"); + $request = (new ServerRequest('GET', '/')) + ->withAttribute('id', $region->id) + ->withAttribute('slug', 'demo'); + + $this->router->generateUri( + 'gmarche.show', + ['id' => $region->id, 'slug' => $region->slug] + )->willReturn('/demo2'); + $this->regionTable->find($region->id)->willReturn($region); + + $response = call_user_func_array($this->action, [$request]); + $this->assertEquals(301, $response->getStatusCode()); + $this->assertEquals(['/demo2'], $response->getHeader('location')); + } + + public function testShowRender() + { + $region = $this->makeRegion(9, "azezae-azeazae"); + $request = (new ServerRequest('GET', '/')) + ->withAttribute('id', $region->id) + ->withAttribute('slug', $region->slug); + $this->regionTable->find($region->id)->willReturn($region); + $this->renderer->render('@gmarche/show', ['region' => $region])->willReturn(''); + + $response = call_user_func_array($this->action, [$request]); + $this->assertEquals(true, true); + } + +} \ No newline at end of file diff --git a/tests/Framework/Modules/ErroredModule.php b/tests/Framework/Modules/ErroredModule.php new file mode 100644 index 0000000..66db677 --- /dev/null +++ b/tests/Framework/Modules/ErroredModule.php @@ -0,0 +1,13 @@ +get('/demo', function () { + return new \stdClass(); + }, 'demo'); + } + +} \ No newline at end of file diff --git a/tests/Framework/Modules/StringModule.php b/tests/Framework/Modules/StringModule.php new file mode 100644 index 0000000..845b703 --- /dev/null +++ b/tests/Framework/Modules/StringModule.php @@ -0,0 +1,13 @@ +get('/demo', function () { + return 'DEMO'; + }, 'demo'); + } + +} \ No newline at end of file diff --git a/tests/Framework/Renderer/PHPRendererTest.php b/tests/Framework/Renderer/PHPRendererTest.php new file mode 100644 index 0000000..b985987 --- /dev/null +++ b/tests/Framework/Renderer/PHPRendererTest.php @@ -0,0 +1,40 @@ +renderer = new Renderer\PHPRenderer(__DIR__ . '/views'); + } + + public function testRenderTheRightPath() { + $this->renderer->addPath('blog', __DIR__ . '/views'); + $content = $this->renderer->render('@blog/demo'); + $this->assertEquals('Salut les gens', $content); + } + + public function testRenderTheDefaultPath() { + $content = $this->renderer->render('demo'); + $this->assertEquals('Salut les gens', $content); + } + + public function testRenderWithParams() { + $content = $this->renderer->render('demoparams', ['nom' => 'Marc']); + $this->assertEquals('Salut Marc', $content); + } + + public function testGlobalParameters() { + $this->renderer->addGlobal('nom', 'Marc'); + $content = $this->renderer->render('demoparams'); + $this->assertEquals('Salut Marc', $content); + } + + + +} \ No newline at end of file diff --git a/tests/Framework/Renderer/views/demo.php b/tests/Framework/Renderer/views/demo.php new file mode 100644 index 0000000..1955e76 --- /dev/null +++ b/tests/Framework/Renderer/views/demo.php @@ -0,0 +1 @@ +Salut les gens \ No newline at end of file diff --git a/tests/Framework/Renderer/views/demoparams.php b/tests/Framework/Renderer/views/demoparams.php new file mode 100644 index 0000000..79901b9 --- /dev/null +++ b/tests/Framework/Renderer/views/demoparams.php @@ -0,0 +1 @@ +Salut \ No newline at end of file diff --git a/tests/Framework/RouterTest.php b/tests/Framework/RouterTest.php new file mode 100644 index 0000000..b2308fe --- /dev/null +++ b/tests/Framework/RouterTest.php @@ -0,0 +1,60 @@ +router = new Router(); + } + + public function testGetMethod() + { + $request = new ServerRequest('GET', '/gmarche'); + $this->router->get('/gmarche', function () { return 'hello'; }, 'gmarche'); + $route = $this->router->match($request); + $this->assertEquals('gmarche', $route->getName()); + $this->assertEquals('hello', call_user_func_array($route->getCallback(), [$request])); + } + + public function testGetMethodIfURLDoesNotExists() + { + $request = new ServerRequest('GET', '/gmarche'); + $this->router->get('/gmarcheaze', function () { return 'hello'; }, 'gmarche'); + $route = $this->router->match($request); + $this->assertEquals(null, $route); + } + + public function testGetMethodWithParameters() + { + $request = new ServerRequest('GET', '/gmarche/mon-slug-8'); + $this->router->get('/gmarche', function () { return 'azezea'; }, 'regions'); + $this->router->get('/gmarche/{slug:[a-z0-9\-]+}-{id:\d+}', function () { return 'hello'; }, 'region.show'); + $route = $this->router->match($request); + $this->assertEquals('region.show', $route->getName()); + $this->assertEquals('hello', call_user_func_array($route->getCallback(), [$request])); + $this->assertEquals(['slug' => 'mon-slug', 'id' => '8'], $route->getParams()); + // Test invalid url + $route = $this->router->match(new ServerRequest('GET', '/gmarche/mon_slug-8')); + $this->assertEquals(null, $route); + } + + public function testGenerateUri() + { + $this->router->get('/gmarche', function () { return 'azezea'; }, 'regions'); + $this->router->get('/gmarche/{slug:[a-z0-9\-]+}-{id:\d+}', function () { return 'hello'; }, 'region.show'); + $uri = $this->router->generateUri('region.show', ['slug' => 'region', 'id' => 8]); + $this->assertEquals('/gmarche/region-8', $uri); + } + +} \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 0000000..ec5b907 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,7 @@ + /dev/null; cd "../robmorgan/phinx/bin" && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/phinx" "$@" diff --git a/vendor/bin/phinx.bat b/vendor/bin/phinx.bat new file mode 100644 index 0000000..98f69b1 --- /dev/null +++ b/vendor/bin/phinx.bat @@ -0,0 +1,4 @@ +@ECHO OFF +setlocal DISABLEDELAYEDEXPANSION +SET BIN_TARGET=%~dp0/../robmorgan/phinx/bin/phinx +php "%BIN_TARGET%" %* diff --git a/vendor/bin/phpcbf b/vendor/bin/phpcbf new file mode 100644 index 0000000..c920ab3 --- /dev/null +++ b/vendor/bin/phpcbf @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../squizlabs/php_codesniffer/bin" && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/phpcbf" "$@" diff --git a/vendor/bin/phpcbf.bat b/vendor/bin/phpcbf.bat new file mode 100644 index 0000000..fe902d5 --- /dev/null +++ b/vendor/bin/phpcbf.bat @@ -0,0 +1,4 @@ +@ECHO OFF +setlocal DISABLEDELAYEDEXPANSION +SET BIN_TARGET=%~dp0/../squizlabs/php_codesniffer/bin/phpcbf +php "%BIN_TARGET%" %* diff --git a/vendor/bin/phpcs b/vendor/bin/phpcs new file mode 100644 index 0000000..b1d2d97 --- /dev/null +++ b/vendor/bin/phpcs @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../squizlabs/php_codesniffer/bin" && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/phpcs" "$@" diff --git a/vendor/bin/phpcs.bat b/vendor/bin/phpcs.bat new file mode 100644 index 0000000..11aab45 --- /dev/null +++ b/vendor/bin/phpcs.bat @@ -0,0 +1,4 @@ +@ECHO OFF +setlocal DISABLEDELAYEDEXPANSION +SET BIN_TARGET=%~dp0/../squizlabs/php_codesniffer/bin/phpcs +php "%BIN_TARGET%" %* diff --git a/vendor/bin/phpunit b/vendor/bin/phpunit new file mode 100644 index 0000000..990f194 --- /dev/null +++ b/vendor/bin/phpunit @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../phpunit/phpunit" && pwd) + +if [ -d /proc/cygdrive ]; then + case $(which php) in + $(readlink -n /proc/cygdrive)/*) + # We are in Cygwin using Windows php, so the path must be translated + dir=$(cygpath -m "$dir"); + ;; + esac +fi + +"${dir}/phpunit" "$@" diff --git a/vendor/bin/phpunit.bat b/vendor/bin/phpunit.bat new file mode 100644 index 0000000..b177923 --- /dev/null +++ b/vendor/bin/phpunit.bat @@ -0,0 +1,4 @@ +@ECHO OFF +setlocal DISABLEDELAYEDEXPANSION +SET BIN_TARGET=%~dp0/../phpunit/phpunit/phpunit +php "%BIN_TARGET%" %* diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php new file mode 100644 index 0000000..fce8549 --- /dev/null +++ b/vendor/composer/ClassLoader.php @@ -0,0 +1,445 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..619a320 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,551 @@ + $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php', + 'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php', + 'File_Iterator_Factory' => $vendorDir . '/phpunit/php-file-iterator/src/Factory.php', + 'PHPUnit\\Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/AssertionFailedError.php', + 'PHPUnit\\Framework\\BaseTestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/BaseTestListener.php', + 'PHPUnit\\Framework\\CodeCoverageException' => $vendorDir . '/phpunit/phpunit/src/Framework/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => $vendorDir . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => $vendorDir . '/phpunit/phpunit/src/Framework/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => $vendorDir . '/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/Match.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\NamespaceMatch' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/NamespaceMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Invocation/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationMocker' => $vendorDir . '/phpunit/phpunit-mock-objects/src/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\ObjectInvocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Invocation/ObjectInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\StaticInvocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Invocation/StaticInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invokable' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Invokable.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyInvokedCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\ConsecutiveParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Invocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtIndex' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtMostCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedRecorder' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedRecorder.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\MethodName' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Parameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\StatelessInvocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Matcher/StatelessInvocation.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => $vendorDir . '/phpunit/phpunit-mock-objects/src/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => $vendorDir . '/phpunit/phpunit-mock-objects/src/ForwardCompatibility/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\MatcherCollection' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/MatcherCollection.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Verifiable.php', + 'PHPUnit\\Framework\\OutputError' => $vendorDir . '/phpunit/phpunit/src/Framework/OutputError.php', + 'PHPUnit\\Framework\\RiskyTest' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTest.php', + 'PHPUnit\\Framework\\RiskyTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => $vendorDir . '/phpunit/phpunit/src/Framework/SyntheticError.php', + 'PHPUnit\\Framework\\Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => $vendorDir . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => $vendorDir . '/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\BaseTestRunner' => $vendorDir . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\Exception' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\PhptTestCase' => $vendorDir . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\Version' => $vendorDir . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Blacklist' => $vendorDir . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Configuration' => $vendorDir . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => $vendorDir . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\Fileloader' => $vendorDir . '/phpunit/phpunit/src/Util/Fileloader.php', + 'PHPUnit\\Util\\Filesystem' => $vendorDir . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => $vendorDir . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => $vendorDir . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => $vendorDir . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidArgumentHelper' => $vendorDir . '/phpunit/phpunit/src/Util/InvalidArgumentHelper.php', + 'PHPUnit\\Util\\Json' => $vendorDir . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => $vendorDir . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => $vendorDir . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => $vendorDir . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => $vendorDir . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => $vendorDir . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\Xml' => $vendorDir . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHPUnit_Framework_MockObject_MockObject' => $vendorDir . '/phpunit/phpunit-mock-objects/src/MockObject.php', + 'PHP_Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', + 'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ASYNC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AWAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMPILER_HALT_OFFSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENUM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUALS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_JOIN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_CP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_OP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NULLSAFE_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ONUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SHAPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SUPER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream.php', + 'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', + 'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPELIST_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPELIST_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHERE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_ATTRIBUTE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CATEGORY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CATEGORY_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CHILDREN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_REQUIRED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TAG_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TAG_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TEXT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PharIo\\Manifest\\Application' => $vendorDir . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => $vendorDir . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => $vendorDir . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => $vendorDir . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => $vendorDir . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => $vendorDir . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => $vendorDir . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => $vendorDir . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\Email' => $vendorDir . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => $vendorDir . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => $vendorDir . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => $vendorDir . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => $vendorDir . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => $vendorDir . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => $vendorDir . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => $vendorDir . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => $vendorDir . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => $vendorDir . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => $vendorDir . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => $vendorDir . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => $vendorDir . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => $vendorDir . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => $vendorDir . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => $vendorDir . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => $vendorDir . '/phar-io/version/src/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => $vendorDir . '/phar-io/version/src/AnyVersionConstraint.php', + 'PharIo\\Version\\ExactVersionConstraint' => $vendorDir . '/phar-io/version/src/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => $vendorDir . '/phar-io/version/src/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => $vendorDir . '/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidVersionException' => $vendorDir . '/phar-io/version/src/InvalidVersionException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => $vendorDir . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => $vendorDir . '/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => $vendorDir . '/phar-io/version/src/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => $vendorDir . '/phar-io/version/src/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => $vendorDir . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => $vendorDir . '/phar-io/version/src/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => $vendorDir . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\HHVM' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/HHVM.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => $vendorDir . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => $vendorDir . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => $vendorDir . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => $vendorDir . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => $vendorDir . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => $vendorDir . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => $vendorDir . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => $vendorDir . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => $vendorDir . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => $vendorDir . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => $vendorDir . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => $vendorDir . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => $vendorDir . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => $vendorDir . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => $vendorDir . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => $vendorDir . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => $vendorDir . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => $vendorDir . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => $vendorDir . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => $vendorDir . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => $vendorDir . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => $vendorDir . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => $vendorDir . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => $vendorDir . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => $vendorDir . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => $vendorDir . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => $vendorDir . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => $vendorDir . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => $vendorDir . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => $vendorDir . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => $vendorDir . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => $vendorDir . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => $vendorDir . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => $vendorDir . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => $vendorDir . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => $vendorDir . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', + 'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => $vendorDir . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => $vendorDir . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => $vendorDir . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => $vendorDir . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => $vendorDir . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => $vendorDir . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => $vendorDir . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => $vendorDir . '/theseer/tokenizer/src/XMLSerializer.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 0000000..c048f8a --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,22 @@ + $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', + '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + 'aaf5b53a99b4de51dadc23016def253f' => $vendorDir . '/webimpress/http-middleware-compatibility/autoload/http-middleware.php', + '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php', + 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', + '6f2c5977e422114bbaec553e7c77ee8b' => $vendorDir . '/http-interop/response-sender/src/functions.php', + 'bbf73f3db644d3dced353b837903e74c' => $vendorDir . '/php-di/php-di/src/DI/functions.php', + '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..0ce4ba6 --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,11 @@ + array($vendorDir . '/twig/twig/lib'), + 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'), +); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..6be4661 --- /dev/null +++ b/vendor/composer/autoload_psr4.php @@ -0,0 +1,53 @@ + array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'), + 'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'), + 'Zend\\Expressive\\Router\\' => array($vendorDir . '/zendframework/zend-expressive-fastroute/src', $vendorDir . '/zendframework/zend-expressive-router/src'), + 'Whoops\\' => array($vendorDir . '/filp/whoops/src/Whoops'), + 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), + 'Webimpress\\ComposerExtraDependency\\' => array($vendorDir . '/webimpress/composer-extra-dependency/src'), + 'Twig\\' => array($vendorDir . '/twig/twig/src'), + 'Tests\\' => array($baseDir . '/tests'), + 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'), + 'Symfony\\Polyfill\\Iconv\\' => array($vendorDir . '/symfony/polyfill-iconv'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), + 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), + 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), + 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), + 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), + 'PhpDocReader\\' => array($vendorDir . '/php-di/phpdoc-reader/src/PhpDocReader'), + 'Phinx\\' => array($vendorDir . '/robmorgan/phinx/src/Phinx'), + 'Pagerfanta\\' => array($vendorDir . '/pagerfanta/pagerfanta/src/Pagerfanta'), + 'Middlewares\\Utils\\' => array($vendorDir . '/middlewares/utils/src'), + 'Middlewares\\' => array($vendorDir . '/middlewares/whoops/src'), + 'Invoker\\' => array($vendorDir . '/php-di/invoker/src'), + 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'), + 'Interop\\Http\\ServerMiddleware\\' => array($vendorDir . '/http-interop/http-middleware/src'), + 'Interop\\Http\\Factory\\' => array($vendorDir . '/http-interop/http-factory/src'), + 'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'Framework\\' => array($baseDir . '/src/Framework'), + 'Fig\\Http\\Message\\' => array($vendorDir . '/fig/http-message-util/src'), + 'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'), + 'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'), + 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'), + 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), + 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), + 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), + 'DI\\' => array($vendorDir . '/php-di/php-di/src/DI'), + 'App\\' => array($baseDir . '/src'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 0000000..179d5d7 --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,70 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit9f5dfa25090318439fa5089515ea0095::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit9f5dfa25090318439fa5089515ea0095::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire9f5dfa25090318439fa5089515ea0095($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire9f5dfa25090318439fa5089515ea0095($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 0000000..eeac18f --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,868 @@ + __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', + '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + 'aaf5b53a99b4de51dadc23016def253f' => __DIR__ . '/..' . '/webimpress/http-middleware-compatibility/autoload/http-middleware.php', + '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php', + 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php', + 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', + '6f2c5977e422114bbaec553e7c77ee8b' => __DIR__ . '/..' . '/http-interop/response-sender/src/functions.php', + 'bbf73f3db644d3dced353b837903e74c' => __DIR__ . '/..' . '/php-di/php-di/src/DI/functions.php', + '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'p' => + array ( + 'phpDocumentor\\Reflection\\' => 25, + ), + 'Z' => + array ( + 'Zend\\Stdlib\\' => 12, + 'Zend\\Expressive\\Router\\' => 23, + ), + 'W' => + array ( + 'Whoops\\' => 7, + 'Webmozart\\Assert\\' => 17, + 'Webimpress\\ComposerExtraDependency\\' => 35, + ), + 'T' => + array ( + 'Twig\\' => 5, + 'Tests\\' => 6, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php72\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Intl\\Idn\\' => 26, + 'Symfony\\Polyfill\\Iconv\\' => 23, + 'Symfony\\Polyfill\\Ctype\\' => 23, + 'Symfony\\Component\\Yaml\\' => 23, + 'Symfony\\Component\\Filesystem\\' => 29, + 'Symfony\\Component\\Debug\\' => 24, + 'Symfony\\Component\\Console\\' => 26, + 'Symfony\\Component\\Config\\' => 25, + ), + 'R' => + array ( + 'Ramsey\\Uuid\\' => 12, + ), + 'P' => + array ( + 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Container\\' => 14, + 'Prophecy\\' => 9, + 'PhpDocReader\\' => 13, + 'Phinx\\' => 6, + 'Pagerfanta\\' => 11, + ), + 'M' => + array ( + 'Middlewares\\Utils\\' => 18, + 'Middlewares\\' => 12, + ), + 'I' => + array ( + 'Invoker\\' => 8, + 'Intervention\\Image\\' => 19, + 'Interop\\Http\\ServerMiddleware\\' => 30, + 'Interop\\Http\\Factory\\' => 21, + 'Interop\\Container\\' => 18, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + ), + 'F' => + array ( + 'Framework\\' => 10, + 'Fig\\Http\\Message\\' => 17, + 'FastRoute\\' => 10, + 'Faker\\' => 6, + ), + 'E' => + array ( + 'Egulias\\EmailValidator\\' => 23, + ), + 'D' => + array ( + 'Doctrine\\Instantiator\\' => 22, + 'Doctrine\\Common\\Lexer\\' => 22, + 'DeepCopy\\' => 9, + 'DI\\' => 3, + ), + 'A' => + array ( + 'App\\' => 4, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'phpDocumentor\\Reflection\\' => + array ( + 0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src', + 1 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src', + 2 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src', + ), + 'Zend\\Stdlib\\' => + array ( + 0 => __DIR__ . '/..' . '/zendframework/zend-stdlib/src', + ), + 'Zend\\Expressive\\Router\\' => + array ( + 0 => __DIR__ . '/..' . '/zendframework/zend-expressive-fastroute/src', + 1 => __DIR__ . '/..' . '/zendframework/zend-expressive-router/src', + ), + 'Whoops\\' => + array ( + 0 => __DIR__ . '/..' . '/filp/whoops/src/Whoops', + ), + 'Webmozart\\Assert\\' => + array ( + 0 => __DIR__ . '/..' . '/webmozart/assert/src', + ), + 'Webimpress\\ComposerExtraDependency\\' => + array ( + 0 => __DIR__ . '/..' . '/webimpress/composer-extra-dependency/src', + ), + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), + 'Tests\\' => + array ( + 0 => __DIR__ . '/../..' . '/tests', + ), + 'Symfony\\Polyfill\\Php72\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Intl\\Idn\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn', + ), + 'Symfony\\Polyfill\\Iconv\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-iconv', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Symfony\\Component\\Yaml\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/yaml', + ), + 'Symfony\\Component\\Filesystem\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/filesystem', + ), + 'Symfony\\Component\\Debug\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/debug', + ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), + 'Symfony\\Component\\Config\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/config', + ), + 'Ramsey\\Uuid\\' => + array ( + 0 => __DIR__ . '/..' . '/ramsey/uuid/src', + ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), + 'Prophecy\\' => + array ( + 0 => __DIR__ . '/..' . '/phpspec/prophecy/src/Prophecy', + ), + 'PhpDocReader\\' => + array ( + 0 => __DIR__ . '/..' . '/php-di/phpdoc-reader/src/PhpDocReader', + ), + 'Phinx\\' => + array ( + 0 => __DIR__ . '/..' . '/robmorgan/phinx/src/Phinx', + ), + 'Pagerfanta\\' => + array ( + 0 => __DIR__ . '/..' . '/pagerfanta/pagerfanta/src/Pagerfanta', + ), + 'Middlewares\\Utils\\' => + array ( + 0 => __DIR__ . '/..' . '/middlewares/utils/src', + ), + 'Middlewares\\' => + array ( + 0 => __DIR__ . '/..' . '/middlewares/whoops/src', + ), + 'Invoker\\' => + array ( + 0 => __DIR__ . '/..' . '/php-di/invoker/src', + ), + 'Intervention\\Image\\' => + array ( + 0 => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image', + ), + 'Interop\\Http\\ServerMiddleware\\' => + array ( + 0 => __DIR__ . '/..' . '/http-interop/http-middleware/src', + ), + 'Interop\\Http\\Factory\\' => + array ( + 0 => __DIR__ . '/..' . '/http-interop/http-factory/src', + ), + 'Interop\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'Framework\\' => + array ( + 0 => __DIR__ . '/../..' . '/src/Framework', + ), + 'Fig\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/fig/http-message-util/src', + ), + 'FastRoute\\' => + array ( + 0 => __DIR__ . '/..' . '/nikic/fast-route/src', + ), + 'Faker\\' => + array ( + 0 => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker', + ), + 'Egulias\\EmailValidator\\' => + array ( + 0 => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator', + ), + 'Doctrine\\Instantiator\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', + ), + 'Doctrine\\Common\\Lexer\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer', + ), + 'DeepCopy\\' => + array ( + 0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', + ), + 'DI\\' => + array ( + 0 => __DIR__ . '/..' . '/php-di/php-di/src/DI', + ), + 'App\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $prefixesPsr0 = array ( + 'T' => + array ( + 'Twig_' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/lib', + ), + ), + 'D' => + array ( + 'Doctrine\\Common\\Cache\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/cache/lib', + ), + ), + ); + + public static $classMap = array ( + 'File_Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php', + 'File_Iterator_Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php', + 'File_Iterator_Factory' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Factory.php', + 'PHPUnit\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/AssertionFailedError.php', + 'PHPUnit\\Framework\\BaseTestListener' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/BaseTestListener.php', + 'PHPUnit\\Framework\\CodeCoverageException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/Match.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\NamespaceMatch' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/NamespaceMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Invocation/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\ObjectInvocation' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Invocation/ObjectInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\StaticInvocation' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Invocation/StaticInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invokable' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Invokable.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyInvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyParameters' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\ConsecutiveParameters' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtIndex' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastCount' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastOnce' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtMostCount' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedRecorder' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/InvokedRecorder.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\MethodName' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Parameters' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\StatelessInvocation' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Matcher/StatelessInvocation.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/ForwardCompatibility/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\MatcherCollection' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/MatcherCollection.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/Verifiable.php', + 'PHPUnit\\Framework\\OutputError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/OutputError.php', + 'PHPUnit\\Framework\\RiskyTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/RiskyTest.php', + 'PHPUnit\\Framework\\RiskyTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SyntheticError.php', + 'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\BaseTestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\PhptTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\Version' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Blacklist' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\Fileloader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Fileloader.php', + 'PHPUnit\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidArgumentHelper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/InvalidArgumentHelper.php', + 'PHPUnit\\Util\\Json' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHPUnit_Framework_MockObject_MockObject' => __DIR__ . '/..' . '/phpunit/phpunit-mock-objects/src/MockObject.php', + 'PHP_Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', + 'PHP_Token' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScopeAndVisibility' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ABSTRACT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AMPERSAND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AND_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ASYNC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AWAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BACKTICK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BAD_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOL_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BREAK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CALLABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CARET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CASE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CATCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLONE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COALESCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMA' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMPILER_HALT_OFFSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONCAT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONTINUE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CURLY_OPEN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEFAULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOC_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_QUOTES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELLIPSIS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSEIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EMPTY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDDECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDSWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDWHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_END_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENUM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUALS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EVAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXCLAMATION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXTENDS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINALLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNC_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GLOBAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GOTO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_HALT_COMPILER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IMPLEMENTS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INLINE_HTML' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTANCEOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTEADOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INTERFACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ISSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Includes' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_JOIN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_CP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LAMBDA_OP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LINE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LIST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_XOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_METHOD_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MOD_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MUL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NAMESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NEW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_SEPARATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NULLSAFE_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NUM_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ONUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PERCENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PIPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRINT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRIVATE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PROTECTED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PUBLIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_QUESTION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_RETURN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SEMICOLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SHAPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SPACESHIP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_START_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STATIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_VARNAME' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SUPER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Stream' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream.php', + 'PHP_Token_Stream_CachingFactory' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', + 'PHP_Token_THROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TILDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPELIST_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TYPELIST_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VARIABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHERE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_ATTRIBUTE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CATEGORY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CATEGORY_LABEL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_CHILDREN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_LABEL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_REQUIRED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TAG_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TAG_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XHP_TEXT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XOR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD_FROM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PharIo\\Manifest\\Application' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => __DIR__ . '/..' . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => __DIR__ . '/..' . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\Email' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => __DIR__ . '/..' . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/AnyVersionConstraint.php', + 'PharIo\\Version\\ExactVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => __DIR__ . '/..' . '/phar-io/version/src/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidVersionException' => __DIR__ . '/..' . '/phar-io/version/src/InvalidVersionException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => __DIR__ . '/..' . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => __DIR__ . '/..' . '/phar-io/version/src/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => __DIR__ . '/..' . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\HHVM' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/HHVM.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => __DIR__ . '/..' . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => __DIR__ . '/..' . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => __DIR__ . '/..' . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => __DIR__ . '/..' . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\Diff' => __DIR__ . '/..' . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => __DIR__ . '/..' . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => __DIR__ . '/..' . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => __DIR__ . '/..' . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => __DIR__ . '/..' . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => __DIR__ . '/..' . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => __DIR__ . '/..' . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => __DIR__ . '/..' . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => __DIR__ . '/..' . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => __DIR__ . '/..' . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => __DIR__ . '/..' . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => __DIR__ . '/..' . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => __DIR__ . '/..' . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => __DIR__ . '/..' . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', + 'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => __DIR__ . '/..' . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => __DIR__ . '/..' . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => __DIR__ . '/..' . '/theseer/tokenizer/src/XMLSerializer.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit9f5dfa25090318439fa5089515ea0095::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit9f5dfa25090318439fa5089515ea0095::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit9f5dfa25090318439fa5089515ea0095::$prefixesPsr0; + $loader->classMap = ComposerStaticInit9f5dfa25090318439fa5089515ea0095::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 0000000..f692f80 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,4056 @@ +[ + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "time": "2017-02-14T19:40:03+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop" + }, + { + "name": "doctrine/cache", + "version": "v1.4.0", + "version_normalized": "1.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/2346085d2b027b233ae1d5de59b07440b9f288c8", + "reference": "2346085d2b027b233ae1d5de59b07440b9f288c8", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "predis/predis": "~0.8", + "satooshi/php-coveralls": "~0.6" + }, + "time": "2015-01-15T20:38:55+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ] + }, + { + "name": "doctrine/instantiator", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "a2c590166b2133a4633738648b6b064edae0814a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "time": "2019-03-17T17:37:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ] + }, + { + "name": "doctrine/lexer", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e17f069ede36f7534b95adec71910ed1b49c74ea", + "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "time": "2019-07-30T19:33:28+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ] + }, + { + "name": "egulias/email-validator", + "version": "2.1.11", + "version_normalized": "2.1.11.0", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/92dd169c32f6f55ba570c309d83f5209cefb5e23", + "reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1", + "symfony/phpunit-bridge": "^4.4@dev" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "time": "2019-08-13T17:33:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ] + }, + { + "name": "fig/http-message-util", + "version": "1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "35b19404371b31b3a43823c755398c48c9966db4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/35b19404371b31b3a43823c755398c48c9966db4", + "reference": "35b19404371b31b3a43823c755398c48c9966db4", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0", + "psr/http-message": "^1.0" + }, + "time": "2018-11-19T16:19:58+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ] + }, + { + "name": "filp/whoops", + "version": "2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "cde50e6720a39fdacb240159d3eea6865d51fd96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/cde50e6720a39fdacb240159d3eea6865d51fd96", + "reference": "cde50e6720a39fdacb240159d3eea6865d51fd96", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "mockery/mockery": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "time": "2019-08-07T09:00:00+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "role": "Developer", + "homepage": "https://github.com/filp" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ] + }, + { + "name": "fzaninotto/faker", + "version": "v1.8.0", + "version_normalized": "1.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5" + }, + "time": "2018-07-12T10:23:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ] + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "version_normalized": "1.6.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2019-07-01T23:21:34+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ] + }, + { + "name": "http-interop/http-factory", + "version": "0.3.0", + "version_normalized": "0.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/http-factory.git", + "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/http-factory/zipball/c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", + "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/http-message": "^1.0" + }, + "time": "2017-03-24T14:48:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Interop\\Http\\Factory\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "abandoned": "psr/http-factory" + }, + { + "name": "http-interop/http-middleware", + "version": "0.4.1", + "version_normalized": "0.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/http-middleware.git", + "reference": "9a801fe60e70d5d608b61d56b2dcde29516c81b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/http-middleware/zipball/9a801fe60e70d5d608b61d56b2dcde29516c81b9", + "reference": "9a801fe60e70d5d608b61d56b2dcde29516c81b9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/http-message": "^1.0" + }, + "time": "2017-01-14T15:23:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Interop\\Http\\ServerMiddleware\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "factory", + "http", + "middleware", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "abandoned": "http-interop/http-server-middleware" + }, + { + "name": "http-interop/response-sender", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/response-sender.git", + "reference": "fd63be06cd6c9216ef3c725af1a3f6b155eebc84" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/response-sender/zipball/fd63be06cd6c9216ef3c725af1a3f6b155eebc84", + "reference": "fd63be06cd6c9216ef3c725af1a3f6b155eebc84", + "shasum": "" + }, + "require": { + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^1.4", + "php-mock/php-mock-phpunit": "^1.1", + "phpunit/phpunit": "^5.6" + }, + "time": "2017-03-17T15:46:19+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" + } + ], + "description": "A function to convert PSR-7 Response to HTTP output" + }, + { + "name": "intervention/image", + "version": "2.4.0", + "version_normalized": "2.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "322a4ade249467179c50a3e50eda8760ff3af2a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/322a4ade249467179c50a3e50eda8760ff3af2a3", + "reference": "322a4ade249467179c50a3e50eda8760ff3af2a3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "time": "2017-07-03T15:50:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ] + }, + { + "name": "middlewares/utils", + "version": "v0.11.1", + "version_normalized": "0.11.1.0", + "source": { + "type": "git", + "url": "https://github.com/middlewares/utils.git", + "reference": "67f1e9802c50808bc28981ede28611d836f8f7bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/middlewares/utils/zipball/67f1e9802c50808bc28981ede28611d836f8f7bf", + "reference": "67f1e9802c50808bc28981ede28611d836f8f7bf", + "shasum": "" + }, + "require": { + "http-interop/http-factory": "^0.3", + "http-interop/http-middleware": "^0.4", + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "guzzlehttp/psr7": "^1.3", + "phpunit/phpunit": "^5.5", + "psr/container": "^1.0", + "slim/slim": "^3.5", + "squizlabs/php_codesniffer": "^2.7", + "zendframework/zend-diactoros": "^1.3" + }, + "suggest": { + "psr/container": "Can be used to automatically resolve callables" + }, + "time": "2017-05-06T08:44:30+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Middlewares\\Utils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Common utils to create PSR-15 middleware packages", + "homepage": "https://github.com/middlewares/utils", + "keywords": [ + "PSR-11", + "http", + "middleware", + "psr-15", + "psr-7" + ] + }, + { + "name": "middlewares/whoops", + "version": "v0.4.1", + "version_normalized": "0.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/middlewares/whoops.git", + "reference": "6c3a361d4904fc464a67a018f79eb10512b1cdbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/middlewares/whoops/zipball/6c3a361d4904fc464a67a018f79eb10512b1cdbc", + "reference": "6c3a361d4904fc464a67a018f79eb10512b1cdbc", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.1", + "http-interop/http-middleware": "^0.4", + "middlewares/utils": "~0.10", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "phpunit/phpunit": "^5.5", + "squizlabs/php_codesniffer": "^2.7", + "zendframework/zend-diactoros": "^1.3" + }, + "time": "2017-06-26T17:45:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Middlewares\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Middleware to use Whoops as error handler", + "homepage": "https://github.com/middlewares/whoops", + "keywords": [ + "error", + "http", + "middleware", + "psr-15", + "psr-7", + "server", + "whoops" + ] + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.3", + "version_normalized": "1.9.3.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "time": "2019-08-09T12:45:53+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ] + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "time": "2018-02-13T20:26:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ] + }, + { + "name": "pagerfanta/pagerfanta", + "version": "v2.1.3", + "version_normalized": "2.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/whiteoctober/Pagerfanta.git", + "reference": "a53ff01d521648d9dbca19b93ac6bc75a59b0972" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/a53ff01d521648d9dbca19b93ac6bc75a59b0972", + "reference": "a53ff01d521648d9dbca19b93ac6bc75a59b0972", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "doctrine/phpcr-odm": "1.*", + "jackalope/jackalope-doctrine-dbal": "1.*", + "jmikola/geojson": "~1.0", + "mandango/mandango": "~1.0@dev", + "mandango/mondator": "~1.0@dev", + "phpunit/phpunit": "^6.5", + "propel/propel": "~2.0@dev", + "propel/propel1": "~1.6", + "ruflin/elastica": "~1.3", + "solarium/solarium": "~3.1" + }, + "suggest": { + "doctrine/mongodb-odm": "To use the DoctrineODMMongoDBAdapter.", + "doctrine/orm": "To use the DoctrineORMAdapter.", + "doctrine/phpcr-odm": "To use the DoctrineODMPhpcrAdapter. >= 1.1.0", + "mandango/mandango": "To use the MandangoAdapter.", + "propel/propel": "To use the Propel2Adapter", + "propel/propel1": "To use the PropelAdapter", + "solarium/solarium": "To use the SolariumAdapter." + }, + "time": "2019-07-17T20:56:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Pagerfanta\\": "src/Pagerfanta/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pablo Díez", + "email": "pablodip@gmail.com" + } + ], + "description": "Pagination for PHP", + "keywords": [ + "page", + "pagination", + "paginator", + "paging" + ] + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "version_normalized": "9.99.99.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2018-07-02T15:55:56+00:00", + "type": "library", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ] + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "time": "2017-03-05T18:14:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "role": "Developer", + "email": "arne@blankerts.de" + }, + { + "name": "Sebastian Heuer", + "role": "Developer", + "email": "sebastian@phpeople.de" + }, + { + "name": "Sebastian Bergmann", + "role": "Developer", + "email": "sebastian@phpunit.de" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "time": "2017-03-05T17:38:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "role": "Developer", + "email": "arne@blankerts.de" + }, + { + "name": "Sebastian Heuer", + "role": "Developer", + "email": "sebastian@phpeople.de" + }, + { + "name": "Sebastian Bergmann", + "role": "Developer", + "email": "sebastian@phpunit.de" + } + ], + "description": "Library for handling version information and constraints" + }, + { + "name": "php-di/invoker", + "version": "1.3.3", + "version_normalized": "1.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", + "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "phpunit/phpunit": "~4.5" + }, + "time": "2016-07-14T13:09:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Invoker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", + "keywords": [ + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" + ] + }, + { + "name": "php-di/php-di", + "version": "5.4.6", + "version_normalized": "5.4.6.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "3f9255659595f3e289f473778bb6c51aa72abbbd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/3f9255659595f3e289f473778bb6c51aa72abbbd", + "reference": "3f9255659595f3e289f473778bb6c51aa72abbbd", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.2", + "php": ">=5.5.0", + "php-di/invoker": "^1.3.2", + "php-di/phpdoc-reader": "^2.0.1", + "psr/container": "~1.0" + }, + "provide": { + "container-interop/container-interop-implementation": "^1.0", + "psr/container-implementation": "^1.0" + }, + "replace": { + "mnapoli/php-di": "*" + }, + "require-dev": { + "doctrine/annotations": "~1.2", + "doctrine/cache": "~1.4", + "mnapoli/phpunit-easymock": "~0.2.0", + "ocramius/proxy-manager": "~1.0|~2.0", + "phpbench/phpbench": "@dev", + "phpunit/phpunit": "~4.5" + }, + "suggest": { + "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", + "doctrine/cache": "Install it if you want to use the cache (version ~1.4)", + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~1.0 or ~2.0)" + }, + "time": "2017-12-03T08:20:27+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DI\\": "src/DI/" + }, + "files": [ + "src/DI/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The dependency injection container for humans", + "homepage": "http://php-di.org/", + "keywords": [ + "container", + "dependency injection", + "di" + ] + }, + { + "name": "php-di/phpdoc-reader", + "version": "2.1.0", + "version_normalized": "2.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PhpDocReader.git", + "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/7d0de60b9341933c8afd172a6255cd7557601e0e", + "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.6" + }, + "time": "2018-02-18T17:39:01+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpDocReader\\": "src/PhpDocReader" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", + "keywords": [ + "phpdoc", + "reflection" + ] + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "time": "2017-09-11T18:02:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ] + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.1", + "version_normalized": "4.3.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "time": "2019-04-30T17:48:53+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock." + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "version_normalized": "0.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "time": "2017-07-14T14:27:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ] + }, + { + "name": "phpspec/prophecy", + "version": "1.8.1", + "version_normalized": "1.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "time": "2019-06-13T12:50:23+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ] + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.3.2", + "version_normalized": "5.3.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "time": "2018-04-06T15:36:58+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sebastian@phpunit.de" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ] + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "version_normalized": "1.4.5.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2017-11-27T13:52:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sb@sebastian-bergmann.de" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ] + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2015-06-21T13:50:34+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sebastian@phpunit.de" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ] + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "version_normalized": "1.0.9.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "time": "2017-02-26T11:10:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sb@sebastian-bergmann.de" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ] + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "time": "2017-11-27T05:48:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ] + }, + { + "name": "phpunit/phpunit", + "version": "6.5.14", + "version_normalized": "6.5.14.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.9", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "time": "2019-02-01T05:22:47+00:00", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sebastian@phpunit.de" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ] + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "5.0.10", + "version_normalized": "5.0.10.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5.11" + }, + "suggest": { + "ext-soap": "*" + }, + "time": "2018-08-09T05:50:03+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "abandoned": true + }, + { + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-02-14T16:28:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T14:39:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ] + }, + { + "name": "psr/log", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2018-11-20T15:27:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders." + }, + { + "name": "ramsey/uuid", + "version": "3.8.0", + "version_normalized": "3.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "php": "^5.4 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1.0 | ~2.0.0", + "doctrine/annotations": "~1.2.0", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", + "ircmaxell/random-lib": "^1.1", + "jakub-onderka/php-parallel-lint": "^0.9.0", + "mockery/mockery": "^0.9.9", + "moontoast/math": "^1.1", + "php-mock/php-mock-phpunit": "^0.3|^1.1", + "phpunit/phpunit": "^4.7|^5.0|^6.5", + "squizlabs/php_codesniffer": "^2.3" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "time": "2018-07-19T23:38:55+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + }, + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ] + }, + { + "name": "robmorgan/phinx", + "version": "v0.8.1", + "version_normalized": "0.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/cakephp/phinx.git", + "reference": "7a19de5bebc59321edd9613bc2a667e7f96224ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/phinx/zipball/7a19de5bebc59321edd9613bc2a667e7f96224ec", + "reference": "7a19de5bebc59321edd9613bc2a667e7f96224ec", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.26|^5.0" + }, + "time": "2017-06-05T13:30:19+00:00", + "bin": [ + "bin/phinx" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Phinx\\": "src/Phinx" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Woody Gilk", + "role": "Developer", + "email": "woody.gilk@gmail.com", + "homepage": "http://shadowhand.me" + }, + { + "name": "Rob Morgan", + "role": "Lead Developer", + "email": "robbym@gmail.com", + "homepage": "https://robmorgan.id.au" + }, + { + "name": "Richard Quadling", + "role": "Developer", + "email": "rquadling@gmail.com" + } + ], + "description": "Phinx makes it ridiculously easy to manage the database migrations for your PHP app.", + "homepage": "https://phinx.org", + "keywords": [ + "database", + "database migrations", + "db", + "migrations", + "phinx" + ] + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "time": "2017-03-04T06:30:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/" + }, + { + "name": "sebastian/comparator", + "version": "2.1.3", + "version_normalized": "2.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "time": "2018-02-01T13:46:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ] + }, + { + "name": "sebastian/diff", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "time": "2017-08-03T08:09:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ] + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "version_normalized": "3.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "time": "2017-07-01T08:51:00+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ] + }, + { + "name": "sebastian/exporter", + "version": "3.1.1", + "version_normalized": "3.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "06a9a5947f47b3029d76118eb5c22802e5869687" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/06a9a5947f47b3029d76118eb5c22802e5869687", + "reference": "06a9a5947f47b3029d76118eb5c22802e5869687", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "time": "2019-08-11T12:43:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ] + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "time": "2017-04-27T15:39:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ] + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-08-03T12:35:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-03-29T09:07:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "version_normalized": "3.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-03-03T06:23:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "time": "2015-07-28T20:34:47+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "time": "2016-10-03T07:35:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "role": "lead", + "email": "sebastian@phpunit.de" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.4.2", + "version_normalized": "3.4.2.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "time": "2019-04-10T23:49:02+00:00", + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ] + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.2.1", + "version_normalized": "6.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", + "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", + "shasum": "" + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0", + "symfony/polyfill-iconv": "^1.0", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, + "time": "2019-04-21T09:21:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ] + }, + { + "name": "symfony/config", + "version": "v3.4.31", + "version_normalized": "3.4.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "24a60c0d7ad98a0fa5d1f892e9286095a389404f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/24a60c0d7ad98a0fa5d1f892e9286095a389404f", + "reference": "24a60c0d7ad98a0fa5d1f892e9286095a389404f", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "time": "2019-08-26T07:52:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/console", + "version": "v3.4.31", + "version_normalized": "3.4.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "4510f04e70344d70952566e4262a0b11df39cb10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/4510f04e70344d70952566e4262a0b11df39cb10", + "reference": "4510f04e70344d70952566e4262a0b11df39cb10", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "time": "2019-08-26T07:52:58+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/debug", + "version": "v4.3.4", + "version_normalized": "4.3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/afcdea44a2e399c1e4b52246ec8d54c715393ced", + "reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" + }, + "time": "2019-08-20T14:27:59+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/filesystem", + "version": "v4.3.4", + "version_normalized": "4.3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "time": "2019-08-20T14:07:54+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ] + }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "685968b11e61a347c18bf25db32effa478be610f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/685968b11e61a347c18bf25db32effa478be610f", + "reference": "685968b11e61a347c18bf25db32effa478be610f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "6af626ae6fa37d396dc90a399c0ff08e5cfc45b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", + "reference": "6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.9" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "04ce3335667451138df4307d6a9b61565560199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", + "reference": "04ce3335667451138df4307d6a9b61565560199e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2019-08-06T08:03:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/yaml", + "version": "v3.4.31", + "version_normalized": "3.4.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "3dc414b7db30695bae671a1d86013d03f4ae9834" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/3dc414b7db30695bae671a1d86013d03f4ae9834", + "reference": "3dc414b7db30695bae671a1d86013d03f4ae9834", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "time": "2019-08-20T13:31:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "time": "2019-06-13T22:48:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats" + }, + { + "name": "twig/twig", + "version": "v2.11.3", + "version_normalized": "2.11.3.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "699ed2342557c88789a15402de5eb834dedd6792" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/699ed2342557c88789a15402de5eb834dedd6792", + "reference": "699ed2342557c88789a15402de5eb834dedd6792", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0" + }, + "time": "2019-06-18T15:37:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.11-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "role": "Lead Developer", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org" + }, + { + "name": "Armin Ronacher", + "role": "Project Founder", + "email": "armin.ronacher@active-4.com" + }, + { + "name": "Twig Team", + "role": "Contributors", + "homepage": "https://twig.symfony.com/contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ] + }, + { + "name": "webimpress/composer-extra-dependency", + "version": "0.2.2", + "version_normalized": "0.2.2.0", + "source": { + "type": "git", + "url": "https://github.com/webimpress/composer-extra-dependency.git", + "reference": "31fa56391d30f03b1180c87610cbe22254780ad9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webimpress/composer-extra-dependency/zipball/31fa56391d30f03b1180c87610cbe22254780ad9", + "reference": "31fa56391d30f03b1180c87610cbe22254780ad9", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "composer/composer": "^1.5.2", + "mikey179/vfsstream": "^1.6.5", + "phpunit/phpunit": "^5.7.22 || ^6.4.1", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "time": "2017-10-17T17:15:14+00:00", + "type": "composer-plugin", + "extra": { + "class": "Webimpress\\ComposerExtraDependency\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Webimpress\\ComposerExtraDependency\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "Composer plugin to require extra dependencies", + "homepage": "https://github.com/webimpress/composer-extra-dependency", + "keywords": [ + "composer", + "dependency", + "webimpress" + ] + }, + { + "name": "webimpress/http-middleware-compatibility", + "version": "0.1.4", + "version_normalized": "0.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/webimpress/http-middleware-compatibility.git", + "reference": "8ed1c2c7523dce0035b98bc4f3a73ca9cd1d3717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webimpress/http-middleware-compatibility/zipball/8ed1c2c7523dce0035b98bc4f3a73ca9cd1d3717", + "reference": "8ed1c2c7523dce0035b98bc4f3a73ca9cd1d3717", + "shasum": "" + }, + "require": { + "http-interop/http-middleware": "^0.1.1 || ^0.2 || ^0.3 || ^0.4.1 || ^0.5", + "php": "^5.6 || ^7.0", + "webimpress/composer-extra-dependency": "^0.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.23 || ^6.4.3" + }, + "time": "2017-10-17T17:31:10+00:00", + "type": "library", + "extra": { + "dependency": [ + "http-interop/http-middleware" + ] + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload/http-middleware.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "Compatibility library for Draft PSR-15 HTTP Middleware", + "homepage": "https://github.com/webimpress/http-middleware-compatibility", + "keywords": [ + "middleware", + "psr-15", + "webimpress" + ], + "abandoned": "psr/http-server-middleware" + }, + { + "name": "webmozart/assert", + "version": "1.5.0", + "version_normalized": "1.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "time": "2019-08-24T08:43:50+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ] + }, + { + "name": "zendframework/zend-expressive-fastroute", + "version": "2.2.1", + "version_normalized": "2.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-expressive-fastroute.git", + "reference": "7567d8e53e7f92b740c937e2215d393cdb65feb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-expressive-fastroute/zipball/7567d8e53e7f92b740c937e2215d393cdb65feb6", + "reference": "7567d8e53e7f92b740c937e2215d393cdb65feb6", + "shasum": "" + }, + "require": { + "fig/http-message-util": "^1.1.2", + "nikic/fast-route": "^1.2", + "php": "^5.6 || ^7.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0.1", + "zendframework/zend-expressive-router": "^2.4", + "zendframework/zend-stdlib": "^3.1 || 2.*" + }, + "conflict": { + "container-interop/container-interop": "<1.2.0" + }, + "require-dev": { + "malukenho/docheader": "^0.1.5", + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "time": "2018-03-09T17:36:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev", + "dev-develop": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Zend\\Expressive\\Router\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "FastRoute integration for Expressive", + "keywords": [ + "FastRoute", + "ZendFramework", + "expressive", + "http", + "middleware", + "psr", + "psr-7", + "zend-expressive", + "zf" + ] + }, + { + "name": "zendframework/zend-expressive-router", + "version": "2.4.1", + "version_normalized": "2.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-expressive-router.git", + "reference": "e1a00596aa20a29968bdc6ecdf0256c8bfd6e0b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-expressive-router/zipball/e1a00596aa20a29968bdc6ecdf0256c8bfd6e0b5", + "reference": "e1a00596aa20a29968bdc6ecdf0256c8bfd6e0b5", + "shasum": "" + }, + "require": { + "fig/http-message-util": "^1.1.2", + "php": "^5.6 || ^7.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0.1", + "webimpress/http-middleware-compatibility": "^0.1.1" + }, + "require-dev": { + "http-interop/http-middleware": "0.4.1", + "malukenho/docheader": "^0.1.5", + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "suggest": { + "zendframework/zend-expressive-aurarouter": "^1.0 to use the Aura.Router routing adapter", + "zendframework/zend-expressive-fastroute": "^1.2 to use the FastRoute routing adapter", + "zendframework/zend-expressive-zendrouter": "^1.2 to use the zend-router routing adapter" + }, + "time": "2018-03-08T19:27:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4.x-dev", + "dev-develop": "3.0.x-dev" + }, + "zf": { + "config-provider": "Zend\\Expressive\\Router\\ConfigProvider" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Zend\\Expressive\\Router\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Router subcomponent for Expressive", + "keywords": [ + "ZendFramework", + "expressive", + "http", + "middleware", + "psr", + "psr-7", + "zend-expressive", + "zf" + ] + }, + { + "name": "zendframework/zend-stdlib", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "66536006722aff9e62d1b331025089b7ec71c065" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/66536006722aff9e62d1b331025089b7ec71c065", + "reference": "66536006722aff9e62d1b331025089b7ec71c065", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" + }, + "time": "2018-08-28T21:34:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "SPL extensions, array utilities, error handlers, and more", + "keywords": [ + "ZendFramework", + "stdlib", + "zf" + ] + } +] diff --git a/vendor/container-interop/container-interop/.gitignore b/vendor/container-interop/container-interop/.gitignore new file mode 100644 index 0000000..b2395aa --- /dev/null +++ b/vendor/container-interop/container-interop/.gitignore @@ -0,0 +1,3 @@ +composer.lock +composer.phar +/vendor/ diff --git a/vendor/container-interop/container-interop/LICENSE b/vendor/container-interop/container-interop/LICENSE new file mode 100644 index 0000000..7671d90 --- /dev/null +++ b/vendor/container-interop/container-interop/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 container-interop + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/container-interop/container-interop/README.md b/vendor/container-interop/container-interop/README.md new file mode 100644 index 0000000..cdd7a44 --- /dev/null +++ b/vendor/container-interop/container-interop/README.md @@ -0,0 +1,148 @@ +# Container Interoperability + +[![Latest Stable Version](https://poser.pugx.org/container-interop/container-interop/v/stable.png)](https://packagist.org/packages/container-interop/container-interop) +[![Total Downloads](https://poser.pugx.org/container-interop/container-interop/downloads.svg)](https://packagist.org/packages/container-interop/container-interop) + +## Deprecation warning! + +Starting Feb. 13th 2017, container-interop is officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md). +Container-interop has been the test-bed of PSR-11. From v1.2, container-interop directly extends PSR-11 interfaces. +Therefore, all containers implementing container-interop are now *de-facto* compatible with PSR-11. + +- Projects implementing container-interop interfaces are encouraged to directly implement PSR-11 interfaces instead. +- Projects consuming container-interop interfaces are very strongly encouraged to directly type-hint on PSR-11 interfaces, in order to be compatible with PSR-11 containers that are not compatible with container-interop. + +Regarding the delegate lookup feature, that is present in container-interop and not in PSR-11, the feature is actually a design pattern. It is therefore not deprecated. Documentation regarding this design pattern will be migrated from this repository into a separate website in the future. + +## About + +*container-interop* tries to identify and standardize features in *container* objects (service locators, +dependency injection containers, etc.) to achieve interoperability. + +Through discussions and trials, we try to create a standard, made of common interfaces but also recommendations. + +If PHP projects that provide container implementations begin to adopt these common standards, then PHP +applications and projects that use containers can depend on the common interfaces instead of specific +implementations. This facilitates a high-level of interoperability and flexibility that allows users to consume +*any* container implementation that can be adapted to these interfaces. + +The work done in this project is not officially endorsed by the [PHP-FIG](http://www.php-fig.org/), but it is being +worked on by members of PHP-FIG and other good developers. We adhere to the spirit and ideals of PHP-FIG, and hope +this project will pave the way for one or more future PSRs. + + +## Installation + +You can install this package through Composer: + +```json +composer require container-interop/container-interop +``` + +The packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility +between minor versions. + +## Standards + +### Available + +- [`ContainerInterface`](src/Interop/Container/ContainerInterface.php). +[Description](docs/ContainerInterface.md) [Meta Document](docs/ContainerInterface-meta.md). +Describes the interface of a container that exposes methods to read its entries. +- [*Delegate lookup feature*](docs/Delegate-lookup.md). +[Meta Document](docs/Delegate-lookup-meta.md). +Describes the ability for a container to delegate the lookup of its dependencies to a third-party container. This +feature lets several containers work together in a single application. + +### Proposed + +View open [request for comments](https://github.com/container-interop/container-interop/labels/RFC) + +## Compatible projects + +### Projects implementing `ContainerInterface` + +- [Acclimate](https://github.com/jeremeamia/acclimate-container): Adapters for + Aura.Di, Laravel, Nette DI, Pimple, Symfony DI, ZF2 Service manager, ZF2 + Dependency injection and any container using `ArrayAccess` +- [Aura.Di](https://github.com/auraphp/Aura.Di) +- [auryn-container-interop](https://github.com/elazar/auryn-container-interop) +- [Burlap](https://github.com/codeeverything/burlap) +- [Chernozem](https://github.com/pyrsmk/Chernozem) +- [Data Manager](https://github.com/chrismichaels84/data-manager) +- [Disco](https://github.com/bitexpert/disco) +- [InDI](https://github.com/idealogica/indi) +- [League/Container](http://container.thephpleague.com/) +- [Mouf](http://mouf-php.com) +- [Njasm Container](https://github.com/njasm/container) +- [PHP-DI](http://php-di.org) +- [Picotainer](https://github.com/thecodingmachine/picotainer) +- [PimpleInterop](https://github.com/moufmouf/pimple-interop) +- [Pimple3-ContainerInterop](https://github.com/Sam-Burns/pimple3-containerinterop) (using Pimple v3) +- [SitePoint Container](https://github.com/sitepoint/Container) +- [Thruster Container](https://github.com/ThrusterIO/container) (PHP7 only) +- [Ultra-Lite Container](https://github.com/ultra-lite/container) +- [Unbox](https://github.com/mindplay-dk/unbox) +- [XStatic](https://github.com/jeremeamia/xstatic) +- [Zend\ServiceManager](https://github.com/zendframework/zend-servicemanager) +- [Zit](https://github.com/inxilpro/Zit) + +### Projects implementing the *delegate lookup* feature + +- [Aura.Di](https://github.com/auraphp/Aura.Di) +- [Burlap](https://github.com/codeeverything/burlap) +- [Chernozem](https://github.com/pyrsmk/Chernozem) +- [InDI](https://github.com/idealogica/indi) +- [League/Container](http://container.thephpleague.com/) +- [Mouf](http://mouf-php.com) +- [Picotainer](https://github.com/thecodingmachine/picotainer) +- [PHP-DI](http://php-di.org) +- [PimpleInterop](https://github.com/moufmouf/pimple-interop) +- [Ultra-Lite Container](https://github.com/ultra-lite/container) + +### Middlewares implementing `ContainerInterface` + +- [Alias-Container](https://github.com/thecodingmachine/alias-container): add + aliases support to any container +- [Prefixer-Container](https://github.com/thecodingmachine/prefixer-container): + dynamically prefix identifiers +- [Lazy-Container](https://github.com/snapshotpl/lazy-container): lazy services + +### Projects using `ContainerInterface` + +The list below contains only a sample of all the projects consuming `ContainerInterface`. For a more complete list have a look [here](http://packanalyst.com/class?q=Interop%5CContainer%5CContainerInterface). + +| | Downloads | +| --- | --- | +| [Adroit](https://github.com/bitexpert/adroit) | ![](https://img.shields.io/packagist/dt/bitexpert/adroit.svg) | +| [Behat](https://github.com/Behat/Behat/pull/974) | ![](https://img.shields.io/packagist/dt/behat/behat.svg) | +| [blast-facades](https://github.com/phpthinktank/blast-facades): Minimize complexity and represent dependencies as facades. | ![](https://img.shields.io/packagist/dt/blast/facades.svg) | +| [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di): an extension to [Silex](http://silex.sensiolabs.org/) that adds support for any *container-interop* compatible container | ![](https://img.shields.io/packagist/dt/mouf/interop.silex.di.svg) | +| [mindplay/walkway](https://github.com/mindplay-dk/walkway): a modular request router | ![](https://img.shields.io/packagist/dt/mindplay/walkway.svg) | +| [mindplay/middleman](https://github.com/mindplay-dk/middleman): minimalist PSR-7 middleware dispatcher | ![](https://img.shields.io/packagist/dt/mindplay/middleman.svg) | +| [PHP-DI/Invoker](https://github.com/PHP-DI/Invoker): extensible and configurable invoker/dispatcher | ![](https://img.shields.io/packagist/dt/php-di/invoker.svg) | +| [Prophiler](https://github.com/fabfuel/prophiler) | ![](https://img.shields.io/packagist/dt/fabfuel/prophiler.svg) | +| [Silly](https://github.com/mnapoli/silly): CLI micro-framework | ![](https://img.shields.io/packagist/dt/mnapoli/silly.svg) | +| [Slim v3](https://github.com/slimphp/Slim) | ![](https://img.shields.io/packagist/dt/slim/slim.svg) | +| [Splash](http://mouf-php.com/packages/mouf/mvc.splash-common/version/8.0-dev/README.md) | ![](https://img.shields.io/packagist/dt/mouf/mvc.splash-common.svg) | +| [Woohoo Labs. Harmony](https://github.com/woohoolabs/harmony): a flexible micro-framework | ![](https://img.shields.io/packagist/dt/woohoolabs/harmony.svg) | +| [zend-expressive](https://github.com/zendframework/zend-expressive) | ![](https://img.shields.io/packagist/dt/zendframework/zend-expressive.svg) | + + +## Workflow + +Everyone is welcome to join and contribute. + +The general workflow looks like this: + +1. Someone opens a discussion (GitHub issue) to suggest an interface +1. Feedback is gathered +1. The interface is added to a development branch +1. We release alpha versions so that the interface can be experimented with +1. Discussions and edits ensue until the interface is deemed stable by a general consensus +1. A new minor version of the package is released + +We try to not break BC by creating new interfaces instead of editing existing ones. + +While we currently work on interfaces, we are open to anything that might help towards interoperability, may that +be code, best practices, etc. diff --git a/vendor/container-interop/container-interop/composer.json b/vendor/container-interop/container-interop/composer.json new file mode 100644 index 0000000..855f766 --- /dev/null +++ b/vendor/container-interop/container-interop/composer.json @@ -0,0 +1,15 @@ +{ + "name": "container-interop/container-interop", + "type": "library", + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "license": "MIT", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "require": { + "psr/container": "^1.0" + } +} diff --git a/vendor/container-interop/container-interop/docs/ContainerInterface-meta.md b/vendor/container-interop/container-interop/docs/ContainerInterface-meta.md new file mode 100644 index 0000000..59f3d55 --- /dev/null +++ b/vendor/container-interop/container-interop/docs/ContainerInterface-meta.md @@ -0,0 +1,114 @@ +# ContainerInterface Meta Document + +## Introduction + +This document describes the process and discussions that lead to the `ContainerInterface`. +Its goal is to explain the reasons behind each decision. + +## Goal + +The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a +container to obtain objects and parameters. + +By standardizing such a behavior, frameworks and libraries using the `ContainerInterface` +could work with any compatible container. +That would allow end users to choose their own container based on their own preferences. + +It is important to distinguish the two usages of a container: + +- configuring entries +- fetching entries + +Most of the time, those two sides are not used by the same party. +While it is often end users who tend to configure entries, it is generally the framework that fetch +entries to build the application. + +This is why this interface focuses only on how entries can be fetched from a container. + +## Interface name + +The interface name has been thoroughly discussed and was decided by a vote. + +The list of options considered with their respective votes are: + +- `ContainerInterface`: +8 +- `ProviderInterface`: +2 +- `LocatorInterface`: 0 +- `ReadableContainerInterface`: -5 +- `ServiceLocatorInterface`: -6 +- `ObjectFactory`: -6 +- `ObjectStore`: -8 +- `ConsumerInterface`: -9 + +[Full results of the vote](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote) + +The complete discussion can be read in [the issue #1](https://github.com/container-interop/container-interop/issues/1). + +## Interface methods + +The choice of which methods the interface would contain was made after a statistical analysis of existing containers. +The results of this analysis are available [in this document](https://gist.github.com/mnapoli/6159681). + +The summary of the analysis showed that: + +- all containers offer a method to get an entry by its id +- a large majority name such method `get()` +- for all containers, the `get()` method has 1 mandatory parameter of type string +- some containers have an optional additional argument for `get()`, but it doesn't have the same purpose between containers +- a large majority of the containers offer a method to test if it can return an entry by its id +- a majority name such method `has()` +- for all containers offering `has()`, the method has exactly 1 parameter of type string +- a large majority of the containers throw an exception rather than returning null when an entry is not found in `get()` +- a large majority of the containers don't implement `ArrayAccess` + +The question of whether to include methods to define entries has been discussed in +[issue #1](https://github.com/container-interop/container-interop/issues/1). +It has been judged that such methods do not belong in the interface described here because it is out of its scope +(see the "Goal" section). + +As a result, the `ContainerInterface` contains two methods: + +- `get()`, returning anything, with one mandatory string parameter. Should throw an exception if the entry is not found. +- `has()`, returning a boolean, with one mandatory string parameter. + +### Number of parameters in `get()` method + +While `ContainerInterface` only defines one mandatory parameter in `get()`, it is not incompatible with +existing containers that have additional optional parameters. PHP allows an implementation to offer more parameters +as long as they are optional, because the implementation *does* satisfy the interface. + +This issue has been discussed in [issue #6](https://github.com/container-interop/container-interop/issues/6). + +### Type of the `$id` parameter + +The type of the `$id` parameter in `get()` and `has()` has been discussed in +[issue #6](https://github.com/container-interop/container-interop/issues/6). +While `string` is used in all the containers that were analyzed, it was suggested that allowing +anything (such as objects) could allow containers to offer a more advanced query API. + +An example given was to use the container as an object builder. The `$id` parameter would then be an +object that would describe how to create an instance. + +The conclusion of the discussion was that this was beyond the scope of getting entries from a container without +knowing how the container provided them, and it was more fit for a factory. + +## Contributors + +Are listed here all people that contributed in the discussions or votes, by alphabetical order: + +- [Amy Stephen](https://github.com/AmyStephen) +- [David Négrier](https://github.com/moufmouf) +- [Don Gilbert](https://github.com/dongilbert) +- [Jason Judge](https://github.com/judgej) +- [Jeremy Lindblom](https://github.com/jeremeamia) +- [Marco Pivetta](https://github.com/Ocramius) +- [Matthieu Napoli](https://github.com/mnapoli) +- [Paul M. Jones](https://github.com/pmjones) +- [Stephan Hochdörfer](https://github.com/shochdoerfer) +- [Taylor Otwell](https://github.com/taylorotwell) + +## Relevant links + +- [`ContainerInterface.php`](https://github.com/container-interop/container-interop/blob/master/src/Interop/Container/ContainerInterface.php) +- [List of all issues](https://github.com/container-interop/container-interop/issues?labels=ContainerInterface&milestone=&page=1&state=closed) +- [Vote for the interface name](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote) diff --git a/vendor/container-interop/container-interop/docs/ContainerInterface.md b/vendor/container-interop/container-interop/docs/ContainerInterface.md new file mode 100644 index 0000000..bda973d --- /dev/null +++ b/vendor/container-interop/container-interop/docs/ContainerInterface.md @@ -0,0 +1,158 @@ +Container interface +=================== + +This document describes a common interface for dependency injection containers. + +The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a +container to obtain objects and parameters (called *entries* in the rest of this document). + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", +"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be +interpreted as described in [RFC 2119][]. + +The word `implementor` in this document is to be interpreted as someone +implementing the `ContainerInterface` in a dependency injection-related library or framework. +Users of dependency injections containers (DIC) are referred to as `user`. + +[RFC 2119]: http://tools.ietf.org/html/rfc2119 + +1. Specification +----------------- + +### 1.1 Basics + +- The `Interop\Container\ContainerInterface` exposes two methods : `get` and `has`. + +- `get` takes one mandatory parameter: an entry identifier. It MUST be a string. + A call to `get` can return anything (a *mixed* value), or throws an exception if the identifier + is not known to the container. Two successive calls to `get` with the same + identifier SHOULD return the same value. However, depending on the `implementor` + design and/or `user` configuration, different values might be returned, so + `user` SHOULD NOT rely on getting the same value on 2 successive calls. + While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations + MAY accept additional optional parameters. + +- `has` takes one unique parameter: an entry identifier. It MUST return `true` + if an entry identifier is known to the container and `false` if it is not. + `has($id)` returning true does not mean that `get($id)` will not throw an exception. + It does however mean that `get($id)` will not throw a `NotFoundException`. + +### 1.2 Exceptions + +Exceptions directly thrown by the container MUST implement the +[`Interop\Container\Exception\ContainerException`](../src/Interop/Container/Exception/ContainerException.php). + +A call to the `get` method with a non-existing id SHOULD throw a +[`Interop\Container\Exception\NotFoundException`](../src/Interop/Container/Exception/NotFoundException.php). + +### 1.3 Additional features + +This section describes additional features that MAY be added to a container. Containers are not +required to implement these features to respect the ContainerInterface. + +#### 1.3.1 Delegate lookup feature + +The goal of the *delegate lookup* feature is to allow several containers to share entries. +Containers implementing this feature can perform dependency lookups in other containers. + +Containers implementing this feature will offer a greater lever of interoperability +with other containers. Implementation of this feature is therefore RECOMMENDED. + +A container implementing this feature: + +- MUST implement the `ContainerInterface` +- MUST provide a way to register a delegate container (using a constructor parameter, or a setter, + or any possible way). The delegate container MUST implement the `ContainerInterface`. + +When a container is configured to use a delegate container for dependencies: + +- Calls to the `get` method should only return an entry if the entry is part of the container. + If the entry is not part of the container, an exception should be thrown + (as requested by the `ContainerInterface`). +- Calls to the `has` method should only return `true` if the entry is part of the container. + If the entry is not part of the container, `false` should be returned. +- If the fetched entry has dependencies, **instead** of performing + the dependency lookup in the container, the lookup is performed on the *delegate container*. + +Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself. + +It is however allowed for containers to provide exception cases for special entries, and a way to lookup +into the same container (or another container) instead of the delegate container. + +2. Package +---------- + +The interfaces and classes described as well as relevant exception are provided as part of the +[container-interop/container-interop](https://packagist.org/packages/container-interop/container-interop) package. + +3. `Interop\Container\ContainerInterface` +----------------------------------------- + +```php +setParentContainer($this); + } + } + ... + } +} + +``` + +**Cons:** + +Cons have been extensively discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777). +Basically, forcing a setter into an interface is a bad idea. Setters are similar to constructor arguments, +and it's a bad idea to standardize a constructor: how the delegate container is configured into a container is an implementation detail. This outweights the benefits of the interface. + +### 4.4 Alternative: no exception case for delegate lookups + +Originally, the proposed wording for delegate lookup calls was: + +> Important! The lookup MUST be performed on the delegate container **only**, not on the container itself. + +This was later replaced by: + +> Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself. +> +> It is however allowed for containers to provide exception cases for special entries, and a way to lookup +> into the same container (or another container) instead of the delegate container. + +Exception cases have been allowed to avoid breaking dependencies with some services that must be provided +by the container (on @njasm proposal). This was proposed here: https://github.com/container-interop/container-interop/pull/20#issuecomment-56597235 + +### 4.5 Alternative: having one of the containers act as the composite container + +In real-life scenarios, we usually have a big framework (Symfony 2, Zend Framework 2, etc...) and we want to +add another DI container to this container. Most of the time, the "big" framework will be responsible for +creating the controller's instances, using it's own DI container. Until *container-interop* is fully adopted, +the "big" framework will not be aware of the existence of a composite container that it should use instead +of its own container. + +For this real-life use cases, @mnapoli and @moufmouf proposed to extend the "big" framework's DI container +to make it act as a composite container. + +This has been discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-40367194) +and [here](http://mouf-php.com/container-interop-whats-next#solution4). + +This was implemented in Symfony 2 using: + +- [interop.symfony.di](https://github.com/thecodingmachine/interop.symfony.di/tree/v0.1.0) +- [framework interop](https://github.com/mnapoli/framework-interop/) + +This was implemented in Silex using: + +- [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di) + +Having a container act as the composite container is not part of the delegate lookup standard because it is +simply a temporary design pattern used to make existing frameworks that do not support yet ContainerInterop +play nice with other DI containers. + + +5. Implementations +------------------ + +The following projects already implement the delegate lookup feature: + +- [Mouf](http://mouf-php.com), through the [`setDelegateLookupContainer` method](https://github.com/thecodingmachine/mouf/blob/2.0/src/Mouf/MoufManager.php#L2120) +- [PHP-DI](http://php-di.org/), through the [`$wrapperContainer` parameter of the constructor](https://github.com/mnapoli/PHP-DI/blob/master/src/DI/Container.php#L72) +- [pimple-interop](https://github.com/moufmouf/pimple-interop), through the [`$container` parameter of the constructor](https://github.com/moufmouf/pimple-interop/blob/master/src/Interop/Container/Pimple/PimpleInterop.php#L62) + +6. People +--------- + +Are listed here all people that contributed in the discussions, by alphabetical order: + +- [Alexandru Pătrănescu](https://github.com/drealecs) +- [Ben Peachey](https://github.com/potherca) +- [David Négrier](https://github.com/moufmouf) +- [Jeremy Lindblom](https://github.com/jeremeamia) +- [Marco Pivetta](https://github.com/Ocramius) +- [Matthieu Napoli](https://github.com/mnapoli) +- [Nelson J Morais](https://github.com/njasm) +- [Phil Sturgeon](https://github.com/philsturgeon) +- [Stephan Hochdörfer](https://github.com/shochdoerfer) + +7. Relevant Links +----------------- + +_**Note:** Order descending chronologically._ + +- [Pull request on the delegate lookup feature](https://github.com/container-interop/container-interop/pull/20) +- [Pull request on the interface idea](https://github.com/container-interop/container-interop/pull/8) +- [Original article exposing the delegate lookup idea along many others](http://mouf-php.com/container-interop-whats-next) + diff --git a/vendor/container-interop/container-interop/docs/Delegate-lookup.md b/vendor/container-interop/container-interop/docs/Delegate-lookup.md new file mode 100644 index 0000000..f64a8f7 --- /dev/null +++ b/vendor/container-interop/container-interop/docs/Delegate-lookup.md @@ -0,0 +1,60 @@ +Delegate lookup feature +======================= + +This document describes a standard for dependency injection containers. + +The goal set by the *delegate lookup* feature is to allow several containers to share entries. +Containers implementing this feature can perform dependency lookups in other containers. + +Containers implementing this feature will offer a greater lever of interoperability +with other containers. Implementation of this feature is therefore RECOMMENDED. + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", +"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be +interpreted as described in [RFC 2119][]. + +The word `implementor` in this document is to be interpreted as someone +implementing the delegate lookup feature in a dependency injection-related library or framework. +Users of dependency injections containers (DIC) are referred to as `user`. + +[RFC 2119]: http://tools.ietf.org/html/rfc2119 + +1. Vocabulary +------------- + +In a dependency injection container, the container is used to fetch entries. +Entries can have dependencies on other entries. Usually, these other entries are fetched by the container. + +The *delegate lookup* feature is the ability for a container to fetch dependencies in +another container. In the rest of the document, the word "container" will reference the container +implemented by the implementor. The word "delegate container" will reference the container we are +fetching the dependencies from. + +2. Specification +---------------- + +A container implementing the *delegate lookup* feature: + +- MUST implement the [`ContainerInterface`](ContainerInterface.md) +- MUST provide a way to register a delegate container (using a constructor parameter, or a setter, + or any possible way). The delegate container MUST implement the [`ContainerInterface`](ContainerInterface.md). + +When a container is configured to use a delegate container for dependencies: + +- Calls to the `get` method should only return an entry if the entry is part of the container. + If the entry is not part of the container, an exception should be thrown + (as requested by the [`ContainerInterface`](ContainerInterface.md)). +- Calls to the `has` method should only return `true` if the entry is part of the container. + If the entry is not part of the container, `false` should be returned. +- If the fetched entry has dependencies, **instead** of performing + the dependency lookup in the container, the lookup is performed on the *delegate container*. + +Important: By default, the dependency lookups SHOULD be performed on the delegate container **only**, not on the container itself. + +It is however allowed for containers to provide exception cases for special entries, and a way to lookup +into the same container (or another container) instead of the delegate container. + +3. Package / Interface +---------------------- + +This feature is not tied to any code, interface or package. diff --git a/vendor/container-interop/container-interop/docs/images/interoperating_containers.png b/vendor/container-interop/container-interop/docs/images/interoperating_containers.png new file mode 100644 index 0000000..1d3fdd0 Binary files /dev/null and b/vendor/container-interop/container-interop/docs/images/interoperating_containers.png differ diff --git a/vendor/container-interop/container-interop/docs/images/priority.png b/vendor/container-interop/container-interop/docs/images/priority.png new file mode 100644 index 0000000..d02cb7d Binary files /dev/null and b/vendor/container-interop/container-interop/docs/images/priority.png differ diff --git a/vendor/container-interop/container-interop/docs/images/side_by_side_containers.png b/vendor/container-interop/container-interop/docs/images/side_by_side_containers.png new file mode 100644 index 0000000..87884bc Binary files /dev/null and b/vendor/container-interop/container-interop/docs/images/side_by_side_containers.png differ diff --git a/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php b/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php new file mode 100644 index 0000000..a75468f --- /dev/null +++ b/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php @@ -0,0 +1,15 @@ +> ./tests/travis/php.ini ;fi" + - composer self-update + - composer --prefer-source --dev install + - sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then phpenv config-add ./tests/travis/php.ini; fi" + +script: + - ./vendor/bin/phpunit -c ./tests/travis/phpunit.travis.xml -v + +after_script: + - php vendor/bin/coveralls -v + +matrix: + allow_failures: + - php: hhvm diff --git a/vendor/doctrine/cache/LICENSE b/vendor/doctrine/cache/LICENSE new file mode 100644 index 0000000..4a91f0b --- /dev/null +++ b/vendor/doctrine/cache/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2012 Doctrine Project + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/doctrine/cache/README.md b/vendor/doctrine/cache/README.md new file mode 100644 index 0000000..94f80a3 --- /dev/null +++ b/vendor/doctrine/cache/README.md @@ -0,0 +1,14 @@ +# Doctrine Cache + +Master: [![Build Status](https://secure.travis-ci.org/doctrine/cache.png?branch=master)](http://travis-ci.org/doctrine/cache) [![Coverage Status](https://coveralls.io/repos/doctrine/cache/badge.png?branch=master)](https://coveralls.io/r/doctrine/cache?branch=master) + +[![Latest Stable Version](https://poser.pugx.org/doctrine/cache/v/stable.png)](https://packagist.org/packages/doctrine/cache) [![Total Downloads](https://poser.pugx.org/doctrine/cache/downloads.png)](https://packagist.org/packages/doctrine/cache) + +Cache component extracted from the Doctrine Common project. + +## Changelog + +### v1.2 + +* Added support for MongoDB as Cache Provider +* Fix namespace version reset diff --git a/vendor/doctrine/cache/UPGRADE.md b/vendor/doctrine/cache/UPGRADE.md new file mode 100644 index 0000000..e1f8a50 --- /dev/null +++ b/vendor/doctrine/cache/UPGRADE.md @@ -0,0 +1,16 @@ +# Upgrade to 1.4 + +## Minor BC Break: `Doctrine\Common\Cache\FileCache#$extension` is now `private`. + +If you need to override the value of `Doctrine\Common\Cache\FileCache#$extension`, then use the +second parameter of `Doctrine\Common\Cache\FileCache#__construct()` instead of overriding +the property in your own implementation. + +## Minor BC Break: file based caches paths changed + +`Doctrine\Common\Cache\FileCache`, `Doctrine\Common\Cache\PhpFileCache` and +`Doctrine\Common\Cache\FilesystemCache` are using a different cache paths structure. + +If you rely on warmed up caches for deployments, consider that caches generated +with `doctrine/cache` `<1.4` are not compatible with the new directory structure, +and will be ignored. diff --git a/vendor/doctrine/cache/build.properties b/vendor/doctrine/cache/build.properties new file mode 100644 index 0000000..2d98c36 --- /dev/null +++ b/vendor/doctrine/cache/build.properties @@ -0,0 +1,3 @@ +# Version class and file +project.version_class = Doctrine\\Common\\Cache\\Version +project.version_file = lib/Doctrine/Common/Cache/Version.php diff --git a/vendor/doctrine/cache/build.xml b/vendor/doctrine/cache/build.xml new file mode 100644 index 0000000..a7c52e3 --- /dev/null +++ b/vendor/doctrine/cache/build.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/doctrine/cache/composer.json b/vendor/doctrine/cache/composer.json new file mode 100644 index 0000000..ee7ab07 --- /dev/null +++ b/vendor/doctrine/cache/composer.json @@ -0,0 +1,34 @@ +{ + "name": "doctrine/cache", + "type": "library", + "description": "Caching library offering an object-oriented API for many cache backends", + "keywords": ["cache", "caching"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "satooshi/php-coveralls": "~0.6", + "predis/predis": "~0.8" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Cache\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php new file mode 100644 index 0000000..abd5e71 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php @@ -0,0 +1,106 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * APC cache provider. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class ApcCache extends CacheProvider +{ + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return apc_fetch($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return apc_exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + return (bool) apc_store($id, $data, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return apc_delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return apc_clear_cache() && apc_clear_cache('user'); + } + + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + return apc_fetch($keys); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = apc_cache_info('', true); + $sma = apc_sma_info(); + + // @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42 + if (PHP_VERSION_ID >= 50500) { + $info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits']; + $info['num_misses'] = isset($info['num_misses']) ? $info['num_misses'] : $info['nmisses']; + $info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime']; + } + + return array( + Cache::STATS_HITS => $info['num_hits'], + Cache::STATS_MISSES => $info['num_misses'], + Cache::STATS_UPTIME => $info['start_time'], + Cache::STATS_MEMORY_USAGE => $info['mem_size'], + Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php new file mode 100644 index 0000000..31a0729 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php @@ -0,0 +1,94 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Array cache driver. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class ArrayCache extends CacheProvider +{ + /** + * @var array $data + */ + private $data = array(); + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->doContains($id) ? $this->data[$id] : false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + // isset() is required for performance optimizations, to avoid unnecessary function calls to array_key_exists. + return isset($this->data[$id]) || array_key_exists($id, $this->data); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $this->data[$id] = $data; + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + unset($this->data[$id]); + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $this->data = array(); + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + return null; + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php new file mode 100644 index 0000000..205a123 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php @@ -0,0 +1,112 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache drivers. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Fabio B. Silva + * @author Kévin Dunglas + */ +interface Cache +{ + const STATS_HITS = 'hits'; + const STATS_MISSES = 'misses'; + const STATS_UPTIME = 'uptime'; + const STATS_MEMORY_USAGE = 'memory_usage'; + const STATS_MEMORY_AVAILABLE = 'memory_available'; + /** + * Only for backward compatibility (may be removed in next major release) + * + * @deprecated + */ + const STATS_MEMORY_AVAILIABLE = 'memory_available'; + + /** + * Fetches an entry from the cache. + * + * @param string $id The id of the cache entry to fetch. + * + * @return mixed The cached data or FALSE, if no cache entry exists for the given id. + */ + public function fetch($id); + + /** + * Tests if an entry exists in the cache. + * + * @param string $id The cache id of the entry to check for. + * + * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise. + */ + public function contains($id); + + /** + * Puts data into the cache. + * + * @param string $id The cache id. + * @param mixed $data The cache entry/data. + * @param int $lifeTime The cache lifetime. + * If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime). + * + * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. + */ + public function save($id, $data, $lifeTime = 0); + + /** + * Deletes a cache entry. + * + * @param string $id The cache id. + * + * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. + */ + public function delete($id); + + /** + * Retrieves cached information from the data store. + * + * The server's statistics array has the following values: + * + * - hits + * Number of keys that have been requested and found present. + * + * - misses + * Number of items that have been requested and not found. + * + * - uptime + * Time that the server is running. + * + * - memory_usage + * Memory used by this server to store items. + * + * - memory_available + * Memory allowed to use for storage. + * + * @since 2.2 + * + * @return array|null An associative array with server's statistics if available, NULL otherwise. + */ + public function getStats(); +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php new file mode 100644 index 0000000..d7e9443 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php @@ -0,0 +1,277 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Base class for cache provider implementations. + * + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Fabio B. Silva + */ +abstract class CacheProvider implements Cache, FlushableCache, ClearableCache, MultiGetCache +{ + const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'; + + /** + * The namespace to prefix all cache ids with. + * + * @var string + */ + private $namespace = ''; + + /** + * The namespace version. + * + * @var integer|null + */ + private $namespaceVersion; + + /** + * Sets the namespace to prefix all cache ids with. + * + * @param string $namespace + * + * @return void + */ + public function setNamespace($namespace) + { + $this->namespace = (string) $namespace; + $this->namespaceVersion = null; + } + + /** + * Retrieves the namespace that prefixes all cache ids. + * + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * {@inheritdoc} + */ + public function fetch($id) + { + return $this->doFetch($this->getNamespacedId($id)); + } + + /** + * {@inheritdoc} + */ + public function fetchMultiple(array $keys) + { + // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys + $namespacedKeys = array_combine($keys, array_map(array($this, 'getNamespacedId'), $keys)); + $items = $this->doFetchMultiple($namespacedKeys); + $foundItems = array(); + + // no internal array function supports this sort of mapping: needs to be iterative + // this filters and combines keys in one pass + foreach ($namespacedKeys as $requestedKey => $namespacedKey) { + if (isset($items[$namespacedKey])) { + $foundItems[$requestedKey] = $items[$namespacedKey]; + } + } + + return $foundItems; + } + + /** + * {@inheritdoc} + */ + public function contains($id) + { + return $this->doContains($this->getNamespacedId($id)); + } + + /** + * {@inheritdoc} + */ + public function save($id, $data, $lifeTime = 0) + { + return $this->doSave($this->getNamespacedId($id), $data, $lifeTime); + } + + /** + * {@inheritdoc} + */ + public function delete($id) + { + return $this->doDelete($this->getNamespacedId($id)); + } + + /** + * {@inheritdoc} + */ + public function getStats() + { + return $this->doGetStats(); + } + + /** + * {@inheritDoc} + */ + public function flushAll() + { + return $this->doFlush(); + } + + /** + * {@inheritDoc} + */ + public function deleteAll() + { + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->getNamespaceVersion() + 1; + + $this->namespaceVersion = $namespaceVersion; + + return $this->doSave($namespaceCacheKey, $namespaceVersion); + } + + /** + * Prefixes the passed id with the configured namespace value. + * + * @param string $id The id to namespace. + * + * @return string The namespaced id. + */ + private function getNamespacedId($id) + { + $namespaceVersion = $this->getNamespaceVersion(); + + return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); + } + + /** + * Returns the namespace cache key. + * + * @return string + */ + private function getNamespaceCacheKey() + { + return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); + } + + /** + * Returns the namespace version. + * + * @return integer + */ + private function getNamespaceVersion() + { + if (null !== $this->namespaceVersion) { + return $this->namespaceVersion; + } + + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->doFetch($namespaceCacheKey); + + if (false === $namespaceVersion) { + $namespaceVersion = 1; + + $this->doSave($namespaceCacheKey, $namespaceVersion); + } + + $this->namespaceVersion = $namespaceVersion; + + return $this->namespaceVersion; + } + + /** + * Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it. + * + * @param array $keys Array of keys to retrieve from cache + * @return array Array of values retrieved for the given keys. + */ + protected function doFetchMultiple(array $keys) + { + $returnValues = array(); + + foreach ($keys as $index => $key) { + if (false !== ($item = $this->doFetch($key))) { + $returnValues[$key] = $item; + } + } + + return $returnValues; + } + + /** + * Fetches an entry from the cache. + * + * @param string $id The id of the cache entry to fetch. + * + * @return string|boolean The cached data or FALSE, if no cache entry exists for the given id. + */ + abstract protected function doFetch($id); + + /** + * Tests if an entry exists in the cache. + * + * @param string $id The cache id of the entry to check for. + * + * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise. + */ + abstract protected function doContains($id); + + /** + * Puts data into the cache. + * + * @param string $id The cache id. + * @param string $data The cache entry/data. + * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this + * cache entry (0 => infinite lifeTime). + * + * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. + */ + abstract protected function doSave($id, $data, $lifeTime = 0); + + /** + * Deletes a cache entry. + * + * @param string $id The cache id. + * + * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. + */ + abstract protected function doDelete($id); + + /** + * Flushes all cache entries. + * + * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. + */ + abstract protected function doFlush(); + + /** + * Retrieves cached information from the data store. + * + * @since 2.2 + * + * @return array|null An associative array with server's statistics if available, NULL otherwise. + */ + abstract protected function doGetStats(); +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php new file mode 100644 index 0000000..3b18c7b --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php @@ -0,0 +1,147 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Cache provider that allows to easily chain multiple cache providers + * + * @author Michaël Gallego + */ +class ChainCache extends CacheProvider +{ + /** + * @var CacheProvider[] + */ + private $cacheProviders = array(); + + /** + * Constructor + * + * @param CacheProvider[] $cacheProviders + */ + public function __construct($cacheProviders = array()) + { + $this->cacheProviders = $cacheProviders; + } + + /** + * {@inheritDoc} + */ + public function setNamespace($namespace) + { + parent::setNamespace($namespace); + + foreach ($this->cacheProviders as $cacheProvider) { + $cacheProvider->setNamespace($namespace); + } + } + + /** + * {@inheritDoc} + */ + protected function doFetch($id) + { + foreach ($this->cacheProviders as $key => $cacheProvider) { + if ($cacheProvider->doContains($id)) { + $value = $cacheProvider->doFetch($id); + + // We populate all the previous cache layers (that are assumed to be faster) + for ($subKey = $key - 1 ; $subKey >= 0 ; $subKey--) { + $this->cacheProviders[$subKey]->doSave($id, $value); + } + + return $value; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + protected function doContains($id) + { + foreach ($this->cacheProviders as $cacheProvider) { + if ($cacheProvider->doContains($id)) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $stored = true; + + foreach ($this->cacheProviders as $cacheProvider) { + $stored = $cacheProvider->doSave($id, $data, $lifeTime) && $stored; + } + + return $stored; + } + + /** + * {@inheritDoc} + */ + protected function doDelete($id) + { + $deleted = false; + + foreach ($this->cacheProviders as $cacheProvider) { + $deleted = $deleted || $cacheProvider->doDelete($id); + } + + return $deleted; + } + + /** + * {@inheritDoc} + */ + protected function doFlush() + { + $flushed = true; + + foreach ($this->cacheProviders as $cacheProvider) { + $flushed = $cacheProvider->doFlush() && $flushed; + } + + return $flushed; + } + + /** + * {@inheritDoc} + */ + protected function doGetStats() + { + // We return all the stats from all adapters + $stats = array(); + + foreach ($this->cacheProviders as $cacheProvider) { + $stats[] = $cacheProvider->doGetStats(); + } + + return $stats; + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php new file mode 100644 index 0000000..f8b0161 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php @@ -0,0 +1,37 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache that can be flushed. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Adirelle + */ +interface ClearableCache +{ + /** + * Deletes all cache entries. + * + * @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise. + */ + public function deleteAll(); +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php new file mode 100644 index 0000000..c21691d --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php @@ -0,0 +1,121 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use \Couchbase; + +/** + * Couchbase cache provider. + * + * @link www.doctrine-project.org + * @since 2.4 + * @author Michael Nitschinger + */ +class CouchbaseCache extends CacheProvider +{ + /** + * @var Couchbase|null + */ + private $couchbase; + + /** + * Sets the Couchbase instance to use. + * + * @param Couchbase $couchbase + * + * @return void + */ + public function setCouchbase(Couchbase $couchbase) + { + $this->couchbase = $couchbase; + } + + /** + * Gets the Couchbase instance used by the cache. + * + * @return Couchbase|null + */ + public function getCouchbase() + { + return $this->couchbase; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->couchbase->get($id) ?: false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (null !== $this->couchbase->get($id)); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 30 * 24 * 3600) { + $lifeTime = time() + $lifeTime; + } + return $this->couchbase->set($id, $data, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->couchbase->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->couchbase->flush(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $stats = $this->couchbase->getStats(); + $servers = $this->couchbase->getServers(); + $server = explode(":", $servers[0]); + $key = $server[0] . ":" . "11210"; + $stats = $stats[$key]; + return array( + Cache::STATS_HITS => $stats['get_hits'], + Cache::STATS_MISSES => $stats['get_misses'], + Cache::STATS_UPTIME => $stats['uptime'], + Cache::STATS_MEMORY_USAGE => $stats['bytes'], + Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php new file mode 100644 index 0000000..243c28c --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php @@ -0,0 +1,223 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Base file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +abstract class FileCache extends CacheProvider +{ + /** + * The cache directory. + * + * @var string + */ + protected $directory; + + /** + * The cache file extension. + * + * @var string + */ + private $extension; + + /** + * @var string[] regular expressions for replacing disallowed characters in file name + */ + private $disallowedCharacterPatterns = array( + '/\-/', // replaced to disambiguate original `-` and `-` derived from replacements + '/[^a-zA-Z0-9\-_\[\]]/' // also excludes non-ascii chars (not supported, depending on FS) + ); + + /** + * @var string[] replacements for disallowed file characters + */ + private $replacementCharacters = array('__', '-'); + + /** + * Constructor. + * + * @param string $directory The cache directory. + * @param string $extension The cache file extension. + * + * @throws \InvalidArgumentException + */ + public function __construct($directory, $extension = '') + { + if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" does not exist and could not be created.', + $directory + )); + } + + if ( ! is_writable($directory)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" is not writable.', + $directory + )); + } + + $this->directory = realpath($directory); + $this->extension = (string) $extension; + } + + /** + * Gets the cache directory. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Gets the cache file extension. + * + * @return string|null + */ + public function getExtension() + { + return $this->extension; + } + + /** + * @param string $id + * + * @return string + */ + protected function getFilename($id) + { + return $this->directory + . DIRECTORY_SEPARATOR + . implode(str_split(hash('sha256', $id), 2), DIRECTORY_SEPARATOR) + . DIRECTORY_SEPARATOR + . preg_replace($this->disallowedCharacterPatterns, $this->replacementCharacters, $id) + . $this->extension; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return @unlink($this->getFilename($id)); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + foreach ($this->getIterator() as $name => $file) { + @unlink($name); + } + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $usage = 0; + foreach ($this->getIterator() as $file) { + $usage += $file->getSize(); + } + + $free = disk_free_space($this->directory); + + return array( + Cache::STATS_HITS => null, + Cache::STATS_MISSES => null, + Cache::STATS_UPTIME => null, + Cache::STATS_MEMORY_USAGE => $usage, + Cache::STATS_MEMORY_AVAILABLE => $free, + ); + } + + /** + * Create path if needed. + * + * @param string $path + * @return bool TRUE on success or if path already exists, FALSE if path cannot be created. + */ + private function createPathIfNeeded($path) + { + if ( ! is_dir($path)) { + if (false === @mkdir($path, 0777, true) && !is_dir($path)) { + return false; + } + } + + return true; + } + + /** + * Writes a string content to file in an atomic way. + * + * @param string $filename Path to the file where to write the data. + * @param string $content The content to write + * + * @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error. + */ + protected function writeFile($filename, $content) + { + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! $this->createPathIfNeeded($filepath)) { + return false; + } + + if ( ! is_writable($filepath)) { + return false; + } + + $tmpFile = tempnam($filepath, 'swap'); + + if (file_put_contents($tmpFile, $content) !== false) { + if (@rename($tmpFile, $filename)) { + @chmod($filename, 0666 & ~umask()); + + return true; + } + + @unlink($tmpFile); + } + + return false; + } + + /** + * @return \Iterator + */ + private function getIterator() + { + return new \RegexIterator( + new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory)), + '/^.+' . preg_quote($this->extension, '/') . '$/i' + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php new file mode 100644 index 0000000..6b44aa0 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -0,0 +1,111 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Filesystem cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +class FilesystemCache extends FileCache +{ + const EXTENSION = '.doctrinecache.data'; + + /** + * {@inheritdoc} + */ + public function __construct($directory, $extension = self::EXTENSION) + { + parent::__construct($directory, $extension); + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $data = ''; + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! is_file($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + if ($lifetime !== 0 && $lifetime < time()) { + fclose($resource); + + return false; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + fclose($resource); + + return unserialize($data); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! is_file($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + fclose($resource); + + return $lifetime === 0 || $lifetime > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + $data = serialize($data); + $filename = $this->getFilename($id); + + return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php new file mode 100644 index 0000000..817cee7 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php @@ -0,0 +1,37 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache that can be flushed. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Adirelle + */ +interface FlushableCache +{ + /** + * Flushes all cache entries. + * + * @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. + */ + public function flushAll(); +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php new file mode 100644 index 0000000..f839a65 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php @@ -0,0 +1,121 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use \Memcache; + +/** + * Memcache cache provider. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class MemcacheCache extends CacheProvider +{ + /** + * @var Memcache|null + */ + private $memcache; + + /** + * Sets the memcache instance to use. + * + * @param Memcache $memcache + * + * @return void + */ + public function setMemcache(Memcache $memcache) + { + $this->memcache = $memcache; + } + + /** + * Gets the memcache instance used by the cache. + * + * @return Memcache|null + */ + public function getMemcache() + { + return $this->memcache; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->memcache->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (bool) $this->memcache->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 30 * 24 * 3600) { + $lifeTime = time() + $lifeTime; + } + return $this->memcache->set($id, $data, 0, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->memcache->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->memcache->flush(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $stats = $this->memcache->getStats(); + return array( + Cache::STATS_HITS => $stats['get_hits'], + Cache::STATS_MISSES => $stats['get_misses'], + Cache::STATS_UPTIME => $stats['uptime'], + Cache::STATS_MEMORY_USAGE => $stats['bytes'], + Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php new file mode 100644 index 0000000..040c26c --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -0,0 +1,132 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use \Memcached; + +/** + * Memcached cache provider. + * + * @link www.doctrine-project.org + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class MemcachedCache extends CacheProvider +{ + /** + * @var Memcached|null + */ + private $memcached; + + /** + * Sets the memcache instance to use. + * + * @param Memcached $memcached + * + * @return void + */ + public function setMemcached(Memcached $memcached) + { + $this->memcached = $memcached; + } + + /** + * Gets the memcached instance used by the cache. + * + * @return Memcached|null + */ + public function getMemcached() + { + return $this->memcached; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->memcached->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doFetchMultiple(array $keys) + { + return $this->memcached->getMulti($keys); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (false !== $this->memcached->get($id)); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 30 * 24 * 3600) { + $lifeTime = time() + $lifeTime; + } + return $this->memcached->set($id, $data, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->memcached->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->memcached->flush(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $stats = $this->memcached->getStats(); + $servers = $this->memcached->getServerList(); + $key = $servers[0]['host'] . ':' . $servers[0]['port']; + $stats = $stats[$key]; + return array( + Cache::STATS_HITS => $stats['get_hits'], + Cache::STATS_MISSES => $stats['get_misses'], + Cache::STATS_UPTIME => $stats['uptime'], + Cache::STATS_MEMORY_USAGE => $stats['bytes'], + Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php new file mode 100644 index 0000000..0c7ac0a --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php @@ -0,0 +1,191 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use MongoBinData; +use MongoCollection; +use MongoDate; + +/** + * MongoDB cache provider. + * + * @since 1.1 + * @author Jeremy Mikola + */ +class MongoDBCache extends CacheProvider +{ + /** + * The data field will store the serialized PHP value. + */ + const DATA_FIELD = 'd'; + + /** + * The expiration field will store a MongoDate value indicating when the + * cache entry should expire. + * + * With MongoDB 2.2+, entries can be automatically deleted by MongoDB by + * indexing this field wit the "expireAfterSeconds" option equal to zero. + * This will direct MongoDB to regularly query for and delete any entries + * whose date is older than the current time. Entries without a date value + * in this field will be ignored. + * + * The cache provider will also check dates on its own, in case expired + * entries are fetched before MongoDB's TTLMonitor pass can expire them. + * + * @see http://docs.mongodb.org/manual/tutorial/expire-data/ + */ + const EXPIRATION_FIELD = 'e'; + + /** + * @var MongoCollection + */ + private $collection; + + /** + * Constructor. + * + * This provider will default to the write concern and read preference + * options set on the MongoCollection instance (or inherited from MongoDB or + * MongoClient). Using an unacknowledged write concern (< 1) may make the + * return values of delete() and save() unreliable. Reading from secondaries + * may make contain() and fetch() unreliable. + * + * @see http://www.php.net/manual/en/mongo.readpreferences.php + * @see http://www.php.net/manual/en/mongo.writeconcerns.php + * @param MongoCollection $collection + */ + public function __construct(MongoCollection $collection) + { + $this->collection = $collection; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $document = $this->collection->findOne(array('_id' => $id), array(self::DATA_FIELD, self::EXPIRATION_FIELD)); + + if ($document === null) { + return false; + } + + if ($this->isExpired($document)) { + $this->doDelete($id); + return false; + } + + return unserialize($document[self::DATA_FIELD]->bin); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $document = $this->collection->findOne(array('_id' => $id), array(self::EXPIRATION_FIELD)); + + if ($document === null) { + return false; + } + + if ($this->isExpired($document)) { + $this->doDelete($id); + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $result = $this->collection->update( + array('_id' => $id), + array('$set' => array( + self::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null), + self::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY), + )), + array('upsert' => true, 'multiple' => false) + ); + + return isset($result['ok']) ? $result['ok'] == 1 : true; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + $result = $this->collection->remove(array('_id' => $id)); + + return isset($result['n']) ? $result['n'] == 1 : true; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + // Use remove() in lieu of drop() to maintain any collection indexes + $result = $this->collection->remove(); + + return isset($result['ok']) ? $result['ok'] == 1 : true; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $serverStatus = $this->collection->db->command(array( + 'serverStatus' => 1, + 'locks' => 0, + 'metrics' => 0, + 'recordStats' => 0, + 'repl' => 0, + )); + + $collStats = $this->collection->db->command(array('collStats' => 1)); + + return array( + Cache::STATS_HITS => null, + Cache::STATS_MISSES => null, + Cache::STATS_UPTIME => (isset($serverStatus['uptime']) ? (integer) $serverStatus['uptime'] : null), + Cache::STATS_MEMORY_USAGE => (isset($collStats['size']) ? (integer) $collStats['size'] : null), + Cache::STATS_MEMORY_AVAILABLE => null, + ); + } + + /** + * Check if the document is expired. + * + * @param array $document + * @return boolean + */ + private function isExpired(array $document) + { + return isset($document[self::EXPIRATION_FIELD]) && + $document[self::EXPIRATION_FIELD] instanceof MongoDate && + $document[self::EXPIRATION_FIELD]->sec < time(); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php new file mode 100644 index 0000000..df7146d --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php @@ -0,0 +1,39 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Interface for cache drivers that allows to get many items at once. + * + * @link www.doctrine-project.org + * @since 1.4 + * @author Asmir Mustafic + */ +interface MultiGetCache +{ + /** + * Returns an associative array of values for keys is found in cache. + * + * @param string[] $keys Array of keys to retrieve from cache + * @return mixed[] Array of retrieved values, indexed by the specified keys. + * Values that couldn't be retrieved are not contained in this array. + */ + function fetchMultiple(array $keys); +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php new file mode 100644 index 0000000..bbe766c --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -0,0 +1,109 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Php file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +class PhpFileCache extends FileCache +{ + const EXTENSION = '.doctrinecache.php'; + + /** + * {@inheritdoc} + */ + public function __construct($directory, $extension = self::EXTENSION) + { + parent::__construct($directory, $extension); + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $filename = $this->getFilename($id); + + if ( ! is_file($filename)) { + return false; + } + + $value = include $filename; + + if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { + return false; + } + + return $value['data']; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $filename = $this->getFilename($id); + + if ( ! is_file($filename)) { + return false; + } + + if ( ! is_readable($filename)) { + return false; + } + + $value = include $filename; + + return $value['lifetime'] === 0 || $value['lifetime'] > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + if (is_object($data) && ! method_exists($data, '__set_state')) { + throw new \InvalidArgumentException( + "Invalid argument given, PhpFileCache only allows objects that implement __set_state() " . + "and fully support var_export(). You can use the FilesystemCache to save arbitrary object " . + "graphs using serialize()/deserialize()." + ); + } + + $filename = $this->getFilename($id); + + $value = array( + 'lifetime' => $lifeTime, + 'data' => $data + ); + + $value = var_export($value, true); + $code = sprintf('writeFile($filename, $code); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php new file mode 100644 index 0000000..f2401e6 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php @@ -0,0 +1,97 @@ + + */ +class PredisCache extends CacheProvider +{ + /** + * @var Client + */ + private $client; + + /** + * @param Client $client + * + * @return void + */ + public function __construct(Client $client) + { + $this->client = $client; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $result = $this->client->get($id); + if (null === $result) { + return false; + } + + return $result; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return $this->client->exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $response = $this->client->setex($id, $lifeTime, $data); + } else { + $response = $this->client->set($id, $data); + } + + return $response === true || $response == 'OK'; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->client->del($id) > 0; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $response = $this->client->flushdb(); + + return $response === true || $response == 'OK'; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = $this->client->info(); + + return array( + Cache::STATS_HITS => false, + Cache::STATS_MISSES => false, + Cache::STATS_UPTIME => $info['Server']['uptime_in_seconds'], + Cache::STATS_MEMORY_USAGE => $info['Memory']['used_memory'], + Cache::STATS_MEMORY_AVAILABLE => false + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php new file mode 100644 index 0000000..1643732 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php @@ -0,0 +1,134 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use Redis; + +/** + * Redis cache provider. + * + * @link www.doctrine-project.org + * @since 2.2 + * @author Osman Ungur + */ +class RedisCache extends CacheProvider +{ + /** + * @var Redis|null + */ + private $redis; + + /** + * Sets the redis instance to use. + * + * @param Redis $redis + * + * @return void + */ + public function setRedis(Redis $redis) + { + $redis->setOption(Redis::OPT_SERIALIZER, $this->getSerializerValue()); + $this->redis = $redis; + } + + /** + * Gets the redis instance used by the cache. + * + * @return Redis|null + */ + public function getRedis() + { + return $this->redis; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->redis->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return $this->redis->exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + return $this->redis->setex($id, $lifeTime, $data); + } + + return $this->redis->set($id, $data); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->redis->delete($id) > 0; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->redis->flushDB(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = $this->redis->info(); + return array( + Cache::STATS_HITS => false, + Cache::STATS_MISSES => false, + Cache::STATS_UPTIME => $info['uptime_in_seconds'], + Cache::STATS_MEMORY_USAGE => $info['used_memory'], + Cache::STATS_MEMORY_AVAILABLE => false + ); + } + + /** + * Returns the serializer constant to use. If Redis is compiled with + * igbinary support, that is used. Otherwise the default PHP serializer is + * used. + * + * @return integer One of the Redis::SERIALIZER_* constants + */ + protected function getSerializerValue() + { + if (defined('HHVM_VERSION')) { + return Redis::SERIALIZER_PHP; + } + return defined('Redis::SERIALIZER_IGBINARY') ? Redis::SERIALIZER_IGBINARY : Redis::SERIALIZER_PHP; + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php new file mode 100644 index 0000000..8bb6b4b --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php @@ -0,0 +1,250 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use Riak\Bucket; +use Riak\Connection; +use Riak\Input; +use Riak\Exception; +use Riak\Object; + +/** + * Riak cache provider. + * + * @link www.doctrine-project.org + * @since 1.1 + * @author Guilherme Blanco + */ +class RiakCache extends CacheProvider +{ + const EXPIRES_HEADER = 'X-Riak-Meta-Expires'; + + /** + * @var \Riak\Bucket + */ + private $bucket; + + /** + * Sets the riak bucket instance to use. + * + * @param \Riak\Bucket $bucket + */ + public function __construct(Bucket $bucket) + { + $this->bucket = $bucket; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + try { + $response = $this->bucket->get($id); + + // No objects found + if ( ! $response->hasObject()) { + return false; + } + + // Check for attempted siblings + $object = ($response->hasSiblings()) + ? $this->resolveConflict($id, $response->getVClock(), $response->getObjectList()) + : $response->getFirstObject(); + + // Check for expired object + if ($this->isExpired($object)) { + $this->bucket->delete($object); + + return false; + } + + return unserialize($object->getContent()); + } catch (Exception\RiakException $e) { + // Covers: + // - Riak\ConnectionException + // - Riak\CommunicationException + // - Riak\UnexpectedResponseException + // - Riak\NotFoundException + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + try { + // We only need the HEAD, not the entire object + $input = new Input\GetInput(); + + $input->setReturnHead(true); + + $response = $this->bucket->get($id, $input); + + // No objects found + if ( ! $response->hasObject()) { + return false; + } + + $object = $response->getFirstObject(); + + // Check for expired object + if ($this->isExpired($object)) { + $this->bucket->delete($object); + + return false; + } + + return true; + } catch (Exception\RiakException $e) { + // Do nothing + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + try { + $object = new Object($id); + + $object->setContent(serialize($data)); + + if ($lifeTime > 0) { + $object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime)); + } + + $this->bucket->put($object); + + return true; + } catch (Exception\RiakException $e) { + // Do nothing + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + try { + $this->bucket->delete($id); + + return true; + } catch (Exception\BadArgumentsException $e) { + // Key did not exist on cluster already + } catch (Exception\RiakException $e) { + // Covers: + // - Riak\Exception\ConnectionException + // - Riak\Exception\CommunicationException + // - Riak\Exception\UnexpectedResponseException + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + try { + $keyList = $this->bucket->getKeyList(); + + foreach ($keyList as $key) { + $this->bucket->delete($key); + } + + return true; + } catch (Exception\RiakException $e) { + // Do nothing + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + // Only exposed through HTTP stats API, not Protocol Buffers API + return null; + } + + /** + * Check if a given Riak Object have expired. + * + * @param \Riak\Object $object + * + * @return boolean + */ + private function isExpired(Object $object) + { + $metadataMap = $object->getMetadataMap(); + + return isset($metadataMap[self::EXPIRES_HEADER]) + && $metadataMap[self::EXPIRES_HEADER] < time(); + } + + /** + * On-read conflict resolution. Applied approach here is last write wins. + * Specific needs may override this method to apply alternate conflict resolutions. + * + * {@internal Riak does not attempt to resolve a write conflict, and store + * it as sibling of conflicted one. By following this approach, it is up to + * the next read to resolve the conflict. When this happens, your fetched + * object will have a list of siblings (read as a list of objects). + * In our specific case, we do not care about the intermediate ones since + * they are all the same read from storage, and we do apply a last sibling + * (last write) wins logic. + * If by any means our resolution generates another conflict, it'll up to + * next read to properly solve it.} + * + * @param string $id + * @param string $vClock + * @param array $objectList + * + * @return \Riak\Object + */ + protected function resolveConflict($id, $vClock, array $objectList) + { + // Our approach here is last-write wins + $winner = $objectList[count($objectList)]; + + $putInput = new Input\PutInput(); + $putInput->setVClock($vClock); + + $mergedObject = new Object($id); + $mergedObject->setContent($winner->getContent()); + + $this->bucket->put($mergedObject, $putInput); + + return $mergedObject; + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php new file mode 100644 index 0000000..b7bdb53 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php @@ -0,0 +1,219 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use SQLite3; +use SQLite3Result; + +/** + * SQLite3 cache provider. + * + * @since 1.4 + * @author Jake Bell + */ +class SQLite3Cache extends CacheProvider +{ + /** + * The ID field will store the cache key. + */ + const ID_FIELD = 'k'; + + /** + * The data field will store the serialized PHP value. + */ + const DATA_FIELD = 'd'; + + /** + * The expiration field will store a date value indicating when the + * cache entry should expire. + */ + const EXPIRATION_FIELD = 'e'; + + /** + * @var SQLite3 + */ + private $sqlite; + + /** + * @var string + */ + private $table; + + /** + * Constructor. + * + * Calling the constructor will ensure that the database file and table + * exist and will create both if they don't. + * + * @param SQLite3 $sqlite + * @param string $table + */ + public function __construct(SQLite3 $sqlite, $table) + { + $this->sqlite = $sqlite; + $this->table = (string) $table; + + list($id, $data, $exp) = $this->getFields(); + + return $this->sqlite->exec(sprintf( + 'CREATE TABLE IF NOT EXISTS %s(%s TEXT PRIMARY KEY NOT NULL, %s BLOB, %s INTEGER)', + $table, + $id, + $data, + $exp + )); + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + if ($item = $this->findById($id)) { + return unserialize($item[self::DATA_FIELD]); + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (boolean) $this->findById($id, false); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $statement = $this->sqlite->prepare(sprintf( + 'INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)', + $this->table, + implode(',', $this->getFields()) + )); + + $statement->bindValue(':id', $id); + $statement->bindValue(':data', serialize($data)); + $statement->bindValue(':expire', $lifeTime > 0 ? time() + $lifeTime : null); + + return $statement->execute() instanceof SQLite3Result; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + list($idField) = $this->getFields(); + + $statement = $this->sqlite->prepare(sprintf( + 'DELETE FROM %s WHERE %s = :id', + $this->table, + $idField + )); + + $statement->bindValue(':id', $id); + + return $statement->execute() instanceof SQLite3Result; + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->sqlite->exec(sprintf('DELETE FROM %s', $this->table)); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + // no-op. + } + + /** + * Find a single row by ID. + * + * @param mixed $id + * @param boolean $includeData + * + * @return array|null + */ + private function findById($id, $includeData = true) + { + list($idField) = $fields = $this->getFields(); + + if (!$includeData) { + $key = array_search(static::DATA_FIELD, $fields); + unset($fields[$key]); + } + + $statement = $this->sqlite->prepare(sprintf( + 'SELECT %s FROM %s WHERE %s = :id LIMIT 1', + implode(',', $fields), + $this->table, + $idField + )); + + $statement->bindValue(':id', $id, SQLITE3_TEXT); + + $item = $statement->execute()->fetchArray(); + + if ($item === false) { + return null; + } + + if ($this->isExpired($item)) { + $this->doDelete($id); + + return null; + } + + return $item; + } + + /** + * Gets an array of the fields in our table. + * + * @return array + */ + private function getFields() + { + return array(static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD); + } + + /** + * Check if the item is expired. + * + * @param array $item + * @return boolean + */ + private function isExpired(array $item) + { + return isset($item[static::EXPIRATION_FIELD]) && + $item[self::EXPIRATION_FIELD] !== null && + $item[self::EXPIRATION_FIELD] < time(); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php new file mode 100644 index 0000000..d742fa0 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Version.php @@ -0,0 +1,25 @@ +. + */ + +namespace Doctrine\Common\Cache; + +class Version +{ + const VERSION = '1.4.0-DEV'; +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php new file mode 100644 index 0000000..ae32772 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php @@ -0,0 +1,91 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * WinCache cache provider. + * + * @link www.doctrine-project.org + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class WinCacheCache extends CacheProvider +{ + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return wincache_ucache_get($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return wincache_ucache_exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + return (bool) wincache_ucache_set($id, $data, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return wincache_ucache_delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return wincache_ucache_clear(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = wincache_ucache_info(); + $meminfo = wincache_ucache_meminfo(); + + return array( + Cache::STATS_HITS => $info['total_hit_count'], + Cache::STATS_MISSES => $info['total_miss_count'], + Cache::STATS_UPTIME => $info['total_cache_uptime'], + Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'], + Cache::STATS_MEMORY_AVAILABLE => $meminfo['memory_free'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php new file mode 100644 index 0000000..a2c4ca5 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php @@ -0,0 +1,112 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Xcache cache driver. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class XcacheCache extends CacheProvider +{ + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->doContains($id) ? unserialize(xcache_get($id)) : false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return xcache_isset($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + return xcache_set($id, serialize($data), (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return xcache_unset($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $this->checkAuthorization(); + + xcache_clear_cache(XC_TYPE_VAR); + + return true; + } + + /** + * Checks that xcache.admin.enable_auth is Off. + * + * @return void + * + * @throws \BadMethodCallException When xcache.admin.enable_auth is On. + */ + protected function checkAuthorization() + { + if (ini_get('xcache.admin.enable_auth')) { + throw new \BadMethodCallException( + 'To use all features of \Doctrine\Common\Cache\XcacheCache, ' + . 'you must set "xcache.admin.enable_auth" to "Off" in your php.ini.' + ); + } + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $this->checkAuthorization(); + + $info = xcache_info(XC_TYPE_VAR, 0); + return array( + Cache::STATS_HITS => $info['hits'], + Cache::STATS_MISSES => $info['misses'], + Cache::STATS_UPTIME => null, + Cache::STATS_MEMORY_USAGE => $info['size'], + Cache::STATS_MEMORY_AVAILABLE => $info['avail'], + ); + } +} diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php new file mode 100644 index 0000000..6e35ac8 --- /dev/null +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php @@ -0,0 +1,83 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Zend Data Cache cache driver. + * + * @link www.doctrine-project.org + * @since 2.0 + * @author Ralph Schindler + * @author Guilherme Blanco + */ +class ZendDataCache extends CacheProvider +{ + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return zend_shm_cache_fetch($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (false !== zend_shm_cache_fetch($id)); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + return zend_shm_cache_store($id, $data, $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return zend_shm_cache_delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + $namespace = $this->getNamespace(); + if (empty($namespace)) { + return zend_shm_cache_clear(); + } + return zend_shm_cache_clear($namespace); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + return null; + } +} diff --git a/vendor/doctrine/cache/phpunit.xml.dist b/vendor/doctrine/cache/phpunit.xml.dist new file mode 100644 index 0000000..34d7f4c --- /dev/null +++ b/vendor/doctrine/cache/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./tests/Doctrine/ + + + + + + ./lib/Doctrine/ + + + diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php new file mode 100644 index 0000000..df81262 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php @@ -0,0 +1,20 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of APC'); + } + } + + protected function _getCacheDriver() + { + return new ApcCache(); + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php new file mode 100644 index 0000000..a6c3097 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php @@ -0,0 +1,26 @@ +_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + protected function isSharedStorage() + { + return false; + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php new file mode 100644 index 0000000..eaedd99 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php @@ -0,0 +1,40 @@ +directory = sys_get_temp_dir() . '/doctrine_cache_'. uniqid(); + } while (file_exists($this->directory)); + } + + public function tearDown() + { + if ( ! is_dir($this->directory)) { + return; + } + + $iterator = new RecursiveDirectoryIterator($this->directory); + + foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { + if ($file->isFile()) { + @unlink($file->getRealPath()); + } elseif ($file->isDir()) { + @rmdir($file->getRealPath()); + } + } + } + + protected function isSharedStorage() + { + return false; + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php new file mode 100644 index 0000000..b089456 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -0,0 +1,293 @@ +_getCacheDriver(); + + // Test saving a value, checking if it exists, and fetching it back + $this->assertTrue($cache->save('key', 'value')); + $this->assertTrue($cache->contains('key')); + $this->assertEquals('value', $cache->fetch('key')); + + // Test updating the value of a cache entry + $this->assertTrue($cache->save('key', 'value-changed')); + $this->assertTrue($cache->contains('key')); + $this->assertEquals('value-changed', $cache->fetch('key')); + + // Test deleting a value + $this->assertTrue($cache->delete('key')); + $this->assertFalse($cache->contains('key')); + } + + public function testFetchMulti() + { + $cache = $this->_getCacheDriver(); + + // Test saving some values, checking if it exists, and fetching it back with multiGet + $this->assertTrue($cache->save('key1', 'value1')); + $this->assertTrue($cache->save('key2', 'value2')); + + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key2')) + ); + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key3', 'key2')) + ); + $this->assertEquals( + array('key1' => 'value1', 'key2' => 'value2'), + $cache->fetchMultiple(array('key1', 'key2', 'key3')) + ); + } + + public function testFetchMultiWillFilterNonRequestedKeys() + { + /* @var $cache \Doctrine\Common\Cache\CacheProvider|\PHPUnit_Framework_MockObject_MockObject */ + $cache = $this->getMockForAbstractClass( + 'Doctrine\Common\Cache\CacheProvider', + array(), + '', + true, + true, + true, + array('doFetchMultiple') + ); + + $cache + ->expects($this->once()) + ->method('doFetchMultiple') + ->will($this->returnValue(array( + '[foo][]' => 'bar', + '[bar][]' => 'baz', + '[baz][]' => 'tab', + ))); + + $this->assertEquals( + array('foo' => 'bar', 'bar' => 'baz'), + $cache->fetchMultiple(array('foo', 'bar')) + ); + } + + + public function provideCrudValues() + { + return array( + 'array' => array(array('one', 2, 3.0)), + 'string' => array('value'), + 'integer' => array(1), + 'float' => array(1.5), + 'object' => array(new ArrayObject()), + 'null' => array(null), + ); + } + + public function testDeleteAll() + { + $cache = $this->_getCacheDriver(); + + $this->assertTrue($cache->save('key1', 1)); + $this->assertTrue($cache->save('key2', 2)); + $this->assertTrue($cache->deleteAll()); + $this->assertFalse($cache->contains('key1')); + $this->assertFalse($cache->contains('key2')); + } + + public function testDeleteAllAndNamespaceVersioningBetweenCaches() + { + if ( ! $this->isSharedStorage()) { + $this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage'); + } + + $cache1 = $this->_getCacheDriver(); + $cache2 = $this->_getCacheDriver(); + + $this->assertTrue($cache1->save('key1', 1)); + $this->assertTrue($cache2->save('key2', 2)); + + /* Both providers are initialized with the same namespace version, so + * they can see entries set by each other. + */ + $this->assertTrue($cache1->contains('key1')); + $this->assertTrue($cache1->contains('key2')); + $this->assertTrue($cache2->contains('key1')); + $this->assertTrue($cache2->contains('key2')); + + /* Deleting all entries through one provider will only increment the + * namespace version on that object (and in the cache itself, which new + * instances will use to initialize). The second provider will retain + * its original version and still see stale data. + */ + $this->assertTrue($cache1->deleteAll()); + $this->assertFalse($cache1->contains('key1')); + $this->assertFalse($cache1->contains('key2')); + $this->assertTrue($cache2->contains('key1')); + $this->assertTrue($cache2->contains('key2')); + + /* A new cache provider should not see the deleted entries, since its + * namespace version will be initialized. + */ + $cache3 = $this->_getCacheDriver(); + $this->assertFalse($cache3->contains('key1')); + $this->assertFalse($cache3->contains('key2')); + } + + public function testFlushAll() + { + $cache = $this->_getCacheDriver(); + + $this->assertTrue($cache->save('key1', 1)); + $this->assertTrue($cache->save('key2', 2)); + $this->assertTrue($cache->flushAll()); + $this->assertFalse($cache->contains('key1')); + $this->assertFalse($cache->contains('key2')); + } + + public function testFlushAllAndNamespaceVersioningBetweenCaches() + { + if ( ! $this->isSharedStorage()) { + $this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage'); + } + + $cache1 = $this->_getCacheDriver(); + $cache2 = $this->_getCacheDriver(); + + /* Deleting all elements from the first provider should increment its + * namespace version before saving the first entry. + */ + $cache1->deleteAll(); + $this->assertTrue($cache1->save('key1', 1)); + + /* The second provider will be initialized with the same namespace + * version upon its first save operation. + */ + $this->assertTrue($cache2->save('key2', 2)); + + /* Both providers have the same namespace version and can see entires + * set by each other. + */ + $this->assertTrue($cache1->contains('key1')); + $this->assertTrue($cache1->contains('key2')); + $this->assertTrue($cache2->contains('key1')); + $this->assertTrue($cache2->contains('key2')); + + /* Flushing all entries through one cache will remove all entries from + * the cache but leave their namespace version as-is. + */ + $this->assertTrue($cache1->flushAll()); + $this->assertFalse($cache1->contains('key1')); + $this->assertFalse($cache1->contains('key2')); + $this->assertFalse($cache2->contains('key1')); + $this->assertFalse($cache2->contains('key2')); + + /* Inserting a new entry will use the same, incremented namespace + * version, and it will be visible to both providers. + */ + $this->assertTrue($cache1->save('key1', 1)); + $this->assertTrue($cache1->contains('key1')); + $this->assertTrue($cache2->contains('key1')); + + /* A new cache provider will be initialized with the original namespace + * version and not share any visibility with the first two providers. + */ + $cache3 = $this->_getCacheDriver(); + $this->assertFalse($cache3->contains('key1')); + $this->assertFalse($cache3->contains('key2')); + $this->assertTrue($cache3->save('key3', 3)); + $this->assertTrue($cache3->contains('key3')); + } + + public function testNamespace() + { + $cache = $this->_getCacheDriver(); + + $cache->setNamespace('ns1_'); + + $this->assertTrue($cache->save('key1', 1)); + $this->assertTrue($cache->contains('key1')); + + $cache->setNamespace('ns2_'); + + $this->assertFalse($cache->contains('key1')); + } + + public function testDeleteAllNamespace() + { + $cache = $this->_getCacheDriver(); + + $cache->setNamespace('ns1'); + $this->assertFalse($cache->contains('key1')); + $cache->save('key1', 'test'); + $this->assertTrue($cache->contains('key1')); + + $cache->setNamespace('ns2'); + $this->assertFalse($cache->contains('key1')); + $cache->save('key1', 'test'); + $this->assertTrue($cache->contains('key1')); + + $cache->setNamespace('ns1'); + $this->assertTrue($cache->contains('key1')); + $cache->deleteAll(); + $this->assertFalse($cache->contains('key1')); + + $cache->setNamespace('ns2'); + $this->assertTrue($cache->contains('key1')); + $cache->deleteAll(); + $this->assertFalse($cache->contains('key1')); + } + + /** + * @group DCOM-43 + */ + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertArrayHasKey(Cache::STATS_HITS, $stats); + $this->assertArrayHasKey(Cache::STATS_MISSES, $stats); + $this->assertArrayHasKey(Cache::STATS_UPTIME, $stats); + $this->assertArrayHasKey(Cache::STATS_MEMORY_USAGE, $stats); + $this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILABLE, $stats); + } + + public function testFetchMissShouldReturnFalse() + { + $cache = $this->_getCacheDriver(); + + /* Ensure that caches return boolean false instead of null on a fetch + * miss to be compatible with ORM integration. + */ + $result = $cache->fetch('nonexistent_key'); + + $this->assertFalse($result); + $this->assertNotNull($result); + } + + /** + * Return whether multiple cache providers share the same storage. + * + * This is used for skipping certain tests for shared storage behavior. + * + * @return boolean + */ + protected function isSharedStorage() + { + return true; + } + + /** + * @return \Doctrine\Common\Cache\CacheProvider + */ + abstract protected function _getCacheDriver(); +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php new file mode 100644 index 0000000..46d78c1 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php @@ -0,0 +1,94 @@ +_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertInternalType('array', $stats); + } + + public function testOnlyFetchFirstOne() + { + $cache1 = new ArrayCache(); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache2->expects($this->never())->method('doFetch'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->save('id', 'bar'); + + $this->assertEquals('bar', $chainCache->fetch('id')); + } + + public function testFetchPropagateToFastestCache() + { + $cache1 = new ArrayCache(); + $cache2 = new ArrayCache(); + + $cache2->save('bar', 'value'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + + $this->assertFalse($cache1->contains('bar')); + + $result = $chainCache->fetch('bar'); + + $this->assertEquals('value', $result); + $this->assertTrue($cache2->contains('bar')); + } + + public function testNamespaceIsPropagatedToAllProviders() + { + $cache1 = new ArrayCache(); + $cache2 = new ArrayCache(); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->setNamespace('bar'); + + $this->assertEquals('bar', $cache1->getNamespace()); + $this->assertEquals('bar', $cache2->getNamespace()); + } + + public function testDeleteToAllProviders() + { + $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache1->expects($this->once())->method('doDelete'); + $cache2->expects($this->once())->method('doDelete'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->delete('bar'); + } + + public function testFlushToAllProviders() + { + $cache1 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + $cache2 = $this->getMockForAbstractClass('Doctrine\Common\Cache\CacheProvider'); + + $cache1->expects($this->once())->method('doFlush'); + $cache2->expects($this->once())->method('doFlush'); + + $chainCache = new ChainCache(array($cache1, $cache2)); + $chainCache->flushAll(); + } + + protected function isSharedStorage() + { + return false; + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php new file mode 100644 index 0000000..40d5a69 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php @@ -0,0 +1,47 @@ +couchbase = new Couchbase('127.0.0.1', 'Administrator', 'password', 'default'); + } catch(Exception $ex) { + $this->markTestSkipped('Could not instantiate the Couchbase cache because of: ' . $ex); + } + } else { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of the couchbase extension'); + } + } + + public function testNoExpire() + { + $cache = $this->_getCacheDriver(); + $cache->save('noexpire', 'value', 0); + sleep(1); + $this->assertTrue($cache->contains('noexpire'), 'Couchbase provider should support no-expire'); + } + + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + + $this->assertTrue($cache->contains('key'), 'Couchbase provider should support TTL > 30 days'); + } + + protected function _getCacheDriver() + { + $driver = new CouchbaseCache(); + $driver->setCouchbase($this->couchbase); + return $driver; + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php new file mode 100644 index 0000000..8868321 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php @@ -0,0 +1,161 @@ +driver = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(), '', false + ); + } + + public function getProviderFileName() + { + return array( + //The characters :\/<>"*?| are not valid in Windows filenames. + array('key:1', 'key-1'), + array('key\2', 'key-2'), + array('key/3', 'key-3'), + array('key<4', 'key-4'), + array('key>5', 'key-5'), + array('key"6', 'key-6'), + array('key*7', 'key-7'), + array('key?8', 'key-8'), + array('key|9', 'key-9'), + array('key[10]', 'key[10]'), + array('keyä11', 'key--11'), + array('../key12', '---key12'), + array('key-13', 'key__13'), + ); + } + + /** + * @dataProvider getProviderFileName + */ + public function testInvalidFilename($key, $expected) + { + $cache = $this->driver; + $method = new \ReflectionMethod($cache, 'getFilename'); + + $method->setAccessible(true); + + $value = $method->invoke($cache, $key); + $actual = pathinfo($value, PATHINFO_FILENAME); + + $this->assertEquals($expected, $actual); + } + + public function testFilenameCollision() + { + $data = array( + 'key:0' => 'key-0', + 'key\0' => 'key-0', + 'key/0' => 'key-0', + 'key<0' => 'key-0', + 'key>0' => 'key-0', + 'key"0' => 'key-0', + 'key*0' => 'key-0', + 'key?0' => 'key-0', + 'key|0' => 'key-0', + 'key-0' => 'key__0', + 'keyä0' => 'key--0', + ); + + $paths = array(); + $cache = $this->driver; + $method = new \ReflectionMethod($cache, 'getFilename'); + + $method->setAccessible(true); + + foreach ($data as $key => $expected) { + $path = $method->invoke($cache, $key); + $actual = pathinfo($path, PATHINFO_FILENAME); + + $this->assertNotContains($path, $paths); + $this->assertEquals($expected, $actual); + + $paths[] = $path; + } + } + + public function testFilenameShouldCreateThePathWithFourSubDirectories() + { + $cache = $this->driver; + $method = new \ReflectionMethod($cache, 'getFilename'); + $key = 'item-key'; + $expectedDir = array( + '84', 'e0', 'e2', 'e8', '93', 'fe', 'bb', '73', '7a', '0f', 'ee', + '0c', '89', 'd5', '3f', '4b', 'b7', 'fc', 'b4', '4c', '57', 'cd', + 'f3', 'd3', '2c', 'e7', '36', '3f', '5d', '59', '77', '60' + ); + $expectedDir = implode(DIRECTORY_SEPARATOR, $expectedDir); + + $method->setAccessible(true); + + $path = $method->invoke($cache, $key); + $filename = pathinfo($path, PATHINFO_FILENAME); + $dirname = pathinfo($path, PATHINFO_DIRNAME); + + $this->assertEquals('item__key', $filename); + $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir, $dirname); + $this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir . DIRECTORY_SEPARATOR . 'item__key', $path); + } + + public function testFileExtensionCorrectlyEscaped() + { + $driver1 = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__, '.*') + ); + $driver2 = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__, '.php') + ); + + $doGetStats = new \ReflectionMethod($driver1, 'doGetStats'); + + $doGetStats->setAccessible(true); + + $stats1 = $doGetStats->invoke($driver1); + $stats2 = $doGetStats->invoke($driver2); + + $this->assertSame(0, $stats1[Cache::STATS_MEMORY_USAGE]); + $this->assertGreaterThan(0, $stats2[Cache::STATS_MEMORY_USAGE]); + } + + /** + * @group DCOM-266 + */ + public function testFileExtensionSlashCorrectlyEscaped() + { + $driver = $this->getMock( + 'Doctrine\Common\Cache\FileCache', + array('doFetch', 'doContains', 'doSave'), + array(__DIR__ . '/../', '/' . basename(__FILE__)) + ); + + $doGetStats = new \ReflectionMethod($driver, 'doGetStats'); + + $doGetStats->setAccessible(true); + + $stats = $doGetStats->invoke($driver); + + $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_USAGE]); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php new file mode 100644 index 0000000..e3b74cd --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php @@ -0,0 +1,75 @@ +_getCacheDriver(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $filename = $getFilename->invoke($cache, $id); + + $data = ''; + $lifetime = 0; + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + $this->assertNotEquals(0, $lifetime, "previous lifetime could not be loaded"); + + // update lifetime + $lifetime = $lifetime - 20; + file_put_contents($filename, $lifetime . PHP_EOL . $data); + + // test expired data + $this->assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats[Cache::STATS_HITS]); + $this->assertNull($stats[Cache::STATS_MISSES]); + $this->assertNull($stats[Cache::STATS_UPTIME]); + $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]); + $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]); + } + + protected function _getCacheDriver() + { + return new FilesystemCache($this->directory); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php new file mode 100644 index 0000000..b0da1b9 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php @@ -0,0 +1,54 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of memcache'); + } + + $this->memcache = new Memcache(); + + if (@$this->memcache->connect('localhost', 11211) === false) { + unset($this->memcache); + $this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache'); + } + } + + public function tearDown() + { + if ($this->memcache instanceof Memcache) { + $this->memcache->flush(); + } + } + + public function testNoExpire() + { + $cache = $this->_getCacheDriver(); + $cache->save('noexpire', 'value', 0); + sleep(1); + $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); + } + + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + $this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days'); + } + + protected function _getCacheDriver() + { + $driver = new MemcacheCache(); + $driver->setMemcache($this->memcache); + return $driver; + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php new file mode 100644 index 0000000..071329f --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php @@ -0,0 +1,56 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of memcached'); + } + + $this->memcached = new Memcached(); + $this->memcached->setOption(Memcached::OPT_COMPRESSION, false); + $this->memcached->addServer('127.0.0.1', 11211); + + if (@fsockopen('127.0.0.1', 11211) === false) { + unset($this->memcached); + $this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache'); + } + } + + public function tearDown() + { + if ($this->memcached instanceof Memcached) { + $this->memcached->flush(); + } + } + + public function testNoExpire() + { + $cache = $this->_getCacheDriver(); + $cache->save('noexpire', 'value', 0); + sleep(1); + $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); + } + + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + $this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days'); + } + + protected function _getCacheDriver() + { + $driver = new MemcachedCache(); + $driver->setMemcached($this->memcached); + return $driver; + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php new file mode 100644 index 0000000..8c2f6e0 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php @@ -0,0 +1,61 @@ +=')) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of mongo >= 1.3.0'); + } + + $mongo = new MongoClient(); + $this->collection = $mongo->selectCollection('doctrine_common_cache', 'test'); + } + + public function tearDown() + { + if ($this->collection instanceof MongoCollection) { + $this->collection->drop(); + } + } + + public function testSaveWithNonUtf8String() + { + // Invalid 2-octet sequence + $data = "\xc3\x28"; + + $cache = $this->_getCacheDriver(); + + $this->assertTrue($cache->save('key', $data)); + $this->assertEquals($data, $cache->fetch('key')); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats[Cache::STATS_HITS]); + $this->assertNull($stats[Cache::STATS_MISSES]); + $this->assertGreaterThan(0, $stats[Cache::STATS_UPTIME]); + $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]); + $this->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]); + } + + protected function _getCacheDriver() + { + return new MongoDBCache($this->collection); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php new file mode 100644 index 0000000..f49ce25 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php @@ -0,0 +1,118 @@ +_getCacheDriver(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $path = $getFilename->invoke($cache, $id); + $value = include $path; + + // update lifetime + $value['lifetime'] = $value['lifetime'] - 20; + file_put_contents($path, 'assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_set_state', new SetStateClass(array(1,2,3))); + + //Test __set_state call + $this->assertCount(0, SetStateClass::$values); + + // Test fetch + $value = $cache->fetch('test_set_state'); + $this->assertInstanceOf('Doctrine\Tests\Common\Cache\SetStateClass', $value); + $this->assertEquals(array(1,2,3), $value->getValue()); + + //Test __set_state call + $this->assertCount(1, SetStateClass::$values); + + // Test contains + $this->assertTrue($cache->contains('test_set_state')); + } + + public function testNotImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + $this->setExpectedException('InvalidArgumentException'); + $cache->save('test_not_set_state', new NotSetStateClass(array(1,2,3))); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats[Cache::STATS_HITS]); + $this->assertNull($stats[Cache::STATS_MISSES]); + $this->assertNull($stats[Cache::STATS_UPTIME]); + $this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]); + $this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]); + } + + protected function _getCacheDriver() + { + return new PhpFileCache($this->directory); + } +} + +class NotSetStateClass +{ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } +} + +class SetStateClass extends NotSetStateClass +{ + public static $values = array(); + + public static function __set_state($data) + { + self::$values = $data; + return new self($data['value']); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php new file mode 100644 index 0000000..b781d99 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PredisCacheTest.php @@ -0,0 +1,31 @@ +client = new Client(); + + try { + $this->client->connect(); + } catch (ConnectionException $e) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } + + /** + * @return PredisCache + */ + protected function _getCacheDriver() + { + return new PredisCache($this->client); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php new file mode 100644 index 0000000..45bbc75 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php @@ -0,0 +1,30 @@ +_redis = new \Redis(); + $ok = @$this->_redis->connect('127.0.0.1'); + if (!$ok) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } else { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } + + protected function _getCacheDriver() + { + $driver = new RedisCache(); + $driver->setRedis($this->_redis); + return $driver; + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php new file mode 100644 index 0000000..dce8cc0 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php @@ -0,0 +1,64 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of Riak'); + } + + try { + $this->connection = new Connection('127.0.0.1', 8087); + $this->bucket = new Bucket($this->connection, 'test'); + } catch (Exception\RiakException $e) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of Riak'); + } + } + + /** + * {@inheritdoc} + */ + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + /** + * Retrieve RiakCache instance. + * + * @return \Doctrine\Common\Cache\RiakCache + */ + protected function _getCacheDriver() + { + return new RiakCache($this->bucket); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php new file mode 100644 index 0000000..d52cabb --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/SQLite3CacheTest.php @@ -0,0 +1,37 @@ +file = tempnam(null, 'doctrine-cache-test-'); + unlink($this->file); + $this->sqlite = new SQLite3($this->file); + } + + protected function tearDown() + { + unlink($this->file); + } + + public function testGetStats() + { + $this->assertNull($this->_getCacheDriver()->getStats()); + } + + protected function _getCacheDriver() + { + return new SQLite3Cache($this->sqlite, 'test_table'); + } +} diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php new file mode 100644 index 0000000..cb363df --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php @@ -0,0 +1,20 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of Wincache'); + } + } + + protected function _getCacheDriver() + { + return new WincacheCache(); + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php new file mode 100644 index 0000000..6259848 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php @@ -0,0 +1,20 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of xcache'); + } + } + + protected function _getCacheDriver() + { + return new XcacheCache(); + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php new file mode 100644 index 0000000..cd66e15 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php @@ -0,0 +1,28 @@ +markTestSkipped('The ' . __CLASS__ .' requires the use of Zend Data Cache which only works in apache2handler SAPI'); + } + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + protected function _getCacheDriver() + { + return new ZendDataCache(); + } +} \ No newline at end of file diff --git a/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php b/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php new file mode 100644 index 0000000..e8323d2 --- /dev/null +++ b/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php @@ -0,0 +1,10 @@ +add('Doctrine\\Tests\\', __DIR__ . '/../../'); +unset($classLoader); diff --git a/vendor/doctrine/cache/tests/travis/php.ini b/vendor/doctrine/cache/tests/travis/php.ini new file mode 100644 index 0000000..ef5d9a1 --- /dev/null +++ b/vendor/doctrine/cache/tests/travis/php.ini @@ -0,0 +1,6 @@ +extension="mongo.so" +extension="memcache.so" +extension="memcached.so" + +apc.enabled=1 +apc.enable_cli=1 diff --git a/vendor/doctrine/cache/tests/travis/phpunit.travis.xml b/vendor/doctrine/cache/tests/travis/phpunit.travis.xml new file mode 100644 index 0000000..a01faa5 --- /dev/null +++ b/vendor/doctrine/cache/tests/travis/phpunit.travis.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + ../Doctrine/ + + + + + + ../../lib/Doctrine/ + + + + + + performance + + + diff --git a/vendor/doctrine/instantiator/.doctrine-project.json b/vendor/doctrine/instantiator/.doctrine-project.json new file mode 100644 index 0000000..4fe86ee --- /dev/null +++ b/vendor/doctrine/instantiator/.doctrine-project.json @@ -0,0 +1,26 @@ +{ + "active": true, + "name": "Instantiator", + "slug": "instantiator", + "docsSlug": "doctrine-instantiator", + "codePath": "/src", + "versions": [ + { + "name": "1.1", + "branchName": "master", + "slug": "latest", + "aliases": [ + "current", + "stable" + ], + "maintained": true, + "current": true + }, + { + "name": "1.0", + "branchName": "1.0.x", + "slug": "1.0" + } + ] +} + diff --git a/vendor/doctrine/instantiator/CONTRIBUTING.md b/vendor/doctrine/instantiator/CONTRIBUTING.md new file mode 100644 index 0000000..c1a2c42 --- /dev/null +++ b/vendor/doctrine/instantiator/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing + + * Follow the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard) + * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) + * Any contribution must provide tests for additional introduced conditions + * Any un-confirmed issue needs a failing test case before being accepted + * Pull requests must be sent from a new hotfix/feature branch, not from `master`. + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git://github.com/doctrine/instantiator.git +``` + +You will then need to run a composer installation: + +```sh +$ cd Instantiator +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement +won't be merged. + diff --git a/vendor/doctrine/instantiator/LICENSE b/vendor/doctrine/instantiator/LICENSE new file mode 100644 index 0000000..4d983d1 --- /dev/null +++ b/vendor/doctrine/instantiator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Doctrine Project + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/doctrine/instantiator/README.md b/vendor/doctrine/instantiator/README.md new file mode 100644 index 0000000..eff5a0c --- /dev/null +++ b/vendor/doctrine/instantiator/README.md @@ -0,0 +1,39 @@ +# Instantiator + +This library provides a way of avoiding usage of constructors when instantiating PHP classes. + +[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator) +[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master) +[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator) + +[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator) +[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator) + +## Installation + +The suggested installation method is via [composer](https://getcomposer.org/): + +```sh +php composer.phar require "doctrine/instantiator:~1.0.3" +``` + +## Usage + +The instantiator is able to create new instances of any class without using the constructor or any API of the class +itself: + +```php +$instantiator = new \Doctrine\Instantiator\Instantiator(); + +$instance = $instantiator->instantiate(\My\ClassName\Here::class); +``` + +## Contributing + +Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out! + +## Credits + +This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which +has been donated to the doctrine organization, and which is now deprecated in favour of this package. diff --git a/vendor/doctrine/instantiator/composer.json b/vendor/doctrine/instantiator/composer.json new file mode 100644 index 0000000..9002a91 --- /dev/null +++ b/vendor/doctrine/instantiator/composer.json @@ -0,0 +1,47 @@ +{ + "name": "doctrine/instantiator", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "type": "library", + "license": "MIT", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "instantiate", + "constructor" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "require": { + "php": "^7.1" + }, + "require-dev": { + "ext-phar": "*", + "ext-pdo": "*", + "doctrine/coding-standard": "^6.0", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "autoload-dev": { + "psr-0": { + "DoctrineTest\\InstantiatorPerformance\\": "tests", + "DoctrineTest\\InstantiatorTest\\": "tests", + "DoctrineTest\\InstantiatorTestAsset\\": "tests" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + } +} diff --git a/vendor/doctrine/instantiator/docs/en/index.rst b/vendor/doctrine/instantiator/docs/en/index.rst new file mode 100644 index 0000000..0c85da0 --- /dev/null +++ b/vendor/doctrine/instantiator/docs/en/index.rst @@ -0,0 +1,68 @@ +Introduction +============ + +This library provides a way of avoiding usage of constructors when instantiating PHP classes. + +Installation +============ + +The suggested installation method is via `composer`_: + +.. code-block:: console + + $ composer require doctrine/instantiator + +Usage +===== + +The instantiator is able to create new instances of any class without +using the constructor or any API of the class itself: + +.. code-block:: php + + instantiate(User::class); + +Contributing +============ + +- Follow the `Doctrine Coding Standard`_ +- The project will follow strict `object calisthenics`_ +- Any contribution must provide tests for additional introduced + conditions +- Any un-confirmed issue needs a failing test case before being + accepted +- Pull requests must be sent from a new hotfix/feature branch, not from + ``master``. + +Testing +======= + +The PHPUnit version to be used is the one installed as a dev- dependency +via composer: + +.. code-block:: console + + $ ./vendor/bin/phpunit + +Accepted coverage for new contributions is 80%. Any contribution not +satisfying this requirement won’t be merged. + +Credits +======= + +This library was migrated from `ocramius/instantiator`_, which has been +donated to the doctrine organization, and which is now deprecated in +favour of this package. + +.. _composer: https://getcomposer.org/ +.. _CONTRIBUTING.md: CONTRIBUTING.md +.. _ocramius/instantiator: https://github.com/Ocramius/Instantiator +.. _Doctrine Coding Standard: https://github.com/doctrine/coding-standard +.. _object calisthenics: http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php diff --git a/vendor/doctrine/instantiator/docs/en/sidebar.rst b/vendor/doctrine/instantiator/docs/en/sidebar.rst new file mode 100644 index 0000000..0c36479 --- /dev/null +++ b/vendor/doctrine/instantiator/docs/en/sidebar.rst @@ -0,0 +1,4 @@ +.. toctree:: + :depth: 3 + + index diff --git a/vendor/doctrine/instantiator/phpbench.json b/vendor/doctrine/instantiator/phpbench.json new file mode 100644 index 0000000..fce5dd6 --- /dev/null +++ b/vendor/doctrine/instantiator/phpbench.json @@ -0,0 +1,4 @@ +{ + "bootstrap": "vendor/autoload.php", + "path": "tests/DoctrineTest/InstantiatorPerformance" +} diff --git a/vendor/doctrine/instantiator/phpcs.xml.dist b/vendor/doctrine/instantiator/phpcs.xml.dist new file mode 100644 index 0000000..1fcac4a --- /dev/null +++ b/vendor/doctrine/instantiator/phpcs.xml.dist @@ -0,0 +1,35 @@ + + + + + + + + + + + + src + tests + + + + + + + + + + tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php + + + + src/Doctrine/Instantiator/Exception/UnexpectedValueException.php + src/Doctrine/Instantiator/Exception/InvalidArgumentException.php + + + + src/Doctrine/Instantiator/Exception/ExceptionInterface.php + src/Doctrine/Instantiator/InstantiatorInterface.php + + diff --git a/vendor/doctrine/instantiator/phpstan.neon.dist b/vendor/doctrine/instantiator/phpstan.neon.dist new file mode 100644 index 0000000..ecc38ef --- /dev/null +++ b/vendor/doctrine/instantiator/phpstan.neon.dist @@ -0,0 +1,19 @@ +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + +parameters: + level: max + paths: + - src + - tests + + ignoreErrors: + - + message: '#::__construct\(\) does not call parent constructor from#' + path: '*/tests/DoctrineTest/InstantiatorTestAsset/*.php' + + # dynamic properties confuse static analysis + - + message: '#Access to an undefined property object::\$foo\.#' + path: '*/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php' diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php new file mode 100644 index 0000000..e6a5195 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php @@ -0,0 +1,12 @@ += 50400 && trait_exists($className)) { + return new self(sprintf('The provided type "%s" is a trait, and can not be instantiated', $className)); + } + + return new self(sprintf('The provided class "%s" does not exist', $className)); + } + + public static function fromAbstractClass(ReflectionClass $reflectionClass) : self + { + return new self(sprintf( + 'The provided class "%s" is abstract, and can not be instantiated', + $reflectionClass->getName() + )); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php new file mode 100644 index 0000000..d946731 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php @@ -0,0 +1,48 @@ +getName() + ), + 0, + $exception + ); + } + + public static function fromUncleanUnSerialization( + ReflectionClass $reflectionClass, + string $errorString, + int $errorCode, + string $errorFile, + int $errorLine + ) : self { + return new self( + sprintf( + 'Could not produce an instance of "%s" via un-serialization, since an error was triggered ' + . 'in file "%s" at line "%d"', + $reflectionClass->getName(), + $errorFile, + $errorLine + ), + 0, + new Exception($errorString, $errorCode) + ); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php new file mode 100644 index 0000000..4364190 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php @@ -0,0 +1,198 @@ +buildAndCacheFromFactory($className); + } + + /** + * Builds the requested object and caches it in static properties for performance + * + * @return object + */ + private function buildAndCacheFromFactory(string $className) + { + $factory = self::$cachedInstantiators[$className] = $this->buildFactory($className); + $instance = $factory(); + + if ($this->isSafeToClone(new ReflectionClass($instance))) { + self::$cachedCloneables[$className] = clone $instance; + } + + return $instance; + } + + /** + * Builds a callable capable of instantiating the given $className without + * invoking its constructor. + * + * @throws InvalidArgumentException + * @throws UnexpectedValueException + * @throws ReflectionException + */ + private function buildFactory(string $className) : callable + { + $reflectionClass = $this->getReflectionClass($className); + + if ($this->isInstantiableViaReflection($reflectionClass)) { + return [$reflectionClass, 'newInstanceWithoutConstructor']; + } + + $serializedString = sprintf( + '%s:%d:"%s":0:{}', + self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER, + strlen($className), + $className + ); + + $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString); + + return static function () use ($serializedString) { + return unserialize($serializedString); + }; + } + + /** + * @param string $className + * + * @throws InvalidArgumentException + * @throws ReflectionException + */ + private function getReflectionClass($className) : ReflectionClass + { + if (! class_exists($className)) { + throw InvalidArgumentException::fromNonExistingClass($className); + } + + $reflection = new ReflectionClass($className); + + if ($reflection->isAbstract()) { + throw InvalidArgumentException::fromAbstractClass($reflection); + } + + return $reflection; + } + + /** + * @throws UnexpectedValueException + */ + private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString) : void + { + set_error_handler(static function ($code, $message, $file, $line) use ($reflectionClass, & $error) : void { + $error = UnexpectedValueException::fromUncleanUnSerialization( + $reflectionClass, + $message, + $code, + $file, + $line + ); + }); + + try { + $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + } finally { + restore_error_handler(); + } + + if ($error) { + throw $error; + } + } + + /** + * @throws UnexpectedValueException + */ + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString) : void + { + try { + unserialize($serializedString); + } catch (Exception $exception) { + throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception); + } + } + + private function isInstantiableViaReflection(ReflectionClass $reflectionClass) : bool + { + return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal()); + } + + /** + * Verifies whether the given class is to be considered internal + */ + private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool + { + do { + if ($reflectionClass->isInternal()) { + return true; + } + + $reflectionClass = $reflectionClass->getParentClass(); + } while ($reflectionClass); + + return false; + } + + /** + * Checks if a class is cloneable + * + * Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects. + */ + private function isSafeToClone(ReflectionClass $reflection) : bool + { + return $reflection->isCloneable() && ! $reflection->hasMethod('__clone'); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php new file mode 100644 index 0000000..95299f4 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php @@ -0,0 +1,20 @@ +input = $input; + $this->tokens = []; + + $this->reset(); + $this->scan($input); + } + + /** + * Resets the lexer. + * + * @return void + */ + public function reset() + { + $this->lookahead = null; + $this->token = null; + $this->peek = 0; + $this->position = 0; + } + + /** + * Resets the peek pointer to 0. + * + * @return void + */ + public function resetPeek() + { + $this->peek = 0; + } + + /** + * Resets the lexer position on the input to the given position. + * + * @param int $position Position to place the lexical scanner. + * + * @return void + */ + public function resetPosition($position = 0) + { + $this->position = $position; + } + + /** + * Retrieve the original lexer's input until a given position. + * + * @param int $position + * + * @return string + */ + public function getInputUntilPosition($position) + { + return substr($this->input, 0, $position); + } + + /** + * Checks whether a given token matches the current lookahead. + * + * @param int|string $token + * + * @return bool + */ + public function isNextToken($token) + { + return $this->lookahead !== null && $this->lookahead['type'] === $token; + } + + /** + * Checks whether any of the given tokens matches the current lookahead. + * + * @param array $tokens + * + * @return bool + */ + public function isNextTokenAny(array $tokens) + { + return $this->lookahead !== null && in_array($this->lookahead['type'], $tokens, true); + } + + /** + * Moves to the next token in the input string. + * + * @return bool + */ + public function moveNext() + { + $this->peek = 0; + $this->token = $this->lookahead; + $this->lookahead = isset($this->tokens[$this->position]) + ? $this->tokens[$this->position++] : null; + + return $this->lookahead !== null; + } + + /** + * Tells the lexer to skip input tokens until it sees a token with the given value. + * + * @param string $type The token type to skip until. + * + * @return void + */ + public function skipUntil($type) + { + while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { + $this->moveNext(); + } + } + + /** + * Checks if given value is identical to the given token. + * + * @param mixed $value + * @param int|string $token + * + * @return bool + */ + public function isA($value, $token) + { + return $this->getType($value) === $token; + } + + /** + * Moves the lookahead token forward. + * + * @return array|null The next token or NULL if there are no more tokens ahead. + */ + public function peek() + { + if (isset($this->tokens[$this->position + $this->peek])) { + return $this->tokens[$this->position + $this->peek++]; + } + + return null; + } + + /** + * Peeks at the next token, returns it and immediately resets the peek. + * + * @return array|null The next token or NULL if there are no more tokens ahead. + */ + public function glimpse() + { + $peek = $this->peek(); + $this->peek = 0; + + return $peek; + } + + /** + * Scans the input string for tokens. + * + * @param string $input A query string. + * + * @return void + */ + protected function scan($input) + { + if (! isset($this->regex)) { + $this->regex = sprintf( + '/(%s)|%s/%s', + implode(')|(', $this->getCatchablePatterns()), + implode('|', $this->getNonCatchablePatterns()), + $this->getModifiers() + ); + } + + $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; + $matches = preg_split($this->regex, $input, -1, $flags); + + if ($matches === false) { + // Work around https://bugs.php.net/78122 + $matches = [[$input, 0]]; + } + + foreach ($matches as $match) { + // Must remain before 'value' assignment since it can change content + $type = $this->getType($match[0]); + + $this->tokens[] = [ + 'value' => $match[0], + 'type' => $type, + 'position' => $match[1], + ]; + } + } + + /** + * Gets the literal for a given token. + * + * @param int|string $token + * + * @return int|string + */ + public function getLiteral($token) + { + $className = static::class; + $reflClass = new ReflectionClass($className); + $constants = $reflClass->getConstants(); + + foreach ($constants as $name => $value) { + if ($value === $token) { + return $className . '::' . $name; + } + } + + return $token; + } + + /** + * Regex modifiers + * + * @return string + */ + protected function getModifiers() + { + return 'i'; + } + + /** + * Lexical catchable patterns. + * + * @return array + */ + abstract protected function getCatchablePatterns(); + + /** + * Lexical non-catchable patterns. + * + * @return array + */ + abstract protected function getNonCatchablePatterns(); + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * + * @return int|string|null + */ + abstract protected function getType(&$value); +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailLexer.php b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php new file mode 100644 index 0000000..4485728 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php @@ -0,0 +1,241 @@ + self::S_OPENPARENTHESIS, + ')' => self::S_CLOSEPARENTHESIS, + '<' => self::S_LOWERTHAN, + '>' => self::S_GREATERTHAN, + '[' => self::S_OPENBRACKET, + ']' => self::S_CLOSEBRACKET, + ':' => self::S_COLON, + ';' => self::S_SEMICOLON, + '@' => self::S_AT, + '\\' => self::S_BACKSLASH, + '/' => self::S_SLASH, + ',' => self::S_COMMA, + '.' => self::S_DOT, + '"' => self::S_DQUOTE, + '-' => self::S_HYPHEN, + '::' => self::S_DOUBLECOLON, + ' ' => self::S_SP, + "\t" => self::S_HTAB, + "\r" => self::S_CR, + "\n" => self::S_LF, + "\r\n" => self::CRLF, + 'IPv6' => self::S_IPV6TAG, + '{' => self::S_OPENQBRACKET, + '}' => self::S_CLOSEQBRACKET, + '' => self::S_EMPTY, + '\0' => self::C_NUL, + ); + + protected $hasInvalidTokens = false; + + protected $previous; + + private static $nullToken = [ + 'value' => '', + 'type' => null, + 'position' => 0, + ]; + + public function __construct() + { + $this->previous = $this->token = self::$nullToken; + } + + /** + * @return void + */ + public function reset() + { + $this->hasInvalidTokens = false; + parent::reset(); + $this->previous = $this->token = self::$nullToken; + } + + public function hasInvalidTokens() + { + return $this->hasInvalidTokens; + } + + /** + * @param string $type + * @throws \UnexpectedValueException + * @return boolean + */ + public function find($type) + { + $search = clone $this; + $search->skipUntil($type); + + if (!$search->lookahead) { + throw new \UnexpectedValueException($type . ' not found'); + } + return true; + } + + /** + * getPrevious + * + * @return array token + */ + public function getPrevious() + { + return $this->previous; + } + + /** + * moveNext + * + * @return boolean + */ + public function moveNext() + { + $this->previous = $this->token; + $hasNext = parent::moveNext(); + $this->token = $this->token ?: self::$nullToken; + + return $hasNext; + } + + /** + * Lexical catchable patterns. + * + * @return string[] + */ + protected function getCatchablePatterns() + { + return array( + '[a-zA-Z_]+[46]?', //ASCII and domain literal + '[^\x00-\x7F]', //UTF-8 + '[0-9]+', + '\r\n', + '::', + '\s+?', + '.', + ); + } + + /** + * Lexical non-catchable patterns. + * + * @return string[] + */ + protected function getNonCatchablePatterns() + { + return array('[\xA0-\xff]+'); + } + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * @throws \InvalidArgumentException + * @return integer + */ + protected function getType(&$value) + { + if ($this->isNullType($value)) { + return self::C_NUL; + } + + if ($this->isValid($value)) { + return $this->charValue[$value]; + } + + if ($this->isUTF8Invalid($value)) { + $this->hasInvalidTokens = true; + return self::INVALID; + } + + return self::GENERIC; + } + + protected function isValid($value) + { + if (isset($this->charValue[$value])) { + return true; + } + + return false; + } + + /** + * @param string $value + * @return bool + */ + protected function isNullType($value) + { + if ($value === "\0") { + return true; + } + + return false; + } + + /** + * @param string $value + * @return bool + */ + protected function isUTF8Invalid($value) + { + if (preg_match('/\p{Cc}+/u', $value)) { + return true; + } + + return false; + } + + /** + * @return string + */ + protected function getModifiers() + { + return 'iu'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailParser.php b/vendor/egulias/email-validator/EmailValidator/EmailParser.php new file mode 100644 index 0000000..5bf605a --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailParser.php @@ -0,0 +1,104 @@ + + */ +class EmailParser +{ + const EMAIL_MAX_LENGTH = 254; + + protected $warnings; + protected $domainPart = ''; + protected $localPart = ''; + protected $lexer; + protected $localPartParser; + protected $domainPartParser; + + public function __construct(EmailLexer $lexer) + { + $this->lexer = $lexer; + $this->localPartParser = new LocalPart($this->lexer); + $this->domainPartParser = new DomainPart($this->lexer); + $this->warnings = new \SplObjectStorage(); + } + + /** + * @param string $str + * @return array + */ + public function parse($str) + { + $this->lexer->setInput($str); + + if (!$this->hasAtToken()) { + throw new NoLocalPart(); + } + + + $this->localPartParser->parse($str); + $this->domainPartParser->parse($str); + + $this->setParts($str); + + if ($this->lexer->hasInvalidTokens()) { + throw new ExpectingATEXT(); + } + + return array('local' => $this->localPart, 'domain' => $this->domainPart); + } + + public function getWarnings() + { + $localPartWarnings = $this->localPartParser->getWarnings(); + $domainPartWarnings = $this->domainPartParser->getWarnings(); + $this->warnings = array_merge($localPartWarnings, $domainPartWarnings); + + $this->addLongEmailWarning($this->localPart, $this->domainPart); + + return $this->warnings; + } + + public function getParsedDomainPart() + { + return $this->domainPart; + } + + protected function setParts($email) + { + $parts = explode('@', $email); + $this->domainPart = $this->domainPartParser->getDomainPart(); + $this->localPart = $parts[0]; + } + + protected function hasAtToken() + { + $this->lexer->moveNext(); + $this->lexer->moveNext(); + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + return false; + } + + return true; + } + + /** + * @param string $localPart + * @param string $parsedDomainPart + */ + protected function addLongEmailWarning($localPart, $parsedDomainPart) + { + if (strlen($localPart . '@' . $parsedDomainPart) > self::EMAIL_MAX_LENGTH) { + $this->warnings[EmailTooLong::CODE] = new EmailTooLong(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailValidator.php b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php new file mode 100644 index 0000000..1c27707 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php @@ -0,0 +1,67 @@ +lexer = new EmailLexer(); + } + + /** + * @param string $email + * @param EmailValidation $emailValidation + * @return bool + */ + public function isValid($email, EmailValidation $emailValidation) + { + $isValid = $emailValidation->isValid($email, $this->lexer); + $this->warnings = $emailValidation->getWarnings(); + $this->error = $emailValidation->getError(); + + return $isValid; + } + + /** + * @return boolean + */ + public function hasWarnings() + { + return !empty($this->warnings); + } + + /** + * @return array + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * @return InvalidEmail + */ + public function getError() + { + return $this->error; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php new file mode 100644 index 0000000..97f41a2 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php @@ -0,0 +1,9 @@ +lexer->moveNext(); + + $this->performDomainStartChecks(); + + $domain = $this->doParseDomainPart(); + + $prev = $this->lexer->getPrevious(); + $length = strlen($domain); + + if ($prev['type'] === EmailLexer::S_DOT) { + throw new DotAtEnd(); + } + if ($prev['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + if ($length > self::DOMAIN_MAX_LENGTH) { + $this->warnings[DomainTooLong::CODE] = new DomainTooLong(); + } + if ($prev['type'] === EmailLexer::S_CR) { + throw new CRLFAtTheEnd(); + } + $this->domainPart = $domain; + } + + private function performDomainStartChecks() + { + $this->checkInvalidTokensAfterAT(); + $this->checkEmptyDomain(); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment(); + $this->parseDomainComments(); + } + } + + private function checkEmptyDomain() + { + $thereIsNoDomain = $this->lexer->token['type'] === EmailLexer::S_EMPTY || + ($this->lexer->token['type'] === EmailLexer::S_SP && + !$this->lexer->isNextToken(EmailLexer::GENERIC)); + + if ($thereIsNoDomain) { + throw new NoDomainPart(); + } + } + + private function checkInvalidTokensAfterAT() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT) { + throw new DotAtStart(); + } + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + } + + public function getDomainPart() + { + return $this->domainPart; + } + + public function checkIPV6Tag($addressLiteral, $maxGroups = 8) + { + $prev = $this->lexer->getPrevious(); + if ($prev['type'] === EmailLexer::S_COLON) { + $this->warnings[IPV6ColonEnd::CODE] = new IPV6ColonEnd(); + } + + $IPv6 = substr($addressLiteral, 5); + //Daniel Marschall's new IPv6 testing strategy + $matchesIP = explode(':', $IPv6); + $groupCount = count($matchesIP); + $colons = strpos($IPv6, '::'); + + if (count(preg_grep('/^[0-9A-Fa-f]{0,4}$/', $matchesIP, PREG_GREP_INVERT)) !== 0) { + $this->warnings[IPV6BadChar::CODE] = new IPV6BadChar(); + } + + if ($colons === false) { + // We need exactly the right number of groups + if ($groupCount !== $maxGroups) { + $this->warnings[IPV6GroupCount::CODE] = new IPV6GroupCount(); + } + return; + } + + if ($colons !== strrpos($IPv6, '::')) { + $this->warnings[IPV6DoubleColon::CODE] = new IPV6DoubleColon(); + return; + } + + if ($colons === 0 || $colons === (strlen($IPv6) - 2)) { + // RFC 4291 allows :: at the start or end of an address + //with 7 other groups in addition + ++$maxGroups; + } + + if ($groupCount > $maxGroups) { + $this->warnings[IPV6MaxGroups::CODE] = new IPV6MaxGroups(); + } elseif ($groupCount === $maxGroups) { + $this->warnings[IPV6Deprecated::CODE] = new IPV6Deprecated(); + } + } + + protected function doParseDomainPart() + { + $domain = ''; + $openedParenthesis = 0; + do { + $prev = $this->lexer->getPrevious(); + + $this->checkNotAllowedChars($this->lexer->token); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + $this->lexer->moveNext(); + $tmpPrev = $this->lexer->getPrevious(); + if ($tmpPrev['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + $openedParenthesis--; + } + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } else { + $openedParenthesis--; + } + } + + $this->checkConsecutiveDots(); + $this->checkDomainPartExceptions($prev); + + if ($this->hasBrackets()) { + $this->parseDomainLiteral(); + } + + $this->checkLabelLength($prev); + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $domain .= $this->lexer->token['value']; + $this->lexer->moveNext(); + } while (null !== $this->lexer->token['type']); + + return $domain; + } + + private function checkNotAllowedChars($token) + { + $notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true]; + if (isset($notAllowed[$token['type']])) { + throw new CharNotAllowed(); + } + } + + protected function parseDomainLiteral() + { + if ($this->lexer->isNextToken(EmailLexer::S_COLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + if ($this->lexer->isNextToken(EmailLexer::S_IPV6TAG)) { + $lexer = clone $this->lexer; + $lexer->moveNext(); + if ($lexer->isNextToken(EmailLexer::S_DOUBLECOLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + } + + return $this->doParseDomainLiteral(); + } + + protected function doParseDomainLiteral() + { + $IPv6TAG = false; + $addressLiteral = ''; + do { + if ($this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::INVALID || + $this->lexer->token['type'] === EmailLexer::C_DEL || + $this->lexer->token['type'] === EmailLexer::S_LF + ) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + } + + if ($this->lexer->isNextTokenAny(array(EmailLexer::S_OPENQBRACKET, EmailLexer::S_OPENBRACKET))) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->isNextTokenAny( + array(EmailLexer::S_HTAB, EmailLexer::S_SP, $this->lexer->token['type'] === EmailLexer::CRLF) + )) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $this->parseFWS(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_CR)) { + throw new CRNoLF(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + $addressLiteral .= $this->lexer->token['value']; + $this->lexer->moveNext(); + $this->validateQuotedPair(); + } + if ($this->lexer->token['type'] === EmailLexer::S_IPV6TAG) { + $IPv6TAG = true; + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEQBRACKET) { + break; + } + + $addressLiteral .= $this->lexer->token['value']; + + } while ($this->lexer->moveNext()); + + $addressLiteral = str_replace('[', '', $addressLiteral); + $addressLiteral = $this->checkIPV4Tag($addressLiteral); + + if (false === $addressLiteral) { + return $addressLiteral; + } + + if (!$IPv6TAG) { + $this->warnings[DomainLiteral::CODE] = new DomainLiteral(); + return $addressLiteral; + } + + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + + $this->checkIPV6Tag($addressLiteral); + + return $addressLiteral; + } + + protected function checkIPV4Tag($addressLiteral) + { + $matchesIP = array(); + + // Extract IPv4 part from the end of the address-literal (if there is one) + if (preg_match( + '/\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/', + $addressLiteral, + $matchesIP + ) > 0 + ) { + $index = strrpos($addressLiteral, $matchesIP[0]); + if ($index === 0) { + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + return false; + } + // Convert IPv4 part to IPv6 format for further testing + $addressLiteral = substr($addressLiteral, 0, $index) . '0:0'; + } + + return $addressLiteral; + } + + protected function checkDomainPartExceptions($prev) + { + $invalidDomainTokens = array( + EmailLexer::S_DQUOTE => true, + EmailLexer::S_SEMICOLON => true, + EmailLexer::S_GREATERTHAN => true, + EmailLexer::S_LOWERTHAN => true, + ); + + if (isset($invalidDomainTokens[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_COMMA) { + throw new CommaInDomain(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + throw new ConsecutiveAt(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENQBRACKET && $prev['type'] !== EmailLexer::S_AT) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new DomainHyphened(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH + && $this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + } + + protected function hasBrackets() + { + if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) { + return false; + } + + try { + $this->lexer->find(EmailLexer::S_CLOSEBRACKET); + } catch (\RuntimeException $e) { + throw new ExpectingDomainLiteralClose(); + } + + return true; + } + + protected function checkLabelLength($prev) + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && + $prev['type'] === EmailLexer::GENERIC && + strlen($prev['value']) > 63 + ) { + $this->warnings[LabelTooLong::CODE] = new LabelTooLong(); + } + } + + protected function parseDomainComments() + { + $this->isUnclosedComment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ExpectingATEXT(); + } + } + + protected function addTLDWarnings() + { + if ($this->warnings[DomainLiteral::CODE]) { + $this->warnings[TLD::CODE] = new TLD(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php new file mode 100644 index 0000000..fa1d17b --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php @@ -0,0 +1,138 @@ +lexer->token['type'] !== EmailLexer::S_AT && null !== $this->lexer->token['type']) { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']) { + throw new DotAtStart(); + } + + $closingQuote = $this->checkDQUOTE($closingQuote); + if ($closingQuote && $parseDQuote) { + $parseDQuote = $this->parseDoubleQuote(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } else { + $openedParenthesis--; + } + } + + $this->checkConsecutiveDots(); + + if ($this->lexer->token['type'] === EmailLexer::S_DOT && + $this->lexer->isNextToken(EmailLexer::S_AT) + ) { + throw new DotAtEnd(); + } + + $this->warnEscaping(); + $this->isInvalidToken($this->lexer->token, $closingQuote); + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $this->lexer->moveNext(); + } + + $prev = $this->lexer->getPrevious(); + if (strlen($prev['value']) > LocalTooLong::LOCAL_PART_LENGTH) { + $this->warnings[LocalTooLong::CODE] = new LocalTooLong(); + } + } + + protected function parseDoubleQuote() + { + $parseAgain = true; + $special = array( + EmailLexer::S_CR => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_LF => true + ); + + $invalid = array( + EmailLexer::C_NUL => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_CR => true, + EmailLexer::S_LF => true + ); + $setSpecialsWarning = true; + + $this->lexer->moveNext(); + + while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && null !== $this->lexer->token['type']) { + $parseAgain = false; + if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $setSpecialsWarning = false; + } + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH && $this->lexer->isNextToken(EmailLexer::S_DQUOTE)) { + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + + if (!$this->escaped() && isset($invalid[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + } + + $prev = $this->lexer->getPrevious(); + + if ($prev['type'] === EmailLexer::S_BACKSLASH) { + if (!$this->checkDQUOTE(false)) { + throw new UnclosedQuotedString(); + } + } + + if (!$this->lexer->isNextToken(EmailLexer::S_AT) && $prev['type'] !== EmailLexer::S_BACKSLASH) { + throw new ExpectingAT(); + } + + return $parseAgain; + } + + protected function isInvalidToken($token, $closingQuote) + { + $forbidden = array( + EmailLexer::S_COMMA, + EmailLexer::S_CLOSEBRACKET, + EmailLexer::S_OPENBRACKET, + EmailLexer::S_GREATERTHAN, + EmailLexer::S_LOWERTHAN, + EmailLexer::S_COLON, + EmailLexer::S_SEMICOLON, + EmailLexer::INVALID + ); + + if (in_array($token['type'], $forbidden) && !$closingQuote) { + throw new ExpectingATEXT(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php new file mode 100644 index 0000000..fa7bd44 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php @@ -0,0 +1,215 @@ +lexer = $lexer; + } + + public function getWarnings() + { + return $this->warnings; + } + + abstract public function parse($str); + + /** @return int */ + public function getOpenedParenthesis() + { + return $this->openedParenthesis; + } + + /** + * validateQuotedPair + */ + protected function validateQuotedPair() + { + if (!($this->lexer->token['type'] === EmailLexer::INVALID + || $this->lexer->token['type'] === EmailLexer::C_DEL)) { + throw new ExpectingQPair(); + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + } + + protected function parseComments() + { + $this->openedParenthesis = 1; + $this->isUnclosedComment(); + $this->warnings[Comment::CODE] = new Comment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + if ($this->lexer->isNextToken(EmailLexer::S_OPENPARENTHESIS)) { + $this->openedParenthesis++; + } + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextTokenAny(array(EmailLexer::GENERIC, EmailLexer::S_EMPTY))) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT)) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } + } + + protected function isUnclosedComment() + { + try { + $this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS); + return true; + } catch (\RuntimeException $e) { + throw new UnclosedComment(); + } + } + + protected function parseFWS() + { + $previous = $this->lexer->getPrevious(); + + $this->checkCRLFInFWS(); + + if ($this->lexer->token['type'] === EmailLexer::S_CR) { + throw new CRNoLF(); + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) { + throw new AtextAfterCFWS(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingCTEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } else { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + } + } + + protected function checkConsecutiveDots() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ConsecutiveDot(); + } + } + + protected function isFWS() + { + if ($this->escaped()) { + return false; + } + + if ($this->lexer->token['type'] === EmailLexer::S_SP || + $this->lexer->token['type'] === EmailLexer::S_HTAB || + $this->lexer->token['type'] === EmailLexer::S_CR || + $this->lexer->token['type'] === EmailLexer::S_LF || + $this->lexer->token['type'] === EmailLexer::CRLF + ) { + return true; + } + + return false; + } + + protected function escaped() + { + $previous = $this->lexer->getPrevious(); + + if ($previous['type'] === EmailLexer::S_BACKSLASH + && + $this->lexer->token['type'] !== EmailLexer::GENERIC + ) { + return true; + } + + return false; + } + + protected function warnEscaping() + { + if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) { + return false; + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB, EmailLexer::C_DEL))) { + return false; + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + return true; + + } + + protected function checkDQUOTE($hasClosingQuote) + { + if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) { + return $hasClosingQuote; + } + if ($hasClosingQuote) { + return $hasClosingQuote; + } + $previous = $this->lexer->getPrevious(); + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) { + throw new ExpectingATEXT(); + } + + try { + $this->lexer->find(EmailLexer::S_DQUOTE); + $hasClosingQuote = true; + } catch (\Exception $e) { + throw new UnclosedQuotedString(); + } + $this->warnings[QuotedString::CODE] = new QuotedString($previous['value'], $this->lexer->token['value']); + + return $hasClosingQuote; + } + + protected function checkCRLFInFWS() + { + if ($this->lexer->token['type'] !== EmailLexer::CRLF) { + return; + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFX2(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFAtTheEnd(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php new file mode 100644 index 0000000..e5c3e5d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php @@ -0,0 +1,72 @@ +checkDNS($host); + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } + + protected function checkDNS($host) + { + $variant = INTL_IDNA_VARIANT_2003; + if ( defined('INTL_IDNA_VARIANT_UTS46') ) { + $variant = INTL_IDNA_VARIANT_UTS46; + } + $host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.'; + + $Aresult = true; + $MXresult = checkdnsrr($host, 'MX'); + + if (!$MXresult) { + $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord(); + $Aresult = checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'); + if (!$Aresult) { + $this->error = new NoDNSRecord(); + } + } + return $MXresult || $Aresult; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php new file mode 100644 index 0000000..d5a015b --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php @@ -0,0 +1,34 @@ +errors = $errors; + parent::__construct(); + } + + public function getErrors() + { + return $this->errors; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php new file mode 100644 index 0000000..ce161ac --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php @@ -0,0 +1,111 @@ +validations = $validations; + $this->mode = $mode; + } + + /** + * {@inheritdoc} + */ + public function isValid($email, EmailLexer $emailLexer) + { + $result = true; + $errors = []; + foreach ($this->validations as $validation) { + $emailLexer->reset(); + $validationResult = $validation->isValid($email, $emailLexer); + $result = $result && $validationResult; + $this->warnings = array_merge($this->warnings, $validation->getWarnings()); + $errors = $this->addNewError($validation->getError(), $errors); + + if ($this->shouldStop($result)) { + break; + } + } + + if (!empty($errors)) { + $this->error = new MultipleErrors($errors); + } + + return $result; + } + + private function addNewError($possibleError, array $errors) + { + if (null !== $possibleError) { + $errors[] = $possibleError; + } + + return $errors; + } + + private function shouldStop($result) + { + return !$result && $this->mode === self::STOP_ON_ERROR; + } + + /** + * {@inheritdoc} + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + */ + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php new file mode 100644 index 0000000..e4bf0cc --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php @@ -0,0 +1,41 @@ +getWarnings())) { + return true; + } + + $this->error = new RFCWarnings(); + + return false; + } + + /** + * {@inheritdoc} + */ + public function getError() + { + return $this->error ?: parent::getError(); + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php new file mode 100644 index 0000000..c4ffe35 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php @@ -0,0 +1,49 @@ +parser = new EmailParser($emailLexer); + try { + $this->parser->parse((string)$email); + } catch (InvalidEmail $invalid) { + $this->error = $invalid; + return false; + } + + $this->warnings = $this->parser->getWarnings(); + return true; + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php new file mode 100644 index 0000000..4721f0d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php @@ -0,0 +1,45 @@ +setChecks(Spoofchecker::SINGLE_SCRIPT); + + if ($checker->isSuspicious($email)) { + $this->error = new SpoofEmail(); + } + + return $this->error === null; + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return []; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php new file mode 100644 index 0000000..77e70f7 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php @@ -0,0 +1,14 @@ +message = 'Address literal in domain part'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php new file mode 100644 index 0000000..be43bbe --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php @@ -0,0 +1,13 @@ +message = "Deprecated folding white space near @"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php new file mode 100644 index 0000000..dea3450 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php @@ -0,0 +1,13 @@ +message = 'Folding whites space followed by folding white space'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php new file mode 100644 index 0000000..704c290 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php @@ -0,0 +1,13 @@ +message = "Comments found in this email"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php new file mode 100644 index 0000000..ad43bd7 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php @@ -0,0 +1,13 @@ +message = 'Deprecated comments'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php new file mode 100644 index 0000000..6f36b5e --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php @@ -0,0 +1,14 @@ +message = 'Domain Literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php new file mode 100644 index 0000000..61ff17a --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php @@ -0,0 +1,14 @@ +message = 'Domain is too long, exceeds 255 chars'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php new file mode 100644 index 0000000..497309d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php @@ -0,0 +1,15 @@ +message = 'Email is too long, exceeds ' . EmailParser::EMAIL_MAX_LENGTH; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php new file mode 100644 index 0000000..ba2fcc0 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php @@ -0,0 +1,14 @@ +message = 'Bad char in IPV6 domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php new file mode 100644 index 0000000..41afa78 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php @@ -0,0 +1,14 @@ +message = ':: found at the end of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php new file mode 100644 index 0000000..1bf754e --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php @@ -0,0 +1,14 @@ +message = ':: found at the start of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php new file mode 100644 index 0000000..d752caa --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php @@ -0,0 +1,14 @@ +message = 'Deprecated form of IPV6'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php new file mode 100644 index 0000000..4f82394 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php @@ -0,0 +1,14 @@ +message = 'Double colon found after IPV6 tag'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php new file mode 100644 index 0000000..a59d317 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php @@ -0,0 +1,14 @@ +message = 'Group count is not IPV6 valid'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php new file mode 100644 index 0000000..936274c --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php @@ -0,0 +1,14 @@ +message = 'Reached the maximum number of IPV6 groups allowed'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php new file mode 100644 index 0000000..daf07f4 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php @@ -0,0 +1,14 @@ +message = 'Label too long'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php new file mode 100644 index 0000000..0d08d8b --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php @@ -0,0 +1,15 @@ +message = 'Local part is too long, exceeds 64 chars (octets)'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php new file mode 100644 index 0000000..b3c21a1 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php @@ -0,0 +1,14 @@ +message = 'No MX DSN record was found for this email'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php new file mode 100644 index 0000000..10f19e3 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php @@ -0,0 +1,14 @@ +rfcNumber = 5322; + $this->message = 'Obsolete DTEXT in domain literal'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php new file mode 100644 index 0000000..7be9e6a --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php @@ -0,0 +1,13 @@ +message = "Deprecated Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php new file mode 100644 index 0000000..e9d56e1 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php @@ -0,0 +1,13 @@ +message = "Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php new file mode 100644 index 0000000..2338b9f --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php @@ -0,0 +1,13 @@ +message = "RFC5321, TLD"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php new file mode 100644 index 0000000..ec6a365 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php @@ -0,0 +1,30 @@ +message; + } + + public function code() + { + return self::CODE; + } + + public function RFCNumber() + { + return $this->rfcNumber; + } + + public function __toString() + { + return $this->message() . " rfc: " . $this->rfcNumber . "interal code: " . static::CODE; + } +} diff --git a/vendor/egulias/email-validator/LICENSE b/vendor/egulias/email-validator/LICENSE new file mode 100644 index 0000000..c34d2c1 --- /dev/null +++ b/vendor/egulias/email-validator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2016 Eduardo Gulias Davis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/egulias/email-validator/README.md b/vendor/egulias/email-validator/README.md new file mode 100644 index 0000000..b5b0d85 --- /dev/null +++ b/vendor/egulias/email-validator/README.md @@ -0,0 +1,82 @@ +# EmailValidator +[![Build Status](https://travis-ci.org/egulias/EmailValidator.svg?branch=master)](https://travis-ci.org/egulias/EmailValidator) [![Coverage Status](https://coveralls.io/repos/egulias/EmailValidator/badge.svg?branch=master)](https://coveralls.io/r/egulias/EmailValidator?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egulias/EmailValidator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6/small.png)](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6) +============================= +## Suported RFCs ## +This library aims to support: + +RFC 5321, 5322, 6530, 6531, 6532. + +## Requirements ## + + * [Composer](https://getcomposer.org) is required for installation + * [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) and [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) validation requires that your PHP system has the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl) + +## Installation ## + +Run the command below to install via Composer + +```shell +composer require egulias/email-validator +``` + +## Getting Started ## +`EmailValidator`requires you to decide which (or combination of them) validation/s strategy/ies you'd like to follow for each [validation](#available-validations). + +A basic example with the RFC validation +```php +isValid("example@example.com", new RFCValidation()); //true +``` + + +### Available validations ### + +1. [RFCValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/RFCValidation.php) +2. [NoRFCWarningsValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/NoRFCWarningsValidation.php) +3. [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) +4. [SpoofCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) +5. [MultipleValidationWithAnd](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/MultipleValidationWithAnd.php) +6. [Your own validation](#how-to-extend) + +`MultipleValidationWithAnd` + +It is a validation that operates over other validations performing a logical and (&&) over the result of each validation. + +```php +isValid("example@example.com", $multipleValidations); //true +``` + +### How to extend ### + +It's easy! You just need to implement [EmailValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/EmailValidation.php) and you can use your own validation. + + +## Other Contributors ## +(You can find current contributors [here](https://github.com/egulias/EmailValidator/graphs/contributors)) + +As this is a port from another library and work, here are other people related to the previous one: + +* Ricard Clau [@ricardclau](https://github.com/ricardclau): Performance against PHP built-in filter_var +* Josepf Bielawski [@stloyd](https://github.com/stloyd): For its first re-work of Dominic's lib +* Dominic Sayers [@dominicsayers](https://github.com/dominicsayers): The original isemail function + +## License ## +Released under the MIT License attached with this code. + diff --git a/vendor/egulias/email-validator/composer.json b/vendor/egulias/email-validator/composer.json new file mode 100644 index 0000000..4956da9 --- /dev/null +++ b/vendor/egulias/email-validator/composer.json @@ -0,0 +1,45 @@ +{ + "name": "egulias/email-validator", + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "type": "Library", + "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"], + "license": "MIT", + "authors": [ + {"name": "Eduardo Gulias Davis"} + ], + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/dominicsayers/isemail" + } + ], + "require": { + "php": ">= 5.5", + "doctrine/lexer": "^1.0.1" + }, + "require-dev" : { + "satooshi/php-coveralls": "^1.0.1", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "symfony/phpunit-bridge": "^4.4@dev", + "dominicsayers/isemail": "dev-master" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "autoload-dev": { + "psr-4": { + "Egulias\\Tests\\": "test" + } + } +} diff --git a/vendor/egulias/email-validator/phpunit.xml.dist b/vendor/egulias/email-validator/phpunit.xml.dist new file mode 100644 index 0000000..754445a --- /dev/null +++ b/vendor/egulias/email-validator/phpunit.xml.dist @@ -0,0 +1,29 @@ + + + + + + ./Tests/EmailValidator + ./vendor/ + + + + + + ./EmailValidator/ + + + + + + + diff --git a/vendor/fig/http-message-util/.gitignore b/vendor/fig/http-message-util/.gitignore new file mode 100644 index 0000000..48b8bf9 --- /dev/null +++ b/vendor/fig/http-message-util/.gitignore @@ -0,0 +1 @@ +vendor/ diff --git a/vendor/fig/http-message-util/CHANGELOG.md b/vendor/fig/http-message-util/CHANGELOG.md new file mode 100644 index 0000000..a557f57 --- /dev/null +++ b/vendor/fig/http-message-util/CHANGELOG.md @@ -0,0 +1,103 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.1.3 - 2018-11-19 + +### Added + +- [#10](https://github.com/php-fig/http-message-util/pull/10) adds the constants `StatusCodeInterface::STATUS_EARLY_HINTS` (103) and + `StatusCodeInterface::STATUS_TOO_EARLY (425). + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.2 - 2017-02-09 + +### Added + +- [#4](https://github.com/php-fig/http-message-util/pull/4) adds the constant + `StatusCodeInterface::STATUS_MISDIRECTED_REQUEST` (421). + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.1 - 2017-02-06 + +### Added + +- [#3](https://github.com/php-fig/http-message-util/pull/3) adds the constant + `StatusCodeInterface::STATUS_IM_A_TEAPOT` (418). + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.0 - 2016-09-19 + +### Added + +- [#1](https://github.com/php-fig/http-message-util/pull/1) adds + `Fig\Http\Message\StatusCodeInterface`, with constants named after common + status reason phrases, with values indicating the status codes themselves. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.0.0 - 2017-08-05 + +### Added + +- Adds `Fig\Http\Message\RequestMethodInterface`, with constants covering the + most common HTTP request methods as specified by the IETF. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/vendor/fig/http-message-util/LICENSE b/vendor/fig/http-message-util/LICENSE new file mode 100644 index 0000000..e2fa347 --- /dev/null +++ b/vendor/fig/http-message-util/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/fig/http-message-util/README.md b/vendor/fig/http-message-util/README.md new file mode 100644 index 0000000..56cee17 --- /dev/null +++ b/vendor/fig/http-message-util/README.md @@ -0,0 +1,17 @@ +# PSR Http Message Util + +This repository holds utility classes and constants to facilitate common +operations of [PSR-7](http://www.php-fig.org/psr/psr-7/); the primary purpose is +to provide constants for referring to request methods, response status codes and +messages, and potentially common headers. + +Implementation of PSR-7 interfaces is **not** within the scope of this package. + +## Installation + +Install by adding the package as a [Composer](https://getcomposer.org) +requirement: + +```bash +$ composer require fig/http-message-util +``` diff --git a/vendor/fig/http-message-util/composer.json b/vendor/fig/http-message-util/composer.json new file mode 100644 index 0000000..37ff9cc --- /dev/null +++ b/vendor/fig/http-message-util/composer.json @@ -0,0 +1,26 @@ +{ + "name": "fig/http-message-util", + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": "^5.3 || ^7.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + } +} diff --git a/vendor/fig/http-message-util/src/RequestMethodInterface.php b/vendor/fig/http-message-util/src/RequestMethodInterface.php new file mode 100644 index 0000000..97d9a93 --- /dev/null +++ b/vendor/fig/http-message-util/src/RequestMethodInterface.php @@ -0,0 +1,34 @@ + + * class RequestFactory implements RequestMethodInterface + * { + * public static function factory( + * $uri = '/', + * $method = self::METHOD_GET, + * $data = [] + * ) { + * } + * } + * + */ +interface RequestMethodInterface +{ + const METHOD_HEAD = 'HEAD'; + const METHOD_GET = 'GET'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_PATCH = 'PATCH'; + const METHOD_DELETE = 'DELETE'; + const METHOD_PURGE = 'PURGE'; + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_TRACE = 'TRACE'; + const METHOD_CONNECT = 'CONNECT'; +} diff --git a/vendor/fig/http-message-util/src/StatusCodeInterface.php b/vendor/fig/http-message-util/src/StatusCodeInterface.php new file mode 100644 index 0000000..99b7e78 --- /dev/null +++ b/vendor/fig/http-message-util/src/StatusCodeInterface.php @@ -0,0 +1,107 @@ + + * class ResponseFactory implements StatusCodeInterface + * { + * public function createResponse($code = self::STATUS_OK) + * { + * } + * } + * + */ +interface StatusCodeInterface +{ + // Informational 1xx + const STATUS_CONTINUE = 100; + const STATUS_SWITCHING_PROTOCOLS = 101; + const STATUS_PROCESSING = 102; + const STATUS_EARLY_HINTS = 103; + // Successful 2xx + const STATUS_OK = 200; + const STATUS_CREATED = 201; + const STATUS_ACCEPTED = 202; + const STATUS_NON_AUTHORITATIVE_INFORMATION = 203; + const STATUS_NO_CONTENT = 204; + const STATUS_RESET_CONTENT = 205; + const STATUS_PARTIAL_CONTENT = 206; + const STATUS_MULTI_STATUS = 207; + const STATUS_ALREADY_REPORTED = 208; + const STATUS_IM_USED = 226; + // Redirection 3xx + const STATUS_MULTIPLE_CHOICES = 300; + const STATUS_MOVED_PERMANENTLY = 301; + const STATUS_FOUND = 302; + const STATUS_SEE_OTHER = 303; + const STATUS_NOT_MODIFIED = 304; + const STATUS_USE_PROXY = 305; + const STATUS_RESERVED = 306; + const STATUS_TEMPORARY_REDIRECT = 307; + const STATUS_PERMANENT_REDIRECT = 308; + // Client Errors 4xx + const STATUS_BAD_REQUEST = 400; + const STATUS_UNAUTHORIZED = 401; + const STATUS_PAYMENT_REQUIRED = 402; + const STATUS_FORBIDDEN = 403; + const STATUS_NOT_FOUND = 404; + const STATUS_METHOD_NOT_ALLOWED = 405; + const STATUS_NOT_ACCEPTABLE = 406; + const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; + const STATUS_REQUEST_TIMEOUT = 408; + const STATUS_CONFLICT = 409; + const STATUS_GONE = 410; + const STATUS_LENGTH_REQUIRED = 411; + const STATUS_PRECONDITION_FAILED = 412; + const STATUS_PAYLOAD_TOO_LARGE = 413; + const STATUS_URI_TOO_LONG = 414; + const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; + const STATUS_RANGE_NOT_SATISFIABLE = 416; + const STATUS_EXPECTATION_FAILED = 417; + const STATUS_IM_A_TEAPOT = 418; + const STATUS_MISDIRECTED_REQUEST = 421; + const STATUS_UNPROCESSABLE_ENTITY = 422; + const STATUS_LOCKED = 423; + const STATUS_FAILED_DEPENDENCY = 424; + const STATUS_TOO_EARLY = 425; + const STATUS_UPGRADE_REQUIRED = 426; + const STATUS_PRECONDITION_REQUIRED = 428; + const STATUS_TOO_MANY_REQUESTS = 429; + const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + const STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451; + // Server Errors 5xx + const STATUS_INTERNAL_SERVER_ERROR = 500; + const STATUS_NOT_IMPLEMENTED = 501; + const STATUS_BAD_GATEWAY = 502; + const STATUS_SERVICE_UNAVAILABLE = 503; + const STATUS_GATEWAY_TIMEOUT = 504; + const STATUS_VERSION_NOT_SUPPORTED = 505; + const STATUS_VARIANT_ALSO_NEGOTIATES = 506; + const STATUS_INSUFFICIENT_STORAGE = 507; + const STATUS_LOOP_DETECTED = 508; + const STATUS_NOT_EXTENDED = 510; + const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; +} diff --git a/vendor/filp/whoops/CHANGELOG.md b/vendor/filp/whoops/CHANGELOG.md new file mode 100644 index 0000000..f6c0f6d --- /dev/null +++ b/vendor/filp/whoops/CHANGELOG.md @@ -0,0 +1,41 @@ +# 2.5.0 + +* Automatically configure xdebug if available. + +# 2.4.1 + +* Try harder to close all output buffers + +# 2.4.0 + +* Allow to prepend and append handlers. + +# 2.3.2 + +* Various fixes from the community. + +# 2.3.1 + +* Prevent exception in Whoops when caught exception frame is not related to real file + +# 2.3.0 + +* Show previous exception messages. + +# 2.2.0 + +* Support PHP 7.2 + +# 2.1.0 + +* Add a `SystemFacade` to allow clients to override Whoops behavior. +* Show frame arguments in `PrettyPageHandler`. +* Highlight the line with the error. +* Add icons to search on Google and Stack Overflow. + +# 2.0.0 + +Backwards compatibility breaking changes: + +* `Run` class is now `final`. If you inherited from `Run`, please now instead use a custom `SystemFacade` injected into the `Run` constructor, or contribute your changes to our core. +* PHP < 5.5 support dropped. diff --git a/vendor/filp/whoops/LICENSE.md b/vendor/filp/whoops/LICENSE.md new file mode 100644 index 0000000..80407e7 --- /dev/null +++ b/vendor/filp/whoops/LICENSE.md @@ -0,0 +1,19 @@ +# The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/filp/whoops/composer.json b/vendor/filp/whoops/composer.json new file mode 100644 index 0000000..51ab373 --- /dev/null +++ b/vendor/filp/whoops/composer.json @@ -0,0 +1,42 @@ +{ + "name": "filp/whoops", + "license": "MIT", + "description": "php error handling for cool kids", + "keywords": ["library", "error", "handling", "exception", "whoops", "throwable"], + "homepage": "https://filp.github.io/whoops/", + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "require": { + "php": "^5.5.9 || ^7.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "mockery/mockery": "^0.9 || ^1.0", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "autoload-dev": { + "psr-4": { + "Whoops\\": "tests/Whoops/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php b/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php new file mode 100644 index 0000000..d74e823 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php @@ -0,0 +1,17 @@ + + */ + +namespace Whoops\Exception; + +use ErrorException as BaseErrorException; + +/** + * Wraps ErrorException; mostly used for typing (at least now) + * to easily cleanup the stack trace of redundant info. + */ +class ErrorException extends BaseErrorException +{ +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Formatter.php b/vendor/filp/whoops/src/Whoops/Exception/Formatter.php new file mode 100644 index 0000000..e467559 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Formatter.php @@ -0,0 +1,73 @@ + + */ + +namespace Whoops\Exception; + +class Formatter +{ + /** + * Returns all basic information about the exception in a simple array + * for further convertion to other languages + * @param Inspector $inspector + * @param bool $shouldAddTrace + * @return array + */ + public static function formatExceptionAsDataArray(Inspector $inspector, $shouldAddTrace) + { + $exception = $inspector->getException(); + $response = [ + 'type' => get_class($exception), + 'message' => $exception->getMessage(), + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + ]; + + if ($shouldAddTrace) { + $frames = $inspector->getFrames(); + $frameData = []; + + foreach ($frames as $frame) { + /** @var Frame $frame */ + $frameData[] = [ + 'file' => $frame->getFile(), + 'line' => $frame->getLine(), + 'function' => $frame->getFunction(), + 'class' => $frame->getClass(), + 'args' => $frame->getArgs(), + ]; + } + + $response['trace'] = $frameData; + } + + return $response; + } + + public static function formatExceptionPlain(Inspector $inspector) + { + $message = $inspector->getException()->getMessage(); + $frames = $inspector->getFrames(); + + $plain = $inspector->getExceptionName(); + $plain .= ' thrown with message "'; + $plain .= $message; + $plain .= '"'."\n\n"; + + $plain .= "Stacktrace:\n"; + foreach ($frames as $i => $frame) { + $plain .= "#". (count($frames) - $i - 1). " "; + $plain .= $frame->getClass() ?: ''; + $plain .= $frame->getClass() && $frame->getFunction() ? ":" : ""; + $plain .= $frame->getFunction() ?: ''; + $plain .= ' in '; + $plain .= ($frame->getFile() ?: '<#unknown>'); + $plain .= ':'; + $plain .= (int) $frame->getLine(). "\n"; + } + + return $plain; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Frame.php b/vendor/filp/whoops/src/Whoops/Exception/Frame.php new file mode 100644 index 0000000..f63e2a4 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Frame.php @@ -0,0 +1,295 @@ + + */ + +namespace Whoops\Exception; + +use InvalidArgumentException; +use Serializable; + +class Frame implements Serializable +{ + /** + * @var array + */ + protected $frame; + + /** + * @var string + */ + protected $fileContentsCache; + + /** + * @var array[] + */ + protected $comments = []; + + /** + * @var bool + */ + protected $application; + + /** + * @param array[] + */ + public function __construct(array $frame) + { + $this->frame = $frame; + } + + /** + * @param bool $shortened + * @return string|null + */ + public function getFile($shortened = false) + { + if (empty($this->frame['file'])) { + return null; + } + + $file = $this->frame['file']; + + // Check if this frame occurred within an eval(). + // @todo: This can be made more reliable by checking if we've entered + // eval() in a previous trace, but will need some more work on the upper + // trace collector(s). + if (preg_match('/^(.*)\((\d+)\) : (?:eval\(\)\'d|assert) code$/', $file, $matches)) { + $file = $this->frame['file'] = $matches[1]; + $this->frame['line'] = (int) $matches[2]; + } + + if ($shortened && is_string($file)) { + // Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks. + $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + if ($dirname !== '/') { + $file = str_replace($dirname, "…", $file); + } + $file = str_replace("/", "/­", $file); + } + + return $file; + } + + /** + * @return int|null + */ + public function getLine() + { + return isset($this->frame['line']) ? $this->frame['line'] : null; + } + + /** + * @return string|null + */ + public function getClass() + { + return isset($this->frame['class']) ? $this->frame['class'] : null; + } + + /** + * @return string|null + */ + public function getFunction() + { + return isset($this->frame['function']) ? $this->frame['function'] : null; + } + + /** + * @return array + */ + public function getArgs() + { + return isset($this->frame['args']) ? (array) $this->frame['args'] : []; + } + + /** + * Returns the full contents of the file for this frame, + * if it's known. + * @return string|null + */ + public function getFileContents() + { + if ($this->fileContentsCache === null && $filePath = $this->getFile()) { + // Leave the stage early when 'Unknown' or '[internal]' is passed + // this would otherwise raise an exception when + // open_basedir is enabled. + if ($filePath === "Unknown" || $filePath === '[internal]') { + return null; + } + + try { + $this->fileContentsCache = file_get_contents($filePath); + } catch (ErrorException $exception) { + // Internal file paths of PHP extensions cannot be opened + } + } + + return $this->fileContentsCache; + } + + /** + * Adds a comment to this frame, that can be received and + * used by other handlers. For example, the PrettyPage handler + * can attach these comments under the code for each frame. + * + * An interesting use for this would be, for example, code analysis + * & annotations. + * + * @param string $comment + * @param string $context Optional string identifying the origin of the comment + */ + public function addComment($comment, $context = 'global') + { + $this->comments[] = [ + 'comment' => $comment, + 'context' => $context, + ]; + } + + /** + * Returns all comments for this frame. Optionally allows + * a filter to only retrieve comments from a specific + * context. + * + * @param string $filter + * @return array[] + */ + public function getComments($filter = null) + { + $comments = $this->comments; + + if ($filter !== null) { + $comments = array_filter($comments, function ($c) use ($filter) { + return $c['context'] == $filter; + }); + } + + return $comments; + } + + /** + * Returns the array containing the raw frame data from which + * this Frame object was built + * + * @return array + */ + public function getRawFrame() + { + return $this->frame; + } + + /** + * Returns the contents of the file for this frame as an + * array of lines, and optionally as a clamped range of lines. + * + * NOTE: lines are 0-indexed + * + * @example + * Get all lines for this file + * $frame->getFileLines(); // => array( 0 => ' '...', ...) + * @example + * Get one line for this file, starting at line 10 (zero-indexed, remember!) + * $frame->getFileLines(9, 1); // array( 10 => '...', 11 => '...') + * + * @throws InvalidArgumentException if $length is less than or equal to 0 + * @param int $start + * @param int $length + * @return string[]|null + */ + public function getFileLines($start = 0, $length = null) + { + if (null !== ($contents = $this->getFileContents())) { + $lines = explode("\n", $contents); + + // Get a subset of lines from $start to $end + if ($length !== null) { + $start = (int) $start; + $length = (int) $length; + if ($start < 0) { + $start = 0; + } + + if ($length <= 0) { + throw new InvalidArgumentException( + "\$length($length) cannot be lower or equal to 0" + ); + } + + $lines = array_slice($lines, $start, $length, true); + } + + return $lines; + } + } + + /** + * Implements the Serializable interface, with special + * steps to also save the existing comments. + * + * @see Serializable::serialize + * @return string + */ + public function serialize() + { + $frame = $this->frame; + if (!empty($this->comments)) { + $frame['_comments'] = $this->comments; + } + + return serialize($frame); + } + + /** + * Unserializes the frame data, while also preserving + * any existing comment data. + * + * @see Serializable::unserialize + * @param string $serializedFrame + */ + public function unserialize($serializedFrame) + { + $frame = unserialize($serializedFrame); + + if (!empty($frame['_comments'])) { + $this->comments = $frame['_comments']; + unset($frame['_comments']); + } + + $this->frame = $frame; + } + + /** + * Compares Frame against one another + * @param Frame $frame + * @return bool + */ + public function equals(Frame $frame) + { + if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) { + return false; + } + return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine(); + } + + /** + * Returns whether this frame belongs to the application or not. + * + * @return boolean + */ + public function isApplication() + { + return $this->application; + } + + /** + * Mark as an frame belonging to the application. + * + * @param boolean $application + */ + public function setApplication($application) + { + $this->application = $application; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php b/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php new file mode 100644 index 0000000..b043a1c --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php @@ -0,0 +1,203 @@ + + */ + +namespace Whoops\Exception; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; +use Serializable; +use UnexpectedValueException; + +/** + * Exposes a fluent interface for dealing with an ordered list + * of stack-trace frames. + */ +class FrameCollection implements ArrayAccess, IteratorAggregate, Serializable, Countable +{ + /** + * @var array[] + */ + private $frames; + + /** + * @param array $frames + */ + public function __construct(array $frames) + { + $this->frames = array_map(function ($frame) { + return new Frame($frame); + }, $frames); + } + + /** + * Filters frames using a callable, returns the same FrameCollection + * + * @param callable $callable + * @return FrameCollection + */ + public function filter($callable) + { + $this->frames = array_values(array_filter($this->frames, $callable)); + return $this; + } + + /** + * Map the collection of frames + * + * @param callable $callable + * @return FrameCollection + */ + public function map($callable) + { + // Contain the map within a higher-order callable + // that enforces type-correctness for the $callable + $this->frames = array_map(function ($frame) use ($callable) { + $frame = call_user_func($callable, $frame); + + if (!$frame instanceof Frame) { + throw new UnexpectedValueException( + "Callable to " . __METHOD__ . " must return a Frame object" + ); + } + + return $frame; + }, $this->frames); + + return $this; + } + + /** + * Returns an array with all frames, does not affect + * the internal array. + * + * @todo If this gets any more complex than this, + * have getIterator use this method. + * @see FrameCollection::getIterator + * @return array + */ + public function getArray() + { + return $this->frames; + } + + /** + * @see IteratorAggregate::getIterator + * @return ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->frames); + } + + /** + * @see ArrayAccess::offsetExists + * @param int $offset + */ + public function offsetExists($offset) + { + return isset($this->frames[$offset]); + } + + /** + * @see ArrayAccess::offsetGet + * @param int $offset + */ + public function offsetGet($offset) + { + return $this->frames[$offset]; + } + + /** + * @see ArrayAccess::offsetSet + * @param int $offset + */ + public function offsetSet($offset, $value) + { + throw new \Exception(__CLASS__ . ' is read only'); + } + + /** + * @see ArrayAccess::offsetUnset + * @param int $offset + */ + public function offsetUnset($offset) + { + throw new \Exception(__CLASS__ . ' is read only'); + } + + /** + * @see Countable::count + * @return int + */ + public function count() + { + return count($this->frames); + } + + /** + * Count the frames that belongs to the application. + * + * @return int + */ + public function countIsApplication() + { + return count(array_filter($this->frames, function (Frame $f) { + return $f->isApplication(); + })); + } + + /** + * @see Serializable::serialize + * @return string + */ + public function serialize() + { + return serialize($this->frames); + } + + /** + * @see Serializable::unserialize + * @param string $serializedFrames + */ + public function unserialize($serializedFrames) + { + $this->frames = unserialize($serializedFrames); + } + + /** + * @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious() + */ + public function prependFrames(array $frames) + { + $this->frames = array_merge($frames, $this->frames); + } + + /** + * Gets the innermost part of stack trace that is not the same as that of outer exception + * + * @param FrameCollection $parentFrames Outer exception frames to compare tail against + * @return Frame[] + */ + public function topDiff(FrameCollection $parentFrames) + { + $diff = $this->frames; + + $parentFrames = $parentFrames->getArray(); + $p = count($parentFrames)-1; + + for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) { + /** @var Frame $tailFrame */ + $tailFrame = $diff[$i]; + if ($tailFrame->equals($parentFrames[$p])) { + unset($diff[$i]); + } + $p--; + } + return $diff; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Inspector.php b/vendor/filp/whoops/src/Whoops/Exception/Inspector.php new file mode 100644 index 0000000..04f72df --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Inspector.php @@ -0,0 +1,323 @@ + + */ + +namespace Whoops\Exception; + +use Whoops\Util\Misc; + +class Inspector +{ + /** + * @var \Throwable + */ + private $exception; + + /** + * @var \Whoops\Exception\FrameCollection + */ + private $frames; + + /** + * @var \Whoops\Exception\Inspector + */ + private $previousExceptionInspector; + + /** + * @var \Throwable[] + */ + private $previousExceptions; + + /** + * @param \Throwable $exception The exception to inspect + */ + public function __construct($exception) + { + $this->exception = $exception; + } + + /** + * @return \Throwable + */ + public function getException() + { + return $this->exception; + } + + /** + * @return string + */ + public function getExceptionName() + { + return get_class($this->exception); + } + + /** + * @return string + */ + public function getExceptionMessage() + { + return $this->extractDocrefUrl($this->exception->getMessage())['message']; + } + + /** + * @return string[] + */ + public function getPreviousExceptionMessages() + { + return array_map(function ($prev) { + /** @var \Throwable $prev */ + return $this->extractDocrefUrl($prev->getMessage())['message']; + }, $this->getPreviousExceptions()); + } + + /** + * @return int[] + */ + public function getPreviousExceptionCodes() + { + return array_map(function ($prev) { + /** @var \Throwable $prev */ + return $prev->getCode(); + }, $this->getPreviousExceptions()); + } + + /** + * Returns a url to the php-manual related to the underlying error - when available. + * + * @return string|null + */ + public function getExceptionDocrefUrl() + { + return $this->extractDocrefUrl($this->exception->getMessage())['url']; + } + + private function extractDocrefUrl($message) + { + $docref = [ + 'message' => $message, + 'url' => null, + ]; + + // php embbeds urls to the manual into the Exception message with the following ini-settings defined + // http://php.net/manual/en/errorfunc.configuration.php#ini.docref-root + if (!ini_get('html_errors') || !ini_get('docref_root')) { + return $docref; + } + + $pattern = "/\[(?:[^<]+)<\/a>\]/"; + if (preg_match($pattern, $message, $matches)) { + // -> strip those automatically generated links from the exception message + $docref['message'] = preg_replace($pattern, '', $message, 1); + $docref['url'] = $matches[1]; + } + + return $docref; + } + + /** + * Does the wrapped Exception has a previous Exception? + * @return bool + */ + public function hasPreviousException() + { + return $this->previousExceptionInspector || $this->exception->getPrevious(); + } + + /** + * Returns an Inspector for a previous Exception, if any. + * @todo Clean this up a bit, cache stuff a bit better. + * @return Inspector + */ + public function getPreviousExceptionInspector() + { + if ($this->previousExceptionInspector === null) { + $previousException = $this->exception->getPrevious(); + + if ($previousException) { + $this->previousExceptionInspector = new Inspector($previousException); + } + } + + return $this->previousExceptionInspector; + } + + + /** + * Returns an array of all previous exceptions for this inspector's exception + * @return \Throwable[] + */ + public function getPreviousExceptions() + { + if ($this->previousExceptions === null) { + $this->previousExceptions = []; + + $prev = $this->exception->getPrevious(); + while ($prev !== null) { + $this->previousExceptions[] = $prev; + $prev = $prev->getPrevious(); + } + } + + return $this->previousExceptions; + } + + /** + * Returns an iterator for the inspected exception's + * frames. + * @return \Whoops\Exception\FrameCollection + */ + public function getFrames() + { + if ($this->frames === null) { + $frames = $this->getTrace($this->exception); + + // Fill empty line/file info for call_user_func_array usages (PHP Bug #44428) + foreach ($frames as $k => $frame) { + if (empty($frame['file'])) { + // Default values when file and line are missing + $file = '[internal]'; + $line = 0; + + $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : []; + + if ($this->isValidNextFrame($next_frame)) { + $file = $next_frame['file']; + $line = $next_frame['line']; + } + + $frames[$k]['file'] = $file; + $frames[$k]['line'] = $line; + } + } + + // Find latest non-error handling frame index ($i) used to remove error handling frames + $i = 0; + foreach ($frames as $k => $frame) { + if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) { + $i = $k; + } + } + + // Remove error handling frames + if ($i > 0) { + array_splice($frames, 0, $i); + } + + $firstFrame = $this->getFrameFromException($this->exception); + array_unshift($frames, $firstFrame); + + $this->frames = new FrameCollection($frames); + + if ($previousInspector = $this->getPreviousExceptionInspector()) { + // Keep outer frame on top of the inner one + $outerFrames = $this->frames; + $newFrames = clone $previousInspector->getFrames(); + // I assume it will always be set, but let's be safe + if (isset($newFrames[0])) { + $newFrames[0]->addComment( + $previousInspector->getExceptionMessage(), + 'Exception message:' + ); + } + $newFrames->prependFrames($outerFrames->topDiff($newFrames)); + $this->frames = $newFrames; + } + } + + return $this->frames; + } + + /** + * Gets the backtrace from an exception. + * + * If xdebug is installed + * + * @param \Throwable $e + * @return array + */ + protected function getTrace($e) + { + $traces = $e->getTrace(); + + // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default + if (!$e instanceof \ErrorException) { + return $traces; + } + + if (!Misc::isLevelFatal($e->getSeverity())) { + return $traces; + } + + if (!extension_loaded('xdebug') || !xdebug_is_enabled()) { + return $traces; + } + + // Use xdebug to get the full stack trace and remove the shutdown handler stack trace + $stack = array_reverse(xdebug_get_function_stack()); + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $traces = array_diff_key($stack, $trace); + + return $traces; + } + + /** + * Given an exception, generates an array in the format + * generated by Exception::getTrace() + * @param \Throwable $exception + * @return array + */ + protected function getFrameFromException($exception) + { + return [ + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'class' => get_class($exception), + 'args' => [ + $exception->getMessage(), + ], + ]; + } + + /** + * Given an error, generates an array in the format + * generated by ErrorException + * @param ErrorException $exception + * @return array + */ + protected function getFrameFromError(ErrorException $exception) + { + return [ + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'class' => null, + 'args' => [], + ]; + } + + /** + * Determine if the frame can be used to fill in previous frame's missing info + * happens for call_user_func and call_user_func_array usages (PHP Bug #44428) + * + * @param array $frame + * @return bool + */ + protected function isValidNextFrame(array $frame) + { + if (empty($frame['file'])) { + return false; + } + + if (empty($frame['line'])) { + return false; + } + + if (empty($frame['function']) || !stristr($frame['function'], 'call_user_func')) { + return false; + } + + return true; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php b/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php new file mode 100644 index 0000000..cc46e70 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php @@ -0,0 +1,52 @@ + + */ + +namespace Whoops\Handler; + +use InvalidArgumentException; + +/** + * Wrapper for Closures passed as handlers. Can be used + * directly, or will be instantiated automagically by Whoops\Run + * if passed to Run::pushHandler + */ +class CallbackHandler extends Handler +{ + /** + * @var callable + */ + protected $callable; + + /** + * @throws InvalidArgumentException If argument is not callable + * @param callable $callable + */ + public function __construct($callable) + { + if (!is_callable($callable)) { + throw new InvalidArgumentException( + 'Argument to ' . __METHOD__ . ' must be valid callable' + ); + } + + $this->callable = $callable; + } + + /** + * @return int|null + */ + public function handle() + { + $exception = $this->getException(); + $inspector = $this->getInspector(); + $run = $this->getRun(); + $callable = $this->callable; + + // invoke the callable directly, to get simpler stacktraces (in comparison to call_user_func). + // this assumes that $callable is a properly typed php-callable, which we check in __construct(). + return $callable($exception, $inspector, $run); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/Handler.php b/vendor/filp/whoops/src/Whoops/Handler/Handler.php new file mode 100644 index 0000000..cf1f708 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/Handler.php @@ -0,0 +1,95 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Exception\Inspector; +use Whoops\RunInterface; + +/** + * Abstract implementation of a Handler. + */ +abstract class Handler implements HandlerInterface +{ + /* + Return constants that can be returned from Handler::handle + to message the handler walker. + */ + const DONE = 0x10; // returning this is optional, only exists for + // semantic purposes + /** + * The Handler has handled the Throwable in some way, and wishes to skip any other Handler. + * Execution will continue. + */ + const LAST_HANDLER = 0x20; + /** + * The Handler has handled the Throwable in some way, and wishes to quit/stop execution + */ + const QUIT = 0x30; + + /** + * @var RunInterface + */ + private $run; + + /** + * @var Inspector $inspector + */ + private $inspector; + + /** + * @var \Throwable $exception + */ + private $exception; + + /** + * @param RunInterface $run + */ + public function setRun(RunInterface $run) + { + $this->run = $run; + } + + /** + * @return RunInterface + */ + protected function getRun() + { + return $this->run; + } + + /** + * @param Inspector $inspector + */ + public function setInspector(Inspector $inspector) + { + $this->inspector = $inspector; + } + + /** + * @return Inspector + */ + protected function getInspector() + { + return $this->inspector; + } + + /** + * @param \Throwable $exception + */ + public function setException($exception) + { + $this->exception = $exception; + } + + /** + * @return \Throwable + */ + protected function getException() + { + return $this->exception; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php b/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php new file mode 100644 index 0000000..0265a85 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php @@ -0,0 +1,36 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Exception\Inspector; +use Whoops\RunInterface; + +interface HandlerInterface +{ + /** + * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant + */ + public function handle(); + + /** + * @param RunInterface $run + * @return void + */ + public function setRun(RunInterface $run); + + /** + * @param \Throwable $exception + * @return void + */ + public function setException($exception); + + /** + * @param Inspector $inspector + * @return void + */ + public function setInspector(Inspector $inspector); +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php new file mode 100644 index 0000000..fdd7ead --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php @@ -0,0 +1,88 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Exception\Formatter; + +/** + * Catches an exception and converts it to a JSON + * response. Additionally can also return exception + * frames for consumption by an API. + */ +class JsonResponseHandler extends Handler +{ + /** + * @var bool + */ + private $returnFrames = false; + + /** + * @var bool + */ + private $jsonApi = false; + + /** + * Returns errors[[]] instead of error[] to be in compliance with the json:api spec + * @param bool $jsonApi Default is false + * @return $this + */ + public function setJsonApi($jsonApi = false) + { + $this->jsonApi = (bool) $jsonApi; + return $this; + } + + /** + * @param bool|null $returnFrames + * @return bool|$this + */ + public function addTraceToOutput($returnFrames = null) + { + if (func_num_args() == 0) { + return $this->returnFrames; + } + + $this->returnFrames = (bool) $returnFrames; + return $this; + } + + /** + * @return int + */ + public function handle() + { + if ($this->jsonApi === true) { + $response = [ + 'errors' => [ + Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput() + ), + ] + ]; + } else { + $response = [ + 'error' => Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput() + ), + ]; + } + + echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0); + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'application/json'; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php new file mode 100644 index 0000000..192d0ff --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php @@ -0,0 +1,354 @@ + +* Plaintext handler for command line and logs. +* @author Pierre-Yves Landuré +*/ + +namespace Whoops\Handler; + +use InvalidArgumentException; +use Psr\Log\LoggerInterface; +use Whoops\Exception\Frame; + +/** +* Handler outputing plaintext error messages. Can be used +* directly, or will be instantiated automagically by Whoops\Run +* if passed to Run::pushHandler +*/ +class PlainTextHandler extends Handler +{ + const VAR_DUMP_PREFIX = ' | '; + + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * @var callable + */ + protected $dumper; + + /** + * @var bool + */ + private $addTraceToOutput = true; + + /** + * @var bool|integer + */ + private $addTraceFunctionArgsToOutput = false; + + /** + * @var integer + */ + private $traceFunctionArgsOutputLimit = 1024; + + /** + * @var bool + */ + private $addPreviousToOutput = true; + + /** + * @var bool + */ + private $loggerOnly = false; + + /** + * Constructor. + * @throws InvalidArgumentException If argument is not null or a LoggerInterface + * @param \Psr\Log\LoggerInterface|null $logger + */ + public function __construct($logger = null) + { + $this->setLogger($logger); + } + + /** + * Set the output logger interface. + * @throws InvalidArgumentException If argument is not null or a LoggerInterface + * @param \Psr\Log\LoggerInterface|null $logger + */ + public function setLogger($logger = null) + { + if (! (is_null($logger) + || $logger instanceof LoggerInterface)) { + throw new InvalidArgumentException( + 'Argument to ' . __METHOD__ . + " must be a valid Logger Interface (aka. Monolog), " . + get_class($logger) . ' given.' + ); + } + + $this->logger = $logger; + } + + /** + * @return \Psr\Log\LoggerInterface|null + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Set var dumper callback function. + * + * @param callable $dumper + * @return void + */ + public function setDumper(callable $dumper) + { + $this->dumper = $dumper; + } + + /** + * Add error trace to output. + * @param bool|null $addTraceToOutput + * @return bool|$this + */ + public function addTraceToOutput($addTraceToOutput = null) + { + if (func_num_args() == 0) { + return $this->addTraceToOutput; + } + + $this->addTraceToOutput = (bool) $addTraceToOutput; + return $this; + } + + /** + * Add previous exceptions to output. + * @param bool|null $addPreviousToOutput + * @return bool|$this + */ + public function addPreviousToOutput($addPreviousToOutput = null) + { + if (func_num_args() == 0) { + return $this->addPreviousToOutput; + } + + $this->addPreviousToOutput = (bool) $addPreviousToOutput; + return $this; + } + + /** + * Add error trace function arguments to output. + * Set to True for all frame args, or integer for the n first frame args. + * @param bool|integer|null $addTraceFunctionArgsToOutput + * @return null|bool|integer + */ + public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null) + { + if (func_num_args() == 0) { + return $this->addTraceFunctionArgsToOutput; + } + + if (! is_integer($addTraceFunctionArgsToOutput)) { + $this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput; + } else { + $this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput; + } + } + + /** + * Set the size limit in bytes of frame arguments var_dump output. + * If the limit is reached, the var_dump output is discarded. + * Prevent memory limit errors. + * @var integer + */ + public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit) + { + $this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit; + } + + /** + * Create plain text response and return it as a string + * @return string + */ + public function generateResponse() + { + $exception = $this->getException(); + $message = $this->getExceptionOutput($exception); + + if ($this->addPreviousToOutput) { + $previous = $exception->getPrevious(); + while ($previous) { + $message .= "\n\nCaused by\n" . $this->getExceptionOutput($previous); + $previous = $previous->getPrevious(); + } + } + + + return $message . $this->getTraceOutput() . "\n"; + } + + /** + * Get the size limit in bytes of frame arguments var_dump output. + * If the limit is reached, the var_dump output is discarded. + * Prevent memory limit errors. + * @return integer + */ + public function getTraceFunctionArgsOutputLimit() + { + return $this->traceFunctionArgsOutputLimit; + } + + /** + * Only output to logger. + * @param bool|null $loggerOnly + * @return null|bool + */ + public function loggerOnly($loggerOnly = null) + { + if (func_num_args() == 0) { + return $this->loggerOnly; + } + + $this->loggerOnly = (bool) $loggerOnly; + } + + /** + * Test if handler can output to stdout. + * @return bool + */ + private function canOutput() + { + return !$this->loggerOnly(); + } + + /** + * Get the frame args var_dump. + * @param \Whoops\Exception\Frame $frame [description] + * @param integer $line [description] + * @return string + */ + private function getFrameArgsOutput(Frame $frame, $line) + { + if ($this->addTraceFunctionArgsToOutput() === false + || $this->addTraceFunctionArgsToOutput() < $line) { + return ''; + } + + // Dump the arguments: + ob_start(); + $this->dump($frame->getArgs()); + if (ob_get_length() > $this->getTraceFunctionArgsOutputLimit()) { + // The argument var_dump is to big. + // Discarded to limit memory usage. + ob_clean(); + return sprintf( + "\n%sArguments dump length greater than %d Bytes. Discarded.", + self::VAR_DUMP_PREFIX, + $this->getTraceFunctionArgsOutputLimit() + ); + } + + return sprintf( + "\n%s", + preg_replace('/^/m', self::VAR_DUMP_PREFIX, ob_get_clean()) + ); + } + + /** + * Dump variable. + * + * @param mixed $var + * @return void + */ + protected function dump($var) + { + if ($this->dumper) { + call_user_func($this->dumper, $var); + } else { + var_dump($var); + } + } + + /** + * Get the exception trace as plain text. + * @return string + */ + private function getTraceOutput() + { + if (! $this->addTraceToOutput()) { + return ''; + } + $inspector = $this->getInspector(); + $frames = $inspector->getFrames(); + + $response = "\nStack trace:"; + + $line = 1; + foreach ($frames as $frame) { + /** @var Frame $frame */ + $class = $frame->getClass(); + + $template = "\n%3d. %s->%s() %s:%d%s"; + if (! $class) { + // Remove method arrow (->) from output. + $template = "\n%3d. %s%s() %s:%d%s"; + } + + $response .= sprintf( + $template, + $line, + $class, + $frame->getFunction(), + $frame->getFile(), + $frame->getLine(), + $this->getFrameArgsOutput($frame, $line) + ); + + $line++; + } + + return $response; + } + + /** + * Get the exception as plain text. + * @param \Throwable $exception + * @return string + */ + private function getExceptionOutput($exception) + { + return sprintf( + "%s: %s in file %s on line %d", + get_class($exception), + $exception->getMessage(), + $exception->getFile(), + $exception->getLine() + ); + } + + /** + * @return int + */ + public function handle() + { + $response = $this->generateResponse(); + + if ($this->getLogger()) { + $this->getLogger()->error($response); + } + + if (! $this->canOutput()) { + return Handler::DONE; + } + + echo $response; + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'text/plain'; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php new file mode 100644 index 0000000..a904025 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php @@ -0,0 +1,728 @@ + + */ + +namespace Whoops\Handler; + +use InvalidArgumentException; +use RuntimeException; +use Symfony\Component\VarDumper\Cloner\AbstractCloner; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use UnexpectedValueException; +use Whoops\Exception\Formatter; +use Whoops\Util\Misc; +use Whoops\Util\TemplateHelper; + +class PrettyPageHandler extends Handler +{ + const EDITOR_SUBLIME = "sublime"; + const EDITOR_TEXTMATE = "textmate"; + const EDITOR_EMACS = "emacs"; + const EDITOR_MACVIM = "macvim"; + const EDITOR_PHPSTORM = "phpstorm"; + const EDITOR_IDEA = "idea"; + const EDITOR_VSCODE = "vscode"; + const EDITOR_ATOM = "atom"; + const EDITOR_ESPRESSO = "espresso"; + const EDITOR_XDEBUG = "xdebug"; + + /** + * Search paths to be scanned for resources, in the reverse + * order they're declared. + * + * @var array + */ + private $searchPaths = []; + + /** + * Fast lookup cache for known resource locations. + * + * @var array + */ + private $resourceCache = []; + + /** + * The name of the custom css file. + * + * @var string + */ + private $customCss = null; + + /** + * @var array[] + */ + private $extraTables = []; + + /** + * @var bool + */ + private $handleUnconditionally = false; + + /** + * @var string + */ + private $pageTitle = "Whoops! There was an error."; + + /** + * @var array[] + */ + private $applicationPaths; + + /** + * @var array[] + */ + private $blacklist = [ + '_GET' => [], + '_POST' => [], + '_FILES' => [], + '_COOKIE' => [], + '_SESSION' => [], + '_SERVER' => [], + '_ENV' => [], + ]; + + /** + * A string identifier for a known IDE/text editor, or a closure + * that resolves a string that can be used to open a given file + * in an editor. If the string contains the special substrings + * %file or %line, they will be replaced with the correct data. + * + * @example + * "txmt://open?url=%file&line=%line" + * @var mixed $editor + */ + protected $editor; + + /** + * A list of known editor strings + * @var array + */ + protected $editors = [ + "sublime" => "subl://open?url=file://%file&line=%line", + "textmate" => "txmt://open?url=file://%file&line=%line", + "emacs" => "emacs://open?url=file://%file&line=%line", + "macvim" => "mvim://open/?url=file://%file&line=%line", + "phpstorm" => "phpstorm://open?file=%file&line=%line", + "idea" => "idea://open?file=%file&line=%line", + "vscode" => "vscode://file/%file:%line", + "atom" => "atom://core/open/file?filename=%file&line=%line", + "espresso" => "x-espresso://open?filepath=%file&lines=%line", + ]; + + /** + * @var TemplateHelper + */ + private $templateHelper; + + /** + * Constructor. + */ + public function __construct() + { + if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) { + // Register editor using xdebug's file_link_format option. + $this->editors['xdebug'] = function ($file, $line) { + return str_replace(['%f', '%l'], [$file, $line], ini_get('xdebug.file_link_format')); + }; + + // If xdebug is available, use it as default editor. + $this->setEditor('xdebug'); + } + + // Add the default, local resource search path: + $this->searchPaths[] = __DIR__ . "/../Resources"; + + // blacklist php provided auth based values + $this->blacklist('_SERVER', 'PHP_AUTH_PW'); + + $this->templateHelper = new TemplateHelper(); + + if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { + $cloner = new VarCloner(); + // Only dump object internals if a custom caster exists. + $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) { + $class = $stub->class; + $classes = [$class => $class] + class_parents($class) + class_implements($class); + + foreach ($classes as $class) { + if (isset(AbstractCloner::$defaultCasters[$class])) { + return $a; + } + } + + // Remove all internals + return []; + }]); + $this->templateHelper->setCloner($cloner); + } + } + + /** + * @return int|null + */ + public function handle() + { + if (!$this->handleUnconditionally()) { + // Check conditions for outputting HTML: + // @todo: Make this more robust + if (PHP_SAPI === 'cli') { + // Help users who have been relying on an internal test value + // fix their code to the proper method + if (isset($_ENV['whoops-test'])) { + throw new \Exception( + 'Use handleUnconditionally instead of whoops-test' + .' environment variable' + ); + } + + return Handler::DONE; + } + } + + $templateFile = $this->getResource("views/layout.html.php"); + $cssFile = $this->getResource("css/whoops.base.css"); + $zeptoFile = $this->getResource("js/zepto.min.js"); + $prettifyFile = $this->getResource("js/prettify.min.js"); + $clipboard = $this->getResource("js/clipboard.min.js"); + $jsFile = $this->getResource("js/whoops.base.js"); + + if ($this->customCss) { + $customCssFile = $this->getResource($this->customCss); + } + + $inspector = $this->getInspector(); + $frames = $this->getExceptionFrames(); + $code = $this->getExceptionCode(); + + // List of variables that will be passed to the layout template. + $vars = [ + "page_title" => $this->getPageTitle(), + + // @todo: Asset compiler + "stylesheet" => file_get_contents($cssFile), + "zepto" => file_get_contents($zeptoFile), + "prettify" => file_get_contents($prettifyFile), + "clipboard" => file_get_contents($clipboard), + "javascript" => file_get_contents($jsFile), + + // Template paths: + "header" => $this->getResource("views/header.html.php"), + "header_outer" => $this->getResource("views/header_outer.html.php"), + "frame_list" => $this->getResource("views/frame_list.html.php"), + "frames_description" => $this->getResource("views/frames_description.html.php"), + "frames_container" => $this->getResource("views/frames_container.html.php"), + "panel_details" => $this->getResource("views/panel_details.html.php"), + "panel_details_outer" => $this->getResource("views/panel_details_outer.html.php"), + "panel_left" => $this->getResource("views/panel_left.html.php"), + "panel_left_outer" => $this->getResource("views/panel_left_outer.html.php"), + "frame_code" => $this->getResource("views/frame_code.html.php"), + "env_details" => $this->getResource("views/env_details.html.php"), + + "title" => $this->getPageTitle(), + "name" => explode("\\", $inspector->getExceptionName()), + "message" => $inspector->getExceptionMessage(), + "previousMessages" => $inspector->getPreviousExceptionMessages(), + "docref_url" => $inspector->getExceptionDocrefUrl(), + "code" => $code, + "previousCodes" => $inspector->getPreviousExceptionCodes(), + "plain_exception" => Formatter::formatExceptionPlain($inspector), + "frames" => $frames, + "has_frames" => !!count($frames), + "handler" => $this, + "handlers" => $this->getRun()->getHandlers(), + + "active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all', + "has_frames_tabs" => $this->getApplicationPaths(), + + "tables" => [ + "GET Data" => $this->masked($_GET, '_GET'), + "POST Data" => $this->masked($_POST, '_POST'), + "Files" => isset($_FILES) ? $this->masked($_FILES, '_FILES') : [], + "Cookies" => $this->masked($_COOKIE, '_COOKIE'), + "Session" => isset($_SESSION) ? $this->masked($_SESSION, '_SESSION') : [], + "Server/Request Data" => $this->masked($_SERVER, '_SERVER'), + "Environment Variables" => $this->masked($_ENV, '_ENV'), + ], + ]; + + if (isset($customCssFile)) { + $vars["stylesheet"] .= file_get_contents($customCssFile); + } + + // Add extra entries list of data tables: + // @todo: Consolidate addDataTable and addDataTableCallback + $extraTables = array_map(function ($table) use ($inspector) { + return $table instanceof \Closure ? $table($inspector) : $table; + }, $this->getDataTables()); + $vars["tables"] = array_merge($extraTables, $vars["tables"]); + + $plainTextHandler = new PlainTextHandler(); + $plainTextHandler->setException($this->getException()); + $plainTextHandler->setInspector($this->getInspector()); + $vars["preface"] = ""; + + $this->templateHelper->setVariables($vars); + $this->templateHelper->render($templateFile); + + return Handler::QUIT; + } + + /** + * Get the stack trace frames of the exception that is currently being handled. + * + * @return \Whoops\Exception\FrameCollection; + */ + protected function getExceptionFrames() + { + $frames = $this->getInspector()->getFrames(); + + if ($this->getApplicationPaths()) { + foreach ($frames as $frame) { + foreach ($this->getApplicationPaths() as $path) { + if (strpos($frame->getFile(), $path) === 0) { + $frame->setApplication(true); + break; + } + } + } + } + + return $frames; + } + + /** + * Get the code of the exception that is currently being handled. + * + * @return string + */ + protected function getExceptionCode() + { + $exception = $this->getException(); + + $code = $exception->getCode(); + if ($exception instanceof \ErrorException) { + // ErrorExceptions wrap the php-error types within the 'severity' property + $code = Misc::translateErrorCode($exception->getSeverity()); + } + + return (string) $code; + } + + /** + * @return string + */ + public function contentType() + { + return 'text/html'; + } + + /** + * Adds an entry to the list of tables displayed in the template. + * The expected data is a simple associative array. Any nested arrays + * will be flattened with print_r + * @param string $label + * @param array $data + */ + public function addDataTable($label, array $data) + { + $this->extraTables[$label] = $data; + } + + /** + * Lazily adds an entry to the list of tables displayed in the table. + * The supplied callback argument will be called when the error is rendered, + * it should produce a simple associative array. Any nested arrays will + * be flattened with print_r. + * + * @throws InvalidArgumentException If $callback is not callable + * @param string $label + * @param callable $callback Callable returning an associative array + */ + public function addDataTableCallback($label, /* callable */ $callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException('Expecting callback argument to be callable'); + } + + $this->extraTables[$label] = function (\Whoops\Exception\Inspector $inspector = null) use ($callback) { + try { + $result = call_user_func($callback, $inspector); + + // Only return the result if it can be iterated over by foreach(). + return is_array($result) || $result instanceof \Traversable ? $result : []; + } catch (\Exception $e) { + // Don't allow failure to break the rendering of the original exception. + return []; + } + }; + } + + /** + * Returns all the extra data tables registered with this handler. + * Optionally accepts a 'label' parameter, to only return the data + * table under that label. + * @param string|null $label + * @return array[]|callable + */ + public function getDataTables($label = null) + { + if ($label !== null) { + return isset($this->extraTables[$label]) ? + $this->extraTables[$label] : []; + } + + return $this->extraTables; + } + + /** + * Allows to disable all attempts to dynamically decide whether to + * handle or return prematurely. + * Set this to ensure that the handler will perform no matter what. + * @param bool|null $value + * @return bool|null + */ + public function handleUnconditionally($value = null) + { + if (func_num_args() == 0) { + return $this->handleUnconditionally; + } + + $this->handleUnconditionally = (bool) $value; + } + + /** + * Adds an editor resolver, identified by a string + * name, and that may be a string path, or a callable + * resolver. If the callable returns a string, it will + * be set as the file reference's href attribute. + * + * @example + * $run->addEditor('macvim', "mvim://open?url=file://%file&line=%line") + * @example + * $run->addEditor('remove-it', function($file, $line) { + * unlink($file); + * return "http://stackoverflow.com"; + * }); + * @param string $identifier + * @param string|callable $resolver + */ + public function addEditor($identifier, $resolver) + { + $this->editors[$identifier] = $resolver; + } + + /** + * Set the editor to use to open referenced files, by a string + * identifier, or a callable that will be executed for every + * file reference, with a $file and $line argument, and should + * return a string. + * + * @example + * $run->setEditor(function($file, $line) { return "file:///{$file}"; }); + * @example + * $run->setEditor('sublime'); + * + * @throws InvalidArgumentException If invalid argument identifier provided + * @param string|callable $editor + */ + public function setEditor($editor) + { + if (!is_callable($editor) && !isset($this->editors[$editor])) { + throw new InvalidArgumentException( + "Unknown editor identifier: $editor. Known editors:" . + implode(",", array_keys($this->editors)) + ); + } + + $this->editor = $editor; + } + + /** + * Given a string file path, and an integer file line, + * executes the editor resolver and returns, if available, + * a string that may be used as the href property for that + * file reference. + * + * @throws InvalidArgumentException If editor resolver does not return a string + * @param string $filePath + * @param int $line + * @return string|bool + */ + public function getEditorHref($filePath, $line) + { + $editor = $this->getEditor($filePath, $line); + + if (empty($editor)) { + return false; + } + + // Check that the editor is a string, and replace the + // %line and %file placeholders: + if (!isset($editor['url']) || !is_string($editor['url'])) { + throw new UnexpectedValueException( + __METHOD__ . " should always resolve to a string or a valid editor array; got something else instead." + ); + } + + $editor['url'] = str_replace("%line", rawurlencode($line), $editor['url']); + $editor['url'] = str_replace("%file", rawurlencode($filePath), $editor['url']); + + return $editor['url']; + } + + /** + * Given a boolean if the editor link should + * act as an Ajax request. The editor must be a + * valid callable function/closure + * + * @throws UnexpectedValueException If editor resolver does not return a boolean + * @param string $filePath + * @param int $line + * @return bool + */ + public function getEditorAjax($filePath, $line) + { + $editor = $this->getEditor($filePath, $line); + + // Check that the ajax is a bool + if (!isset($editor['ajax']) || !is_bool($editor['ajax'])) { + throw new UnexpectedValueException( + __METHOD__ . " should always resolve to a bool; got something else instead." + ); + } + return $editor['ajax']; + } + + /** + * Given a boolean if the editor link should + * act as an Ajax request. The editor must be a + * valid callable function/closure + * + * @param string $filePath + * @param int $line + * @return array + */ + protected function getEditor($filePath, $line) + { + if (!$this->editor || (!is_string($this->editor) && !is_callable($this->editor))) { + return []; + } + + if (is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) { + return [ + 'ajax' => false, + 'url' => $this->editors[$this->editor], + ]; + } + + if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) { + if (is_callable($this->editor)) { + $callback = call_user_func($this->editor, $filePath, $line); + } else { + $callback = call_user_func($this->editors[$this->editor], $filePath, $line); + } + + if (empty($callback)) { + return []; + } + + if (is_string($callback)) { + return [ + 'ajax' => false, + 'url' => $callback, + ]; + } + + return [ + 'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false, + 'url' => isset($callback['url']) ? $callback['url'] : $callback, + ]; + } + + return []; + } + + /** + * @param string $title + * @return void + */ + public function setPageTitle($title) + { + $this->pageTitle = (string) $title; + } + + /** + * @return string + */ + public function getPageTitle() + { + return $this->pageTitle; + } + + /** + * Adds a path to the list of paths to be searched for + * resources. + * + * @throws InvalidArgumentException If $path is not a valid directory + * + * @param string $path + * @return void + */ + public function addResourcePath($path) + { + if (!is_dir($path)) { + throw new InvalidArgumentException( + "'$path' is not a valid directory" + ); + } + + array_unshift($this->searchPaths, $path); + } + + /** + * Adds a custom css file to be loaded. + * + * @param string $name + * @return void + */ + public function addCustomCss($name) + { + $this->customCss = $name; + } + + /** + * @return array + */ + public function getResourcePaths() + { + return $this->searchPaths; + } + + /** + * Finds a resource, by its relative path, in all available search paths. + * The search is performed starting at the last search path, and all the + * way back to the first, enabling a cascading-type system of overrides + * for all resources. + * + * @throws RuntimeException If resource cannot be found in any of the available paths + * + * @param string $resource + * @return string + */ + protected function getResource($resource) + { + // If the resource was found before, we can speed things up + // by caching its absolute, resolved path: + if (isset($this->resourceCache[$resource])) { + return $this->resourceCache[$resource]; + } + + // Search through available search paths, until we find the + // resource we're after: + foreach ($this->searchPaths as $path) { + $fullPath = $path . "/$resource"; + + if (is_file($fullPath)) { + // Cache the result: + $this->resourceCache[$resource] = $fullPath; + return $fullPath; + } + } + + // If we got this far, nothing was found. + throw new RuntimeException( + "Could not find resource '$resource' in any resource paths." + . "(searched: " . join(", ", $this->searchPaths). ")" + ); + } + + /** + * @deprecated + * + * @return string + */ + public function getResourcesPath() + { + $allPaths = $this->getResourcePaths(); + + // Compat: return only the first path added + return end($allPaths) ?: null; + } + + /** + * @deprecated + * + * @param string $resourcesPath + * @return void + */ + public function setResourcesPath($resourcesPath) + { + $this->addResourcePath($resourcesPath); + } + + /** + * Return the application paths. + * + * @return array + */ + public function getApplicationPaths() + { + return $this->applicationPaths; + } + + /** + * Set the application paths. + * + * @param array $applicationPaths + */ + public function setApplicationPaths($applicationPaths) + { + $this->applicationPaths = $applicationPaths; + } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->templateHelper->setApplicationRootPath($applicationRootPath); + } + + /** + * blacklist a sensitive value within one of the superglobal arrays. + * + * @param $superGlobalName string the name of the superglobal array, e.g. '_GET' + * @param $key string the key within the superglobal + */ + public function blacklist($superGlobalName, $key) + { + $this->blacklist[$superGlobalName][] = $key; + } + + /** + * Checks all values within the given superGlobal array. + * Blacklisted values will be replaced by a equal length string cointaining only '*' characters. + * + * We intentionally dont rely on $GLOBALS as it depends on 'auto_globals_jit' php.ini setting. + * + * @param $superGlobal array One of the superglobal arrays + * @param $superGlobalName string the name of the superglobal array, e.g. '_GET' + * @return array $values without sensitive data + */ + private function masked(array $superGlobal, $superGlobalName) + { + $blacklisted = $this->blacklist[$superGlobalName]; + + $values = $superGlobal; + foreach ($blacklisted as $key) { + if (isset($superGlobal[$key]) && is_string($superGlobal[$key])) { + $values[$key] = str_repeat('*', strlen($superGlobal[$key])); + } + } + return $values; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php new file mode 100644 index 0000000..decbbfa --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php @@ -0,0 +1,107 @@ + + */ + +namespace Whoops\Handler; + +use SimpleXMLElement; +use Whoops\Exception\Formatter; + +/** + * Catches an exception and converts it to an XML + * response. Additionally can also return exception + * frames for consumption by an API. + */ +class XmlResponseHandler extends Handler +{ + /** + * @var bool + */ + private $returnFrames = false; + + /** + * @param bool|null $returnFrames + * @return bool|$this + */ + public function addTraceToOutput($returnFrames = null) + { + if (func_num_args() == 0) { + return $this->returnFrames; + } + + $this->returnFrames = (bool) $returnFrames; + return $this; + } + + /** + * @return int + */ + public function handle() + { + $response = [ + 'error' => Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput() + ), + ]; + + echo self::toXml($response); + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'application/xml'; + } + + /** + * @param SimpleXMLElement $node Node to append data to, will be modified in place + * @param array|\Traversable $data + * @return SimpleXMLElement The modified node, for chaining + */ + private static function addDataToNode(\SimpleXMLElement $node, $data) + { + assert(is_array($data) || $data instanceof Traversable); + + foreach ($data as $key => $value) { + if (is_numeric($key)) { + // Convert the key to a valid string + $key = "unknownNode_". (string) $key; + } + + // Delete any char not allowed in XML element names + $key = preg_replace('/[^a-z0-9\-\_\.\:]/i', '', $key); + + if (is_array($value)) { + $child = $node->addChild($key); + self::addDataToNode($child, $value); + } else { + $value = str_replace('&', '&', print_r($value, true)); + $node->addChild($key, $value); + } + } + + return $node; + } + + /** + * The main function for converting to an XML document. + * + * @param array|\Traversable $data + * @return string XML + */ + private static function toXml($data) + { + assert(is_array($data) || $data instanceof Traversable); + + $node = simplexml_load_string(""); + + return self::addDataToNode($node, $data)->asXML(); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css b/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css new file mode 100644 index 0000000..d67499e --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css @@ -0,0 +1,604 @@ +body { + font: 12px "Helvetica Neue", helvetica, arial, sans-serif; + color: #131313; + background: #eeeeee; + padding:0; + margin: 0; + max-height: 100%; + + text-rendering: optimizeLegibility; +} + a { + text-decoration: none; + } + +.Whoops.container { + position: relative; + z-index: 9999999999; +} + +.panel { + overflow-y: scroll; + height: 100%; + position: fixed; + margin: 0; + left: 0; + top: 0; +} + +.branding { + position: absolute; + top: 10px; + right: 20px; + color: #777777; + font-size: 10px; + z-index: 100; +} + .branding a { + color: #e95353; + } + +header { + color: white; + box-sizing: border-box; + background-color: #2a2a2a; + padding: 35px 40px; + max-height: 180px; + overflow: hidden; + transition: 0.5s; +} + + header.header-expand { + max-height: 1000px; + } + + .exc-title { + margin: 0; + color: #bebebe; + font-size: 14px; + } + .exc-title-primary, .exc-title-secondary { + color: #e95353; + } + + .exc-message { + font-size: 20px; + word-wrap: break-word; + margin: 4px 0 0 0; + color: white; + } + .exc-message span { + display: block; + } + .exc-message-empty-notice { + color: #a29d9d; + font-weight: 300; + } + +.prev-exc-title { + margin: 10px 0; +} + +.prev-exc-title + ul { + margin: 0; + padding: 0 0 0 20px; + line-height: 12px; +} + +.prev-exc-title + ul li { + font: 12px "Helvetica Neue", helvetica, arial, sans-serif; +} + +.prev-exc-title + ul li .prev-exc-code { + display: inline-block; + color: #bebebe; +} + +.details-container { + left: 30%; + width: 70%; + background: #fafafa; +} + .details { + padding: 5px; + } + + .details-heading { + color: #4288CE; + font-weight: 300; + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px solid rgba(0, 0, 0, .1); + } + + .details pre.sf-dump { + white-space: pre; + word-wrap: inherit; + } + + .details pre.sf-dump, + .details pre.sf-dump .sf-dump-num, + .details pre.sf-dump .sf-dump-const, + .details pre.sf-dump .sf-dump-str, + .details pre.sf-dump .sf-dump-note, + .details pre.sf-dump .sf-dump-ref, + .details pre.sf-dump .sf-dump-public, + .details pre.sf-dump .sf-dump-protected, + .details pre.sf-dump .sf-dump-private, + .details pre.sf-dump .sf-dump-meta, + .details pre.sf-dump .sf-dump-key, + .details pre.sf-dump .sf-dump-index { + color: #463C54; + } + +.left-panel { + width: 30%; + background: #ded8d8; +} + + .frames-description { + background: rgba(0, 0, 0, .05); + padding: 8px 15px; + color: #a29d9d; + font-size: 11px; + } + + .frames-description.frames-description-application { + text-align: center; + font-size: 12px; + } + .frames-container.frames-container-application .frame:not(.frame-application) { + display: none; + } + + .frames-tab { + color: #a29d9d; + display: inline-block; + padding: 4px 8px; + margin: 0 2px; + border-radius: 3px; + } + + .frames-tab.frames-tab-active { + background-color: #2a2a2a; + color: #bebebe; + } + + .frame { + padding: 14px; + cursor: pointer; + transition: all 0.1s ease; + background: #eeeeee; + } + .frame:not(:last-child) { + border-bottom: 1px solid rgba(0, 0, 0, .05); + } + + .frame.active { + box-shadow: inset -5px 0 0 0 #4288CE; + color: #4288CE; + } + + .frame:not(.active):hover { + background: #BEE9EA; + } + + .frame-method-info { + margin-bottom: 10px; + } + + .frame-class, .frame-function, .frame-index { + font-size: 14px; + } + + .frame-index { + float: left; + } + + .frame-method-info { + margin-left: 24px; + } + + .frame-index { + font-size: 11px; + color: #a29d9d; + background-color: rgba(0, 0, 0, .05); + height: 18px; + width: 18px; + line-height: 18px; + border-radius: 5px; + padding: 0 1px 0 1px; + text-align: center; + display: inline-block; + } + + .frame-application .frame-index { + background-color: #2a2a2a; + color: #bebebe; + } + + .frame-file { + font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; + color: #a29d9d; + } + + .frame-file .editor-link { + color: #a29d9d; + } + + .frame-line { + font-weight: bold; + } + + .frame-line:before { + content: ":"; + } + + .frame-code { + padding: 5px; + background: #303030; + display: none; + } + + .frame-code.active { + display: block; + } + + .frame-code .frame-file { + color: #a29d9d; + padding: 12px 6px; + + border-bottom: none; + } + + .code-block { + padding: 10px; + margin: 0; + border-radius: 6px; + box-shadow: 0 3px 0 rgba(0, 0, 0, .05), + 0 10px 30px rgba(0, 0, 0, .05), + inset 0 0 1px 0 rgba(255, 255, 255, .07); + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + } + + .linenums { + margin: 0; + margin-left: 10px; + } + + .frame-comments { + border-top: none; + margin-top: 15px; + + font-size: 12px; + } + + .frame-comments.empty { + } + + .frame-comments.empty:before { + content: "No comments for this stack frame."; + font-weight: 300; + color: #a29d9d; + } + + .frame-comment { + padding: 10px; + color: #e3e3e3; + border-radius: 6px; + background-color: rgba(255, 255, 255, .05); + } + .frame-comment a { + font-weight: bold; + text-decoration: none; + } + .frame-comment a:hover { + color: #4bb1b1; + } + + .frame-comment:not(:last-child) { + border-bottom: 1px dotted rgba(0, 0, 0, .3); + } + + .frame-comment-context { + font-size: 10px; + color: white; + } + +.delimiter { + display: inline-block; +} + +.data-table-container label { + font-size: 16px; + color: #303030; + font-weight: bold; + margin: 10px 0; + + display: block; + + margin-bottom: 5px; + padding-bottom: 5px; +} + .data-table { + width: 100%; + margin-bottom: 10px; + } + + .data-table tbody { + font: 13px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; + } + + .data-table thead { + display: none; + } + + .data-table tr { + padding: 5px 0; + } + + .data-table td:first-child { + width: 20%; + min-width: 130px; + overflow: hidden; + font-weight: bold; + color: #463C54; + padding-right: 5px; + + } + + .data-table td:last-child { + width: 80%; + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; + } + + .data-table span.empty { + color: rgba(0, 0, 0, .3); + font-weight: 300; + } + .data-table label.empty { + display: inline; + } + +.handler { + padding: 4px 0; + font: 14px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; +} + +/* prettify code style +Uses the Doxy theme as a base */ +pre .str, code .str { color: #BCD42A; } /* string */ +pre .kwd, code .kwd { color: #4bb1b1; font-weight: bold; } /* keyword*/ +pre .com, code .com { color: #888; font-weight: bold; } /* comment */ +pre .typ, code .typ { color: #ef7c61; } /* type */ +pre .lit, code .lit { color: #BCD42A; } /* literal */ +pre .pun, code .pun { color: #fff; font-weight: bold; } /* punctuation */ +pre .pln, code .pln { color: #e9e4e5; } /* plaintext */ +pre .tag, code .tag { color: #4bb1b1; } /* html/xml tag */ +pre .htm, code .htm { color: #dda0dd; } /* html tag */ +pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag */ +pre .atn, code .atn { color: #ef7c61; font-weight: normal;} /* html/xml attribute name */ +pre .atv, code .atv { color: #bcd42a; } /* html/xml attribute value */ +pre .dec, code .dec { color: #606; } /* decimal */ +pre.code-block, code.code-block, .frame-args.code-block, .frame-args.code-block samp { + font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; + background: #333; + color: #e9e4e5; +} + pre.code-block { + white-space: pre-wrap; + } + + pre.code-block a, code.code-block a { + text-decoration:none; + } + + .linenums li { + color: #A5A5A5; + } + + .linenums li.current{ + background: rgba(255, 100, 100, .07); + } + .linenums li.current.active { + background: rgba(255, 100, 100, .17); + } + +pre:not(.prettyprinted) { + padding-left: 60px; +} + +#plain-exception { + display: none; +} + +.rightButton { + cursor: pointer; + border: 0; + opacity: .8; + background: none; + + color: rgba(255, 255, 255, 0.1); + box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1); + + border-radius: 3px; + + outline: none !important; +} + + .rightButton:hover { + box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3); + color: rgba(255, 255, 255, 0.3); + } + +/* inspired by githubs kbd styles */ +kbd { + -moz-border-bottom-colors: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background-color: #fcfcfc; + border-color: #ccc #ccc #bbb; + border-image: none; + border-style: solid; + border-width: 1px; + color: #555; + display: inline-block; + font-size: 11px; + line-height: 10px; + padding: 3px 5px; + vertical-align: middle; +} + + +/* == Media queries */ + +/* Expand the spacing in the details section */ +@media (min-width: 1000px) { + .details, .frame-code { + padding: 20px 40px; + } + + .details-container { + left: 32%; + width: 68%; + } + + .frames-container { + margin: 5px; + } + + .left-panel { + width: 32%; + } +} + +/* Stack panels */ +@media (max-width: 600px) { + .panel { + position: static; + width: 100%; + } +} + +/* Stack details tables */ +@media (max-width: 400px) { + .data-table, + .data-table tbody, + .data-table tbody tr, + .data-table tbody td { + display: block; + width: 100%; + } + + .data-table tbody tr:first-child { + padding-top: 0; + } + + .data-table tbody td:first-child, + .data-table tbody td:last-child { + padding-left: 0; + padding-right: 0; + } + + .data-table tbody td:last-child { + padding-top: 3px; + } +} + +.tooltipped { + position: relative +} +.tooltipped:after { + position: absolute; + z-index: 1000000; + display: none; + padding: 5px 8px; + color: #fff; + text-align: center; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-wrap: break-word; + white-space: pre; + pointer-events: none; + content: attr(aria-label); + background: rgba(0, 0, 0, 0.8); + border-radius: 3px; + -webkit-font-smoothing: subpixel-antialiased +} +.tooltipped:before { + position: absolute; + z-index: 1000001; + display: none; + width: 0; + height: 0; + color: rgba(0, 0, 0, 0.8); + pointer-events: none; + content: ""; + border: 5px solid transparent +} +.tooltipped:hover:before, +.tooltipped:hover:after, +.tooltipped:active:before, +.tooltipped:active:after, +.tooltipped:focus:before, +.tooltipped:focus:after { + display: inline-block; + text-decoration: none +} +.tooltipped-s:after { + top: 100%; + right: 50%; + margin-top: 5px +} +.tooltipped-s:before { + top: auto; + right: 50%; + bottom: -5px; + margin-right: -5px; + border-bottom-color: rgba(0, 0, 0, 0.8) +} + +pre.sf-dump { + padding: 0px !important; + margin: 0px !important; +} + +.search-for-help { + width: 85%; + padding: 0; + margin: 10px 0; + list-style-type: none; + display: inline-block; +} + .search-for-help li { + display: inline-block; + margin-right: 5px; + } + .search-for-help li:last-child { + margin-right: 0; + } + .search-for-help li a { + + } + .search-for-help li a i { + width: 16px; + height: 16px; + overflow: hidden; + display: block; + } + .search-for-help li a svg { + fill: #fff; + } + .search-for-help li a svg path { + background-size: contain; + } diff --git a/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js b/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js new file mode 100644 index 0000000..36a75a4 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.3 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ar;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n122||(e<65||h>90||d.push([Math.max(65,h)|32,Math.min(e,90)|32]),e<97||h>122||d.push([Math.max(97,h)&-33,Math.min(e,122)&-33]))}}d.sort(function(d,a){return d[0]-a[0]||a[1]-d[1]});a=[];c=[];for(f=0;fh[0]&&(h[1]+1>h[0]&&b.push("-"),b.push(g(h[1])));b.push("]");return b.join("")}function t(d){for(var a=d.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=a.length,i=[],c=0,h=0;c=2&&d==="["?a[c]=j(e):d!=="\\"&&(a[c]=e.replace(/[A-Za-z]/g,function(d){d=d.charCodeAt(0);return"["+String.fromCharCode(d&-33,d|32)+"]"}));return a.join("")}for(var z=0,w=!1,k=!1,m=0,b=a.length;m=5&&"lang-"===f.substring(0, +5))&&!(u&&typeof u[1]==="string"))c=!1,f="src";c||(s[v]=f)}h=b;b+=v.length;if(c){c=u[1];var e=v.indexOf(c),p=e+c.length;u[2]&&(p=v.length-u[2].length,e=p-c.length);f=f.substring(5);E(k+h,v.substring(0,e),g,m);E(k+h+e,c,F(f,c),m);E(k+h+p,v.substring(p),g,m)}else m.push(k+h,f)}a.g=m}var j={},t;(function(){for(var g=a.concat(i),k=[],m={},b=0,o=g.length;b=0;)j[q.charAt(d)]=s;s=s[1];q=""+s;m.hasOwnProperty(q)||(k.push(s),m[q]=r)}k.push(/[\S\s]/);t= +O(k)})();var z=i.length;return g}function l(a){var i=[],g=[];a.tripleQuotedStrings?i.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,r,"'\""]):a.multiLineStrings?i.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,r,"'\"`"]):i.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,r,"\"'"]);a.verbatimStrings&& +g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,r]);var j=a.hashComments;j&&(a.cStyleComments?(j>1?i.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,r,"#"]):i.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,r,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,r])):i.push(["com",/^#[^\n\r]*/,r,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,r]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/, +r]));a.regexLiterals&&g.push(["lang-regex",/^(?:^^\.?|[+-]|[!=]={0,2}|#|%=?|&&?=?|\(|\*=?|[+-]=|->|\/=?|::?|<{1,3}=?|[,;?@[{~]|\^\^?=?|\|\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(j=a.types)&&g.push(["typ",j]);a=(""+a.keywords).replace(/^ | $/g,"");a.length&&g.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),r]);i.push(["pln",/^\s+/,r," \r\n\t\u00a0"]);g.push(["lit", +/^@[$_a-z][\w$@]*/i,r],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,r],["pln",/^[$_a-z][\w$@]*/i,r],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,r,"0123456789"],["pln",/^\\[\S\s]?/,r],["pun",/^.[^\s\w"$'./@\\`]*/,r]);return x(i,g)}function G(a,i,g){function j(a){switch(a.nodeType){case 1:if(z.test(a.className))break;if("br"===a.nodeName)t(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)j(a);break;case 3:case 4:if(g){var b= +a.nodeValue,f=b.match(n);if(f){var i=b.substring(0,f.index);a.nodeValue=i;(b=b.substring(f.index+f[0].length))&&a.parentNode.insertBefore(k.createTextNode(b),a.nextSibling);t(a);i||a.parentNode.removeChild(a)}}}}function t(a){function i(a,b){var d=b?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=i(e,1),f=a.nextSibling;e.appendChild(d);for(var g=f;g;g=f)f=g.nextSibling,e.appendChild(g)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=i(a.nextSibling,0),f;(f=a.parentNode)&&f.nodeType=== +1;)a=f;b.push(a)}for(var z=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,k=a.ownerDocument,m=k.createElement("li");a.firstChild;)m.appendChild(a.firstChild);for(var b=[m],o=0;o=0;){var j= +i[g];A.hasOwnProperty(j)?C.console&&console.warn("cannot override language handler %s",j):A[j]=a}}function F(a,i){if(!a||!A.hasOwnProperty(a))a=/^\s*=e&&(j+=2);g>=p&&(s+=2)}}finally{if(c)c.style.display=h}}catch(A){C.console&&console.log(A&&A.stack?A.stack:A)}}var C=window,y=["break,continue,do,else,for,if,return,while"],B=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],I=[B,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"], +J=[B,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],K=[J,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],B=[B,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"], +L=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],M=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],N=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/, +Q=/\S/,R=l({keywords:[I,K,B,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+L,M,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};n(R,["default-code"]);n(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-", +/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);n(x([["pln",/^\s+/,r," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,r,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/], +["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);n(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);n(l({keywords:I,hashComments:!0,cStyleComments:!0,types:N}),["c","cc","cpp","cxx","cyc","m"]);n(l({keywords:"null,true,false"}),["json"]);n(l({keywords:K,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:N}), +["cs"]);n(l({keywords:J,cStyleComments:!0}),["java"]);n(l({keywords:y,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);n(l({keywords:L,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]);n(l({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);n(l({keywords:M,hashComments:!0, +multiLineStrings:!0,regexLiterals:!0}),["rb"]);n(l({keywords:B,cStyleComments:!0,regexLiterals:!0}),["js"]);n(l({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);n(x([],[["str",/^[\S\s]+/]]),["regex"]);var S=C.PR={createSimpleLexer:x,registerLangHandler:n,sourceDecorator:l, +PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:C.prettyPrintOne=function(a,i,g){var j=document.createElement("pre");j.innerHTML=a;g&&G(j,g,!0);H({h:i,j:g,c:j,i:1});return j.innerHTML},prettyPrint:C.prettyPrint=function(a){function i(){var u;for(var g=C.PR_SHOULD_USE_CONTINUATION?k.now()+250:Infinity;m= 145) { + $header.addClass('header-expand'); + } + }); + $header.on('mouseleave', function () { + $header.removeClass('header-expand'); + }); + + /* + * add prettyprint classes to our current active codeblock + * run prettyPrint() to highlight the active code + * scroll to the line when prettyprint is done + * highlight the current line + */ + var renderCurrentCodeblock = function(id) { + + // remove previous codeblocks so we only render the active one + $('.code-block').removeClass('prettyprint'); + + // pass the id in when we can for speed + if (typeof(id) === 'undefined' || typeof(id) === 'object') { + var id = /frame\-line\-([\d]*)/.exec($activeLine.attr('id'))[1]; + } + + $('#frame-code-linenums-' + id).addClass('prettyprint'); + $('#frame-code-args-' + id).addClass('prettyprint'); + + prettyPrint(highlightCurrentLine); + + } + + /* + * Highlight the active and neighboring lines for the current frame + * Adjust the offset to make sure that line is veritcally centered + */ + + var highlightCurrentLine = function() { + var activeLineNumber = +($activeLine.find('.frame-line').text()); + var $lines = $activeFrame.find('.linenums li'); + var firstLine = +($lines.first().val()); + + // We show more code than needed, purely for proper syntax highlighting + // Let’s hide a big chunk of that code and then scroll the remaining block + $activeFrame.find('.code-block').first().css({ + maxHeight: 345, + overflow: 'hidden', + }); + + var $offset = $($lines[activeLineNumber - firstLine - 10]); + if ($offset.length > 0) { + $offset[0].scrollIntoView(); + } + + $($lines[activeLineNumber - firstLine - 1]).addClass('current'); + $($lines[activeLineNumber - firstLine]).addClass('current active'); + $($lines[activeLineNumber - firstLine + 1]).addClass('current'); + + $container.scrollTop(0); + + } + + /* + * click handler for loading codeblocks + */ + + $frameContainer.on('click', '.frame', function() { + + var $this = $(this); + var id = /frame\-line\-([\d]*)/.exec($this.attr('id'))[1]; + var $codeFrame = $('#frame-code-' + id); + + if ($codeFrame) { + + $activeLine.removeClass('active'); + $activeFrame.removeClass('active'); + + $this.addClass('active'); + $codeFrame.addClass('active'); + + $activeLine = $this; + $activeFrame = $codeFrame; + + renderCurrentCodeblock(id); + + } + + }); + + var clipboard = new Clipboard('.clipboard'); + var showTooltip = function(elem, msg) { + elem.setAttribute('class', 'clipboard tooltipped tooltipped-s'); + elem.setAttribute('aria-label', msg); + }; + + clipboard.on('success', function(e) { + e.clearSelection(); + + showTooltip(e.trigger, 'Copied!'); + }); + + clipboard.on('error', function(e) { + showTooltip(e.trigger, fallbackMessage(e.action)); + }); + + var btn = document.querySelector('.clipboard'); + + btn.addEventListener('mouseleave', function(e) { + e.currentTarget.setAttribute('class', 'clipboard'); + e.currentTarget.removeAttribute('aria-label'); + }); + + function fallbackMessage(action) { + var actionMsg = ''; + var actionKey = (action === 'cut' ? 'X' : 'C'); + + if (/Mac/i.test(navigator.userAgent)) { + actionMsg = 'Press ⌘-' + actionKey + ' to ' + action; + } else { + actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action; + } + + return actionMsg; + } + + function scrollIntoView($node, $parent) { + var nodeOffset = $node.offset(); + var nodeTop = nodeOffset.top; + var nodeBottom = nodeTop + nodeOffset.height; + var parentScrollTop = $parent.scrollTop(); + var parentHeight = $parent.height(); + + if (nodeTop < 0) { + $parent.scrollTop(parentScrollTop + nodeTop); + } else if (nodeBottom > parentHeight) { + $parent.scrollTop(parentScrollTop + nodeBottom - parentHeight); + } + } + + $(document).on('keydown', function(e) { + var applicationFrames = $frameContainer.hasClass('frames-container-application'), + frameClass = applicationFrames ? '.frame.frame-application' : '.frame'; + + if(e.ctrlKey || e.which === 74 || e.which === 75) { + // CTRL+Arrow-UP/k and Arrow-Down/j support: + // 1) select the next/prev element + // 2) make sure the newly selected element is within the view-scope + // 3) focus the (right) container, so arrow-up/down (without ctrl) scroll the details + if (e.which === 38 /* arrow up */ || e.which === 75 /* k */) { + $activeLine.prev(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); + $container.focus(); + e.preventDefault(); + } else if (e.which === 40 /* arrow down */ || e.which === 74 /* j */) { + $activeLine.next(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); + $container.focus(); + e.preventDefault(); + } + } else if (e.which == 78 /* n */) { + if ($appFramesTab.length) { + setActiveFramesTab($('.frames-tab:not(.frames-tab-active)')); + } + } + }); + + // Render late enough for highlightCurrentLine to be ready + renderCurrentCodeblock(); + + // Avoid to quit the page with some protocol (e.g. IntelliJ Platform REST API) + $ajaxEditors.on('click', function(e){ + e.preventDefault(); + $.get(this.href); + }); + + // Symfony VarDumper: Close the by default expanded objects + $('.sf-dump-expanded') + .removeClass('sf-dump-expanded') + .addClass('sf-dump-compact'); + $('.sf-dump-toggle span').html('▶'); + + // Make the given frames-tab active + function setActiveFramesTab($tab) { + $tab.addClass('frames-tab-active'); + + if ($tab.attr('id') == 'application-frames-tab') { + $frameContainer.addClass('frames-container-application'); + $allFramesTab.removeClass('frames-tab-active'); + } else { + $frameContainer.removeClass('frames-container-application'); + $appFramesTab.removeClass('frames-tab-active'); + } + } + + $('a.frames-tab').on('click', function(e) { + e.preventDefault(); + setActiveFramesTab($(this)); + }); +}); diff --git a/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js b/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js new file mode 100644 index 0000000..0b2f97a --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js @@ -0,0 +1,2 @@ +/* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */ +var Zepto=function(){function L(t){return null==t?String(t):j[T.call(t)]||"object"}function Z(t){return"function"==L(t)}function $(t){return null!=t&&t==t.window}function _(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function R(t){return D(t)&&!$(t)&&Object.getPrototypeOf(t)==Object.prototype}function M(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function U(n,i,r){for(e in i)r&&(R(i[e])||A(i[e]))?(R(i[e])&&!R(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function B(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className,r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:e):t}catch(i){return t}}function G(t,e){e(t);for(var n in t.childNodes)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},T=j.toString,S={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return S.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~S.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},S.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),R(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},S.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},S.isZ=function(t){return t instanceof S.Z},S.init=function(e,i){var r;if(!e)return S.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=S.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(S.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=S.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}}return S.Z(r,e)},n=function(t,e){return S.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},S.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return _(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=L,n.isFunction=Z,n.isWindow=$,n.isArray=A,n.isPlainObject=R,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(M(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return S.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&S.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):M(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e="object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(S.qsa(this[0],t)):this.map(function(){return S.qsa(this,t)})},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:S.matches(i,t));)i=i!==e&&!_(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!_(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return B(e,t)},parent:function(t){return B(N(this.pluck("parentNode")),t)},children:function(t){return B(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return B(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))})},text:function(e){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=e===t?"":""+e})},attr:function(n,i){var r;return"string"==typeof n&&i===t?0==this.length||1!==this[0].nodeType?t:"value"==n&&"INPUT"==this[0].nodeName?this.val():!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&X(this,t)})},prop:function(e,n){return e=P[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=J(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?Y(i):t},val:function(t){return 0===arguments.length?this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=J(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r=this[0],o=getComputedStyle(r,"");if(!r)return;if("string"==typeof t)return r.style[C(t)]||o.getPropertyValue(t);if(A(t)){var s={};return n.each(A(t)?t:[t],function(t,e){s[e]=r.style[C(e)]||o.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?W(this,""):(i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),void W(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?$(s)?s["inner"+i]:_(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:S.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null,r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,a),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),S.Z.prototype=n.fn,S.uniq=N,S.deserializeValue=Y,n.zepto=S,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function T(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){if(r(e)){var i=function(){return e.apply(n,arguments)};return i._zid=l(e),i}if(o(n))return t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(T(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=T(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function l(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function h(t,e,i,r){return t.global?l(e||n,i,r):void 0}function p(e){e.global&&0===t.active++&&h(e,null,"ajaxStart")}function d(e){e.global&&!--t.active&&h(e,null,"ajaxStop")}function m(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||h(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void h(e,n,"ajaxSend",[t,e])}function g(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),h(n,r,"ajaxSuccess",[e,n,t]),y(o,e,n)}function v(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),h(i,o,"ajaxError",[n,i,t||e]),y(e,n,i)}function y(t,e,n){var i=n.context;n.complete.call(i,e,t),h(n,i,"ajaxComplete",[e,n]),d(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function w(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function E(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=w(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function S(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?S(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/;t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?g(f[0],l,i,r):v(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),o=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===n[i]&&(n[i]=t.ajaxSettings[i]);p(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),E(n),n.cache===!1&&(n.url=w(n.url,"_="+Date.now()));var s=n.dataType,a=/\?.+=\?/.test(n.url);if("jsonp"==s||a)return a||(n.url=w(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var j,u=n.accepts[s],f={},l=function(t,e){f[t.toLowerCase()]=[t,e]},h=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,d=n.xhr(),y=d.setRequestHeader;if(o&&o.promise(d),n.crossDomain||l("X-Requested-With","XMLHttpRequest"),l("Accept",u||"*/*"),(u=n.mimeType||u)&&(u.indexOf(",")>-1&&(u=u.split(",",2)[0]),d.overrideMimeType&&d.overrideMimeType(u)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&l("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(r in n.headers)l(r,n.headers[r]);if(d.setRequestHeader=l,d.onreadystatechange=function(){if(4==d.readyState){d.onreadystatechange=x,clearTimeout(j);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){s=s||b(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==s?(1,eval)(e):"xml"==s?e=d.responseXML:"json"==s&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?v(i,"parsererror",d,n,o):g(e,d,n,o)}else v(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),v(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var T="async"in n?n.async:!0;d.open(n.type,n.url,T,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(j=setTimeout(function(){d.onreadystatechange=x,d.abort(),v(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},S(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n,e=[];return t([].slice.call(this.get(0).elements)).each(function(){n=t(this);var i=n.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&("radio"!=i&&"checkbox"!=i||this.checked)&&e.push({name:n.attr("name"),value:n.val()})}),e},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto); diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php new file mode 100644 index 0000000..8db1493 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php @@ -0,0 +1,42 @@ + +
+

Environment & details:

+ +
+ $data): ?> +
+ + + + + + + + + + $value): ?> + + + + + +
KeyValue
escape($k) ?>dump($value) ?>
+ + + empty + +
+ +
+ + +
+ + $handler): ?> +
+ . escape(get_class($handler)) ?> +
+ +
+ +
diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php new file mode 100644 index 0000000..b7717d7 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php @@ -0,0 +1,63 @@ + +
+ $frame): ?> + getLine(); ?> +
+ + getFileLines($line - 20, 40); + + // getFileLines can return null if there is no source code + if ($range): + $range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range); + $start = key($range) + 1; + $code = join("\n", $range); + ?> +
escape($code) ?>
+ + + + + dumpArgs($frame); ?> + +
+ Arguments +
+
+ +
+ + + getComments(); + ?> +
+ $comment): ?> + +
+ escape($context) ?> + escapeButPreserveUris($comment) ?> +
+ +
+ +
+ +
diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php new file mode 100644 index 0000000..a4bc338 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php @@ -0,0 +1,17 @@ + + $frame): ?> +
+ +
+ breakOnDelimiter('\\', $tpl->escape($frame->getClass() ?: '')) ?> + breakOnDelimiter('\\', $tpl->escape($frame->getFunction() ?: '')) ?> +
+ +
+ getFile() ? $tpl->breakOnDelimiter('/', $tpl->shorten($tpl->escape($frame->getFile()))) : '<#unknown>' ?>getLine() ?> +
+
+"> + render($frame_list) ?> +
\ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php new file mode 100644 index 0000000..5d32f71 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php @@ -0,0 +1,14 @@ + diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php new file mode 100644 index 0000000..2f2d90f --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php @@ -0,0 +1,96 @@ +
+
+ $nameSection): ?> + + escape($nameSection) ?> + + escape($nameSection) . ' \\' ?> + + + + (escape($code) ?>) + +
+ +
+ + escape($message) ?> + + + +
+ Previous exceptions +
+ +
    + $previousMessage): ?> +
  • + escape($previousMessage) ?> + () +
  • + +
+ + + + + + No message + + + + + escape($plain_exception) ?> + + +
+
diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php new file mode 100644 index 0000000..f682cbb --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php @@ -0,0 +1,3 @@ +
+ render($header) ?> +
diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php new file mode 100644 index 0000000..6b676cc --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php @@ -0,0 +1,33 @@ + + + + + + + + <?php echo $tpl->escape($page_title) ?> + + + + + +
+
+ + render($panel_left_outer) ?> + + render($panel_details_outer) ?> + +
+
+ + + + + + + diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php new file mode 100644 index 0000000..a85e451 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php @@ -0,0 +1,2 @@ +render($frame_code) ?> +render($env_details) ?> \ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php new file mode 100644 index 0000000..8162d8c --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php @@ -0,0 +1,3 @@ +
+ render($panel_details) ?> +
\ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php new file mode 100644 index 0000000..7e652e4 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php @@ -0,0 +1,4 @@ +render($header_outer); +$tpl->render($frames_description); +$tpl->render($frames_container); diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php new file mode 100644 index 0000000..77b575c --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php @@ -0,0 +1,3 @@ +
+ render($panel_left) ?> +
\ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Run.php b/vendor/filp/whoops/src/Whoops/Run.php new file mode 100644 index 0000000..77ec212 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Run.php @@ -0,0 +1,461 @@ + + */ + +namespace Whoops; + +use InvalidArgumentException; +use Whoops\Exception\ErrorException; +use Whoops\Exception\Inspector; +use Whoops\Handler\CallbackHandler; +use Whoops\Handler\Handler; +use Whoops\Handler\HandlerInterface; +use Whoops\Util\Misc; +use Whoops\Util\SystemFacade; + +final class Run implements RunInterface +{ + private $isRegistered; + private $allowQuit = true; + private $sendOutput = true; + + /** + * @var integer|false + */ + private $sendHttpCode = 500; + + /** + * @var HandlerInterface[] + */ + private $handlerQueue = []; + + private $silencedPatterns = []; + + private $system; + + public function __construct(SystemFacade $system = null) + { + $this->system = $system ?: new SystemFacade; + } + + /** + * Prepends a handler to the start of the queue + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return Run + * @deprecated use appendHandler and prependHandler instead + */ + public function pushHandler($handler) + { + return $this->prependHandler($handler); + } + + /** + * Appends a handler to the end of the queue + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return Run + */ + public function appendHandler($handler) + { + array_push($this->handlerQueue, $this->resolveHandler($handler)); + return $this; + } + + /** + * Prepends a handler to the start of the queue + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return Run + */ + public function prependHandler($handler) + { + array_unshift($this->handlerQueue, $this->resolveHandler($handler)); + return $this; + } + + /** + * Create a CallbackHandler from callable and throw if handler is invalid + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return HandlerInterface + */ + private function resolveHandler($handler) + { + if (is_callable($handler)) { + $handler = new CallbackHandler($handler); + } + + if (!$handler instanceof HandlerInterface) { + throw new InvalidArgumentException( + "Argument to " . __METHOD__ . " must be a callable, or instance of " + . "Whoops\\Handler\\HandlerInterface" + ); + } + + return $handler; + } + + /** + * Removes the last handler in the queue and returns it. + * Returns null if there"s nothing else to pop. + * @return null|HandlerInterface + */ + public function popHandler() + { + return array_pop($this->handlerQueue); + } + + /** + * Removes the first handler in the queue and returns it. + * Returns null if there"s nothing else to shift. + * @return null|HandlerInterface + */ + public function shiftHandler() + { + return array_shift($this->handlerQueue); + } + + /** + * Returns an array with all handlers, in the + * order they were added to the queue. + * @return array + */ + public function getHandlers() + { + return $this->handlerQueue; + } + + /** + * Clears all handlers in the handlerQueue, including + * the default PrettyPage handler. + * @return Run + */ + public function clearHandlers() + { + $this->handlerQueue = []; + return $this; + } + + /** + * @param \Throwable $exception + * @return Inspector + */ + private function getInspector($exception) + { + return new Inspector($exception); + } + + /** + * Registers this instance as an error handler. + * @return Run + */ + public function register() + { + if (!$this->isRegistered) { + // Workaround PHP bug 42098 + // https://bugs.php.net/bug.php?id=42098 + class_exists("\\Whoops\\Exception\\ErrorException"); + class_exists("\\Whoops\\Exception\\FrameCollection"); + class_exists("\\Whoops\\Exception\\Frame"); + class_exists("\\Whoops\\Exception\\Inspector"); + + $this->system->setErrorHandler([$this, self::ERROR_HANDLER]); + $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]); + $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]); + + $this->isRegistered = true; + } + + return $this; + } + + /** + * Unregisters all handlers registered by this Whoops\Run instance + * @return Run + */ + public function unregister() + { + if ($this->isRegistered) { + $this->system->restoreExceptionHandler(); + $this->system->restoreErrorHandler(); + + $this->isRegistered = false; + } + + return $this; + } + + /** + * Should Whoops allow Handlers to force the script to quit? + * @param bool|int $exit + * @return bool + */ + public function allowQuit($exit = null) + { + if (func_num_args() == 0) { + return $this->allowQuit; + } + + return $this->allowQuit = (bool) $exit; + } + + /** + * Silence particular errors in particular files + * @param array|string $patterns List or a single regex pattern to match + * @param int $levels Defaults to E_STRICT | E_DEPRECATED + * @return \Whoops\Run + */ + public function silenceErrorsInPaths($patterns, $levels = 10240) + { + $this->silencedPatterns = array_merge( + $this->silencedPatterns, + array_map( + function ($pattern) use ($levels) { + return [ + "pattern" => $pattern, + "levels" => $levels, + ]; + }, + (array) $patterns + ) + ); + return $this; + } + + + /** + * Returns an array with silent errors in path configuration + * + * @return array + */ + public function getSilenceErrorsInPaths() + { + return $this->silencedPatterns; + } + + /* + * Should Whoops send HTTP error code to the browser if possible? + * Whoops will by default send HTTP code 500, but you may wish to + * use 502, 503, or another 5xx family code. + * + * @param bool|int $code + * @return int|false + */ + public function sendHttpCode($code = null) + { + if (func_num_args() == 0) { + return $this->sendHttpCode; + } + + if (!$code) { + return $this->sendHttpCode = false; + } + + if ($code === true) { + $code = 500; + } + + if ($code < 400 || 600 <= $code) { + throw new InvalidArgumentException( + "Invalid status code '$code', must be 4xx or 5xx" + ); + } + + return $this->sendHttpCode = $code; + } + + /** + * Should Whoops push output directly to the client? + * If this is false, output will be returned by handleException + * @param bool|int $send + * @return bool + */ + public function writeToOutput($send = null) + { + if (func_num_args() == 0) { + return $this->sendOutput; + } + + return $this->sendOutput = (bool) $send; + } + + /** + * Handles an exception, ultimately generating a Whoops error + * page. + * + * @param \Throwable $exception + * @return string Output generated by handlers + */ + public function handleException($exception) + { + // Walk the registered handlers in the reverse order + // they were registered, and pass off the exception + $inspector = $this->getInspector($exception); + + // Capture output produced while handling the exception, + // we might want to send it straight away to the client, + // or return it silently. + $this->system->startOutputBuffering(); + + // Just in case there are no handlers: + $handlerResponse = null; + $handlerContentType = null; + + try { + foreach ($this->handlerQueue as $handler) { + $handler->setRun($this); + $handler->setInspector($inspector); + $handler->setException($exception); + + // The HandlerInterface does not require an Exception passed to handle() + // and neither of our bundled handlers use it. + // However, 3rd party handlers may have already relied on this parameter, + // and removing it would be possibly breaking for users. + $handlerResponse = $handler->handle($exception); + + // Collect the content type for possible sending in the headers. + $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null; + + if (in_array($handlerResponse, [Handler::LAST_HANDLER, Handler::QUIT])) { + // The Handler has handled the exception in some way, and + // wishes to quit execution (Handler::QUIT), or skip any + // other handlers (Handler::LAST_HANDLER). If $this->allowQuit + // is false, Handler::QUIT behaves like Handler::LAST_HANDLER + break; + } + } + + $willQuit = $handlerResponse == Handler::QUIT && $this->allowQuit(); + } finally { + $output = $this->system->cleanOutputBuffer(); + } + + // If we're allowed to, send output generated by handlers directly + // to the output, otherwise, and if the script doesn't quit, return + // it so that it may be used by the caller + if ($this->writeToOutput()) { + // @todo Might be able to clean this up a bit better + if ($willQuit) { + // Cleanup all other output buffers before sending our output: + while ($this->system->getOutputBufferLevel() > 0) { + $this->system->endOutputBuffering(); + } + + // Send any headers if needed: + if (Misc::canSendHeaders() && $handlerContentType) { + header("Content-Type: {$handlerContentType}"); + } + } + + $this->writeToOutputNow($output); + } + + if ($willQuit) { + // HHVM fix for https://github.com/facebook/hhvm/issues/4055 + $this->system->flushOutputBuffer(); + + $this->system->stopExecution(1); + } + + return $output; + } + + /** + * Converts generic PHP errors to \ErrorException + * instances, before passing them off to be handled. + * + * This method MUST be compatible with set_error_handler. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * + * @return bool + * @throws ErrorException + */ + public function handleError($level, $message, $file = null, $line = null) + { + if ($level & $this->system->getErrorReportingLevel()) { + foreach ($this->silencedPatterns as $entry) { + $pathMatches = (bool) preg_match($entry["pattern"], $file); + $levelMatches = $level & $entry["levels"]; + if ($pathMatches && $levelMatches) { + // Ignore the error, abort handling + // See https://github.com/filp/whoops/issues/418 + return true; + } + } + + // XXX we pass $level for the "code" param only for BC reasons. + // see https://github.com/filp/whoops/issues/267 + $exception = new ErrorException($message, /*code*/ $level, /*severity*/ $level, $file, $line); + if ($this->canThrowExceptions) { + throw $exception; + } else { + $this->handleException($exception); + } + // Do not propagate errors which were already handled by Whoops. + return true; + } + + // Propagate error to the next handler, allows error_get_last() to + // work on silenced errors. + return false; + } + + /** + * Special case to deal with Fatal errors and the like. + */ + public function handleShutdown() + { + // If we reached this step, we are in shutdown handler. + // An exception thrown in a shutdown handler will not be propagated + // to the exception handler. Pass that information along. + $this->canThrowExceptions = false; + + $error = $this->system->getLastError(); + if ($error && Misc::isLevelFatal($error['type'])) { + // If there was a fatal error, + // it was not handled in handleError yet. + $this->allowQuit = false; + $this->handleError( + $error['type'], + $error['message'], + $error['file'], + $error['line'] + ); + } + } + + /** + * In certain scenarios, like in shutdown handler, we can not throw exceptions + * @var bool + */ + private $canThrowExceptions = true; + + /** + * Echo something to the browser + * @param string $output + * @return $this + */ + private function writeToOutputNow($output) + { + if ($this->sendHttpCode() && \Whoops\Util\Misc::canSendHeaders()) { + $this->system->setHttpResponseCode( + $this->sendHttpCode() + ); + } + + echo $output; + + return $this; + } +} diff --git a/vendor/filp/whoops/src/Whoops/RunInterface.php b/vendor/filp/whoops/src/Whoops/RunInterface.php new file mode 100644 index 0000000..67ba90d --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/RunInterface.php @@ -0,0 +1,131 @@ + + */ + +namespace Whoops; + +use InvalidArgumentException; +use Whoops\Exception\ErrorException; +use Whoops\Handler\HandlerInterface; + +interface RunInterface +{ + const EXCEPTION_HANDLER = "handleException"; + const ERROR_HANDLER = "handleError"; + const SHUTDOWN_HANDLER = "handleShutdown"; + + /** + * Pushes a handler to the end of the stack + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return Run + */ + public function pushHandler($handler); + + /** + * Removes the last handler in the stack and returns it. + * Returns null if there"s nothing else to pop. + * + * @return null|HandlerInterface + */ + public function popHandler(); + + /** + * Returns an array with all handlers, in the + * order they were added to the stack. + * + * @return array + */ + public function getHandlers(); + + /** + * Clears all handlers in the handlerStack, including + * the default PrettyPage handler. + * + * @return Run + */ + public function clearHandlers(); + + /** + * Registers this instance as an error handler. + * + * @return Run + */ + public function register(); + + /** + * Unregisters all handlers registered by this Whoops\Run instance + * + * @return Run + */ + public function unregister(); + + /** + * Should Whoops allow Handlers to force the script to quit? + * + * @param bool|int $exit + * @return bool + */ + public function allowQuit($exit = null); + + /** + * Silence particular errors in particular files + * + * @param array|string $patterns List or a single regex pattern to match + * @param int $levels Defaults to E_STRICT | E_DEPRECATED + * @return \Whoops\Run + */ + public function silenceErrorsInPaths($patterns, $levels = 10240); + + /** + * Should Whoops send HTTP error code to the browser if possible? + * Whoops will by default send HTTP code 500, but you may wish to + * use 502, 503, or another 5xx family code. + * + * @param bool|int $code + * @return int|false + */ + public function sendHttpCode($code = null); + + /** + * Should Whoops push output directly to the client? + * If this is false, output will be returned by handleException + * + * @param bool|int $send + * @return bool + */ + public function writeToOutput($send = null); + + /** + * Handles an exception, ultimately generating a Whoops error + * page. + * + * @param \Throwable $exception + * @return string Output generated by handlers + */ + public function handleException($exception); + + /** + * Converts generic PHP errors to \ErrorException + * instances, before passing them off to be handled. + * + * This method MUST be compatible with set_error_handler. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * + * @return bool + * @throws ErrorException + */ + public function handleError($level, $message, $file = null, $line = null); + + /** + * Special case to deal with Fatal errors and the like. + */ + public function handleShutdown(); +} diff --git a/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php b/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php new file mode 100644 index 0000000..8c828fd --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php @@ -0,0 +1,36 @@ + + */ + +namespace Whoops\Util; + +/** + * Used as output callable for Symfony\Component\VarDumper\Dumper\HtmlDumper::dump() + * + * @see TemplateHelper::dump() + */ +class HtmlDumperOutput +{ + private $output; + + public function __invoke($line, $depth) + { + // A negative depth means "end of dump" + if ($depth >= 0) { + // Adds a two spaces indentation to the line + $this->output .= str_repeat(' ', $depth) . $line . "\n"; + } + } + + public function getOutput() + { + return $this->output; + } + + public function clear() + { + $this->output = null; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/Misc.php b/vendor/filp/whoops/src/Whoops/Util/Misc.php new file mode 100644 index 0000000..001a687 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/Misc.php @@ -0,0 +1,77 @@ + + */ + +namespace Whoops\Util; + +class Misc +{ + /** + * Can we at this point in time send HTTP headers? + * + * Currently this checks if we are even serving an HTTP request, + * as opposed to running from a command line. + * + * If we are serving an HTTP request, we check if it's not too late. + * + * @return bool + */ + public static function canSendHeaders() + { + return isset($_SERVER["REQUEST_URI"]) && !headers_sent(); + } + + public static function isAjaxRequest() + { + return ( + !empty($_SERVER['HTTP_X_REQUESTED_WITH']) + && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); + } + + /** + * Check, if possible, that this execution was triggered by a command line. + * @return bool + */ + public static function isCommandLine() + { + return PHP_SAPI == 'cli'; + } + + /** + * Translate ErrorException code into the represented constant. + * + * @param int $error_code + * @return string + */ + public static function translateErrorCode($error_code) + { + $constants = get_defined_constants(true); + if (array_key_exists('Core', $constants)) { + foreach ($constants['Core'] as $constant => $value) { + if (substr($constant, 0, 2) == 'E_' && $value == $error_code) { + return $constant; + } + } + } + return "E_UNKNOWN"; + } + + /** + * Determine if an error level is fatal (halts execution) + * + * @param int $level + * @return bool + */ + public static function isLevelFatal($level) + { + $errors = E_ERROR; + $errors |= E_PARSE; + $errors |= E_CORE_ERROR; + $errors |= E_CORE_WARNING; + $errors |= E_COMPILE_ERROR; + $errors |= E_COMPILE_WARNING; + return ($level & $errors) > 0; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php b/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php new file mode 100644 index 0000000..fb1bc28 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php @@ -0,0 +1,137 @@ + + */ + +namespace Whoops\Util; + +class SystemFacade +{ + /** + * Turns on output buffering. + * + * @return bool + */ + public function startOutputBuffering() + { + return ob_start(); + } + + /** + * @param callable $handler + * @param int $types + * + * @return callable|null + */ + public function setErrorHandler(callable $handler, $types = 'use-php-defaults') + { + // Since PHP 5.4 the constant E_ALL contains all errors (even E_STRICT) + if ($types === 'use-php-defaults') { + $types = E_ALL; + } + return set_error_handler($handler, $types); + } + + /** + * @param callable $handler + * + * @return callable|null + */ + public function setExceptionHandler(callable $handler) + { + return set_exception_handler($handler); + } + + /** + * @return void + */ + public function restoreExceptionHandler() + { + restore_exception_handler(); + } + + /** + * @return void + */ + public function restoreErrorHandler() + { + restore_error_handler(); + } + + /** + * @param callable $function + * + * @return void + */ + public function registerShutdownFunction(callable $function) + { + register_shutdown_function($function); + } + + /** + * @return string|false + */ + public function cleanOutputBuffer() + { + return ob_get_clean(); + } + + /** + * @return int + */ + public function getOutputBufferLevel() + { + return ob_get_level(); + } + + /** + * @return bool + */ + public function endOutputBuffering() + { + return ob_end_clean(); + } + + /** + * @return void + */ + public function flushOutputBuffer() + { + flush(); + } + + /** + * @return int + */ + public function getErrorReportingLevel() + { + return error_reporting(); + } + + /** + * @return array|null + */ + public function getLastError() + { + return error_get_last(); + } + + /** + * @param int $httpCode + * + * @return int + */ + public function setHttpResponseCode($httpCode) + { + return http_response_code($httpCode); + } + + /** + * @param int $exitStatus + */ + public function stopExecution($exitStatus) + { + exit($exitStatus); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php b/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php new file mode 100644 index 0000000..9c7cec2 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php @@ -0,0 +1,352 @@ + + */ + +namespace Whoops\Util; + +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Cloner\AbstractCloner; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Whoops\Exception\Frame; + +/** + * Exposes useful tools for working with/in templates + */ +class TemplateHelper +{ + /** + * An array of variables to be passed to all templates + * @var array + */ + private $variables = []; + + /** + * @var HtmlDumper + */ + private $htmlDumper; + + /** + * @var HtmlDumperOutput + */ + private $htmlDumperOutput; + + /** + * @var AbstractCloner + */ + private $cloner; + + /** + * @var string + */ + private $applicationRootPath; + + public function __construct() + { + // root path for ordinary composer projects + $this->applicationRootPath = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + } + + /** + * Escapes a string for output in an HTML document + * + * @param string $raw + * @return string + */ + public function escape($raw) + { + $flags = ENT_QUOTES; + + // HHVM has all constants defined, but only ENT_IGNORE + // works at the moment + if (defined("ENT_SUBSTITUTE") && !defined("HHVM_VERSION")) { + $flags |= ENT_SUBSTITUTE; + } else { + // This is for 5.3. + // The documentation warns of a potential security issue, + // but it seems it does not apply in our case, because + // we do not blacklist anything anywhere. + $flags |= ENT_IGNORE; + } + + $raw = str_replace(chr(9), ' ', $raw); + + return htmlspecialchars($raw, $flags, "UTF-8"); + } + + /** + * Escapes a string for output in an HTML document, but preserves + * URIs within it, and converts them to clickable anchor elements. + * + * @param string $raw + * @return string + */ + public function escapeButPreserveUris($raw) + { + $escaped = $this->escape($raw); + return preg_replace( + "@([A-z]+?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@", + "$1", + $escaped + ); + } + + /** + * Makes sure that the given string breaks on the delimiter. + * + * @param string $delimiter + * @param string $s + * @return string + */ + public function breakOnDelimiter($delimiter, $s) + { + $parts = explode($delimiter, $s); + foreach ($parts as &$part) { + $part = '' . $part . ''; + } + + return implode($delimiter, $parts); + } + + /** + * Replace the part of the path that all files have in common. + * + * @param string $path + * @return string + */ + public function shorten($path) + { + if ($this->applicationRootPath != "/") { + $path = str_replace($this->applicationRootPath, '…', $path); + } + + return $path; + } + + private function getDumper() + { + if (!$this->htmlDumper && class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { + $this->htmlDumperOutput = new HtmlDumperOutput(); + // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump. + $this->htmlDumper = new HtmlDumper($this->htmlDumperOutput); + + $styles = [ + 'default' => 'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal', + 'num' => 'color:#BCD42A', + 'const' => 'color: #4bb1b1;', + 'str' => 'color:#BCD42A', + 'note' => 'color:#ef7c61', + 'ref' => 'color:#A0A0A0', + 'public' => 'color:#FFFFFF', + 'protected' => 'color:#FFFFFF', + 'private' => 'color:#FFFFFF', + 'meta' => 'color:#FFFFFF', + 'key' => 'color:#BCD42A', + 'index' => 'color:#ef7c61', + ]; + $this->htmlDumper->setStyles($styles); + } + + return $this->htmlDumper; + } + + /** + * Format the given value into a human readable string. + * + * @param mixed $value + * @return string + */ + public function dump($value) + { + $dumper = $this->getDumper(); + + if ($dumper) { + // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump. + // exclude verbose information (e.g. exception stack traces) + if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) { + $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE); + // Symfony VarDumper 2.6 Caster class dont exist. + } else { + $cloneVar = $this->getCloner()->cloneVar($value); + } + + $dumper->dump( + $cloneVar, + $this->htmlDumperOutput + ); + + $output = $this->htmlDumperOutput->getOutput(); + $this->htmlDumperOutput->clear(); + + return $output; + } + + return htmlspecialchars(print_r($value, true)); + } + + /** + * Format the args of the given Frame as a human readable html string + * + * @param Frame $frame + * @return string the rendered html + */ + public function dumpArgs(Frame $frame) + { + // we support frame args only when the optional dumper is available + if (!$this->getDumper()) { + return ''; + } + + $html = ''; + $numFrames = count($frame->getArgs()); + + if ($numFrames > 0) { + $html = '
    '; + foreach ($frame->getArgs() as $j => $frameArg) { + $html .= '
  1. '. $this->dump($frameArg) .'
  2. '; + } + $html .= '
'; + } + + return $html; + } + + /** + * Convert a string to a slug version of itself + * + * @param string $original + * @return string + */ + public function slug($original) + { + $slug = str_replace(" ", "-", $original); + $slug = preg_replace('/[^\w\d\-\_]/i', '', $slug); + return strtolower($slug); + } + + /** + * Given a template path, render it within its own scope. This + * method also accepts an array of additional variables to be + * passed to the template. + * + * @param string $template + * @param array $additionalVariables + */ + public function render($template, array $additionalVariables = null) + { + $variables = $this->getVariables(); + + // Pass the helper to the template: + $variables["tpl"] = $this; + + if ($additionalVariables !== null) { + $variables = array_replace($variables, $additionalVariables); + } + + call_user_func(function () { + extract(func_get_arg(1)); + require func_get_arg(0); + }, $template, $variables); + } + + /** + * Sets the variables to be passed to all templates rendered + * by this template helper. + * + * @param array $variables + */ + public function setVariables(array $variables) + { + $this->variables = $variables; + } + + /** + * Sets a single template variable, by its name: + * + * @param string $variableName + * @param mixed $variableValue + */ + public function setVariable($variableName, $variableValue) + { + $this->variables[$variableName] = $variableValue; + } + + /** + * Gets a single template variable, by its name, or + * $defaultValue if the variable does not exist + * + * @param string $variableName + * @param mixed $defaultValue + * @return mixed + */ + public function getVariable($variableName, $defaultValue = null) + { + return isset($this->variables[$variableName]) ? + $this->variables[$variableName] : $defaultValue; + } + + /** + * Unsets a single template variable, by its name + * + * @param string $variableName + */ + public function delVariable($variableName) + { + unset($this->variables[$variableName]); + } + + /** + * Returns all variables for this helper + * + * @return array + */ + public function getVariables() + { + return $this->variables; + } + + /** + * Set the cloner used for dumping variables. + * + * @param AbstractCloner $cloner + */ + public function setCloner($cloner) + { + $this->cloner = $cloner; + } + + /** + * Get the cloner used for dumping variables. + * + * @return AbstractCloner + */ + public function getCloner() + { + if (!$this->cloner) { + $this->cloner = new VarCloner(); + } + return $this->cloner; + } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->applicationRootPath = $applicationRootPath; + } + + /** + * Return the application root path. + * + * @return string + */ + public function getApplicationRootPath() + { + return $this->applicationRootPath; + } +} diff --git a/vendor/fzaninotto/faker/.gitignore b/vendor/fzaninotto/faker/.gitignore new file mode 100644 index 0000000..7579f74 --- /dev/null +++ b/vendor/fzaninotto/faker/.gitignore @@ -0,0 +1,2 @@ +vendor +composer.lock diff --git a/vendor/fzaninotto/faker/.travis.yml b/vendor/fzaninotto/faker/.travis.yml new file mode 100644 index 0000000..a719ba8 --- /dev/null +++ b/vendor/fzaninotto/faker/.travis.yml @@ -0,0 +1,25 @@ +language: php + +dist: precise + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - nightly + +sudo: false + +cache: + directories: + - $HOME/.composer/cache + +before_script: + - travis_retry composer self-update + - travis_retry composer install --no-interaction --prefer-dist + +script: make sniff test diff --git a/vendor/fzaninotto/faker/CHANGELOG.md b/vendor/fzaninotto/faker/CHANGELOG.md new file mode 100644 index 0000000..df218b0 --- /dev/null +++ b/vendor/fzaninotto/faker/CHANGELOG.md @@ -0,0 +1,641 @@ +CHANGELOG +========= + +2018-07-12, v1.8.0 +------------------ + +- Typo in readme [\#1521](https://github.com/fzaninotto/Faker/pull/1521) ([jmhobbs](https://github.com/jmhobbs)) +- Replaced Hilll with Hill [\#1516](https://github.com/fzaninotto/Faker/pull/1516) ([MarkVaughn](https://github.com/MarkVaughn)) +- \[it\_IT\] Improve vat ID generated using official rules [\#1508](https://github.com/fzaninotto/Faker/pull/1508) ([mavimo](https://github.com/mavimo)) +- \[hu\_HU\] Address: Fix unnecessary new line in string [\#1507](https://github.com/fzaninotto/Faker/pull/1507) ([ntomka](https://github.com/ntomka)) +- add phone numer format [\#1506](https://github.com/fzaninotto/Faker/pull/1506) ([Enosh-Yu](https://github.com/Enosh-Yu)) +- Fix typo in fr\_CA Provider [\#1505](https://github.com/fzaninotto/Faker/pull/1505) ([ultreson](https://github.com/ultreson)) +- Add fake-car provider link [\#1497](https://github.com/fzaninotto/Faker/pull/1497) ([pelmered](https://github.com/pelmered)) +- create `passthrough` function [\#1493](https://github.com/fzaninotto/Faker/pull/1493) ([browner12](https://github.com/browner12)) +- update Polish bank list [\#1482](https://github.com/fzaninotto/Faker/pull/1482) ([IonBazan](https://github.com/IonBazan)) +- Update the parameters to check if the setter is callable [\#1470](https://github.com/fzaninotto/Faker/pull/1470) ([rossmitchell](https://github.com/rossmitchell)) +- Push the max date far into the future so the test can pass [\#1469](https://github.com/fzaninotto/Faker/pull/1469) ([rossmitchell](https://github.com/rossmitchell)) +- Update Address.php [\#1465](https://github.com/fzaninotto/Faker/pull/1465) ([Saibamen](https://github.com/Saibamen)) +- Turkish identity number for tr\_TR [\#1462](https://github.com/fzaninotto/Faker/pull/1462) ([aykutaras](https://github.com/aykutaras)) +- Fixing rare iin with 13-digits. [\#1450](https://github.com/fzaninotto/Faker/pull/1450) ([vadimonus](https://github.com/vadimonus)) +- Fix Polish PESEL faker [\#1449](https://github.com/fzaninotto/Faker/pull/1449) ([Dartui](https://github.com/Dartui)) +- Adds valid 08 number formats for fr\_FR [\#1439](https://github.com/fzaninotto/Faker/pull/1439) ([ppelgrims](https://github.com/ppelgrims)) +- Add YouTube provider link [\#1422](https://github.com/fzaninotto/Faker/pull/1422) ([aalaap](https://github.com/aalaap)) +- Update PHPDoc of the DateTime provider. [\#1419](https://github.com/fzaninotto/Faker/pull/1419) ([tomzx](https://github.com/tomzx)) +- Normalize name of variable [\#1412](https://github.com/fzaninotto/Faker/pull/1412) ([eaglewu](https://github.com/eaglewu)) +- Added "blockchain" to en-us company provider catchPhrase method [\#1411](https://github.com/fzaninotto/Faker/pull/1411) ([samoldenburg](https://github.com/samoldenburg)) +- Fix for Spot2 ORM EntityPopulator [\#1408](https://github.com/fzaninotto/Faker/pull/1408) ([michal-borek](https://github.com/michal-borek)) +- TH color name [\#1404](https://github.com/fzaninotto/Faker/pull/1404) ([Naruedom](https://github.com/Naruedom)) +- added Malaysia \[ms\_MY\] locale [\#1403](https://github.com/fzaninotto/Faker/pull/1403) ([kenfai](https://github.com/kenfai)) +- Implementation of the function that generates Brazilian area codes fixed. [\#1401](https://github.com/fzaninotto/Faker/pull/1401) ([jackmiras](https://github.com/jackmiras)) +- VISA retired the 13 digit PAN moved to new cardParams [\#1400](https://github.com/fzaninotto/Faker/pull/1400) ([hppycoder](https://github.com/hppycoder)) +- Remove unused variable inside closure [\#1395](https://github.com/fzaninotto/Faker/pull/1395) ([carusogabriel](https://github.com/carusogabriel)) +- .nz domain updates [\#1393](https://github.com/fzaninotto/Faker/pull/1393) ([xurizaemon](https://github.com/xurizaemon)) +- Add licenceCode method in the to es\_ES person provider [\#1392](https://github.com/fzaninotto/Faker/pull/1392) ([ffiguereo](https://github.com/ffiguereo)) +- allow `randomElements` to accept a Traversable object [\#1389](https://github.com/fzaninotto/Faker/pull/1389) ([browner12](https://github.com/browner12)) +- Doc: rg remove formatting [\#1387](https://github.com/fzaninotto/Faker/pull/1387) ([emtudo](https://github.com/emtudo)) +- Add numbers with start 4 [\#1386](https://github.com/fzaninotto/Faker/pull/1386) ([emtudo](https://github.com/emtudo)) +- update th\_TH mobile number format [\#1385](https://github.com/fzaninotto/Faker/pull/1385) ([earthpyy](https://github.com/earthpyy)) +- Translate country names for lv\_LV provider. [\#1383](https://github.com/fzaninotto/Faker/pull/1383) ([ronaldsgailis](https://github.com/ronaldsgailis)) +- Clean elses [\#1382](https://github.com/fzaninotto/Faker/pull/1382) ([carusogabriel](https://github.com/carusogabriel)) +- French vat formatter [\#1381](https://github.com/fzaninotto/Faker/pull/1381) ([ppelgrims](https://github.com/ppelgrims)) +- Replaces rtrim with preg\_replace [\#1380](https://github.com/fzaninotto/Faker/pull/1380) ([ppelgrims](https://github.com/ppelgrims)) +- Refactoring tests [\#1375](https://github.com/fzaninotto/Faker/pull/1375) ([carusogabriel](https://github.com/carusogabriel)) +- Added link in readme to provider FakerRestaurant [\#1374](https://github.com/fzaninotto/Faker/pull/1374) ([jzonta](https://github.com/jzonta)) +- Remove obsolete currency codes [\#1373](https://github.com/fzaninotto/Faker/pull/1373) ([tpraxl](https://github.com/tpraxl)) +- \[ru\_RU\] Updated countries and added source link [\#1372](https://github.com/fzaninotto/Faker/pull/1372) ([ilyahoilik](https://github.com/ilyahoilik)) +- Test against PHP 7.2 [\#1371](https://github.com/fzaninotto/Faker/pull/1371) ([carusogabriel](https://github.com/carusogabriel)) +- Feature: nl\_BE text provider [\#1370](https://github.com/fzaninotto/Faker/pull/1370) ([rauwebieten](https://github.com/rauwebieten)) +- default value for Payment::iban\(\) country code [\#1369](https://github.com/fzaninotto/Faker/pull/1369) ([madmanmax](https://github.com/madmanmax)) +- skip test failing on bigendian [\#1365](https://github.com/fzaninotto/Faker/pull/1365) ([remicollet](https://github.com/remicollet)) +- Update Person.php [\#1364](https://github.com/fzaninotto/Faker/pull/1364) ([majamusan](https://github.com/majamusan)) +- Prevent errors on private methods [\#1363](https://github.com/fzaninotto/Faker/pull/1363) ([petecoop](https://github.com/petecoop)) +- adds rijksregisternummer [\#1361](https://github.com/fzaninotto/Faker/pull/1361) ([ppelgrims](https://github.com/ppelgrims)) +- Add secondary address to fr\_FR provider [\#1356](https://github.com/fzaninotto/Faker/pull/1356) ([nicodmf](https://github.com/nicodmf)) +- Add company provider for tr\_TR [\#1355](https://github.com/fzaninotto/Faker/pull/1355) ([yuks](https://github.com/yuks)) +- nb\_NO provider updates [\#1350](https://github.com/fzaninotto/Faker/pull/1350) ([alexqhj](https://github.com/alexqhj)) +- only test available date range on 32-bit [\#1348](https://github.com/fzaninotto/Faker/pull/1348) ([remicollet](https://github.com/remicollet)) +- Bump PHPUnit version for namespace compatibility [\#1345](https://github.com/fzaninotto/Faker/pull/1345) ([carusogabriel](https://github.com/carusogabriel)) +- Use PSR-1 for PHPUnit TestCase [\#1344](https://github.com/fzaninotto/Faker/pull/1344) ([carusogabriel](https://github.com/carusogabriel)) +- Fix FR\_fr 07 prefix mobile number generation [\#1343](https://github.com/fzaninotto/Faker/pull/1343) ([svanpoeck](https://github.com/svanpoeck)) +- Update Text.php [\#1339](https://github.com/fzaninotto/Faker/pull/1339) ([gulaandrij](https://github.com/gulaandrij)) +- Add two new company type in the Swiss Provider [\#1336](https://github.com/fzaninotto/Faker/pull/1336) ([pvullioud](https://github.com/pvullioud)) +- Change symbol 'minus' with code 226 to 'minus' with code 45 [\#1333](https://github.com/fzaninotto/Faker/pull/1333) ([Negasus](https://github.com/Negasus)) +- \[sl\_SI\] Created provider for Company [\#1331](https://github.com/fzaninotto/Faker/pull/1331) ([alesvaupotic](https://github.com/alesvaupotic)) +- Update city name [\#1328](https://github.com/fzaninotto/Faker/pull/1328) ([s9801077](https://github.com/s9801077)) +- Fix \#1305 realText in some cases breaks last character [\#1326](https://github.com/fzaninotto/Faker/pull/1326) ([iamraccoon](https://github.com/iamraccoon)) +- Real Dutch postal codes [\#1323](https://github.com/fzaninotto/Faker/pull/1323) ([ametad](https://github.com/ametad)) +- Added male and female titles for the en\_ZA locale [\#1321](https://github.com/fzaninotto/Faker/pull/1321) ([ViGouRCanberra](https://github.com/ViGouRCanberra)) +- Add German Email Providers [\#1320](https://github.com/fzaninotto/Faker/pull/1320) ([Stoffo](https://github.com/Stoffo)) +- Fix "Resource temporarily unavailable" [\#1319](https://github.com/fzaninotto/Faker/pull/1319) ([eberkund](https://github.com/eberkund)) +- Introduced the ability to specify a default timezone... [\#1316](https://github.com/fzaninotto/Faker/pull/1316) ([telkins](https://github.com/telkins)) +- South African licence codes [\#1315](https://github.com/fzaninotto/Faker/pull/1315) ([royalmitten](https://github.com/royalmitten)) +- Fix with incorrect name city. [\#1309](https://github.com/fzaninotto/Faker/pull/1309) ([zzenmate](https://github.com/zzenmate)) +- Fixed type-o in readme under section about Language specific formatters [\#1302](https://github.com/fzaninotto/Faker/pull/1302) ([espenkn](https://github.com/espenkn)) +- Update Person.php [\#1298](https://github.com/fzaninotto/Faker/pull/1298) ([yappkahowe](https://github.com/yappkahowe)) +- Allow children classes to access self::$suffix [\#1296](https://github.com/fzaninotto/Faker/pull/1296) ([greg0ire](https://github.com/greg0ire)) +- Fix with namespace payment provider for uk\_UA [\#1293](https://github.com/fzaninotto/Faker/pull/1293) ([zzenmate](https://github.com/zzenmate)) +- Update zh\_TW text provider [\#1292](https://github.com/fzaninotto/Faker/pull/1292) ([s9801077](https://github.com/s9801077)) +- Fix CURL status code in ImageTest.php [\#1290](https://github.com/fzaninotto/Faker/pull/1290) ([Sanfra1407](https://github.com/Sanfra1407)) +- Tax Id for companies and new formats for es\_VE [\#1287](https://github.com/fzaninotto/Faker/pull/1287) ([DIOHz0r](https://github.com/DIOHz0r)) +- Added idNumber for nl\_NL [\#1283](https://github.com/fzaninotto/Faker/pull/1283) ([artorozenga](https://github.com/artorozenga)) +- Feature/en us company ein [\#1273](https://github.com/fzaninotto/Faker/pull/1273) ([zachflower](https://github.com/zachflower)) + +2017-08-15, v1.7.0 +------------------ + +- Added more Ukrainian banks [\#1271](https://github.com/fzaninotto/Faker/pull/1271) ([iamraccoon](https://github.com/iamraccoon)) +- Hotfix/failing unit tests [\#1269](https://github.com/fzaninotto/Faker/pull/1269) ([zachflower](https://github.com/zachflower)) +- Lock Travis-CI environment to Ubuntu Precise [\#1268](https://github.com/fzaninotto/Faker/pull/1268) ([zachflower](https://github.com/zachflower)) +- Added Ukrainian job title [\#1267](https://github.com/fzaninotto/Faker/pull/1267) ([iamraccoon](https://github.com/iamraccoon)) +- Add compliant en\_US SSN generator [\#1266](https://github.com/fzaninotto/Faker/pull/1266) ([zachflower](https://github.com/zachflower)) +- Added more Ukrainian streets and removed irrelevant names. Added more Ukrainian mobile formats [\#1265](https://github.com/fzaninotto/Faker/pull/1265) ([iamraccoon](https://github.com/iamraccoon)) +- Add Internet Format for ja\_JP. [\#1260](https://github.com/fzaninotto/Faker/pull/1260) ([itigoppo](https://github.com/itigoppo)) +- rectify ISO 4217 codes [\#1258](https://github.com/fzaninotto/Faker/pull/1258) ([eidng8](https://github.com/eidng8)) +- Corrected of grammar of Ukrainian middlenames and test added [\#1257](https://github.com/fzaninotto/Faker/pull/1257) ([vladbuk](https://github.com/vladbuk)) +- Update ISO 4217 active codes [\#1251](https://github.com/fzaninotto/Faker/pull/1251) ([eidng8](https://github.com/eidng8)) +- Update Composer File [\#1248](https://github.com/fzaninotto/Faker/pull/1248) ([vinkla](https://github.com/vinkla)) +- Set capitals to false [\#1243](https://github.com/fzaninotto/Faker/pull/1243) ([Stichoza](https://github.com/Stichoza)) +- Use static instead of self [\#1242](https://github.com/fzaninotto/Faker/pull/1242) ([Stichoza](https://github.com/Stichoza)) +- Add VAT french format [\#1241](https://github.com/fzaninotto/Faker/pull/1241) ([baptistedonaux](https://github.com/baptistedonaux)) +- Add swedish job titles [\#1234](https://github.com/fzaninotto/Faker/pull/1234) ([vinkla](https://github.com/vinkla)) +- Name Simo shouldn't have comma in it [\#1230](https://github.com/fzaninotto/Faker/pull/1230) ([simoheinonen](https://github.com/simoheinonen)) +- Fix: Add method annotation for ValidGenerator [\#1223](https://github.com/fzaninotto/Faker/pull/1223) ([localheinz](https://github.com/localheinz)) +- Add real text for es\_ES [\#1220](https://github.com/fzaninotto/Faker/pull/1220) ([driade](https://github.com/driade)) +- Fix spelling errors [\#1218](https://github.com/fzaninotto/Faker/pull/1218) ([driade](https://github.com/driade)) +- Fix spelling errors [\#1217](https://github.com/fzaninotto/Faker/pull/1217) ([driade](https://github.com/driade)) +- Fixes typo [\#1212](https://github.com/fzaninotto/Faker/pull/1212) ([skullboner](https://github.com/skullboner)) +- Add Person::middleName for ru\_RU provider [\#1209](https://github.com/fzaninotto/Faker/pull/1209) ([JustBlackBird](https://github.com/JustBlackBird)) +- Fix creditCardDetails type hint [\#1208](https://github.com/fzaninotto/Faker/pull/1208) ([jejung](https://github.com/jejung)) +- Expand dictionaries for ru\_RU locale [\#1206](https://github.com/fzaninotto/Faker/pull/1206) ([pwsdotru](https://github.com/pwsdotru)) +- Fix ng\_NG to en\_NG [\#1205](https://github.com/fzaninotto/Faker/pull/1205) ([raphaeldealmeida](https://github.com/raphaeldealmeida)) +- Add INN and KPP support for ru\_RU locale [\#1204](https://github.com/fzaninotto/Faker/pull/1204) ([pwsdotru](https://github.com/pwsdotru)) +- Remove break line on pt\_PT Address format [\#1203](https://github.com/fzaninotto/Faker/pull/1203) ([raphaeldealmeida](https://github.com/raphaeldealmeida)) +- Fix syntax of phpdoc boolean property [\#1198](https://github.com/fzaninotto/Faker/pull/1198) ([pavelkovar](https://github.com/pavelkovar)) +- add en\_HK provider [\#1196](https://github.com/fzaninotto/Faker/pull/1196) ([miklcct](https://github.com/miklcct)) +- use secure https [\#1186](https://github.com/fzaninotto/Faker/pull/1186) ([jpuck](https://github.com/jpuck)) +- Add PhoneNumberFormat for ja\_JP. [\#1185](https://github.com/fzaninotto/Faker/pull/1185) ([itigoppo](https://github.com/itigoppo)) +- Fix: Add class-level method annotations for DateTime provider [\#1183](https://github.com/fzaninotto/Faker/pull/1183) ([localheinz](https://github.com/localheinz)) +- Add ar\_SA Color Provider [\#1182](https://github.com/fzaninotto/Faker/pull/1182) ([alhoqbani](https://github.com/alhoqbani)) +- Added uk\_UA Payment provider with bank name generator [\#1181](https://github.com/fzaninotto/Faker/pull/1181) ([spaghettimaster](https://github.com/spaghettimaster)) +- Typos [\#1177](https://github.com/fzaninotto/Faker/pull/1177) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Fix XML document example [\#1176](https://github.com/fzaninotto/Faker/pull/1176) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Added Emoji to Miscellaneous [\#1175](https://github.com/fzaninotto/Faker/pull/1175) ([thomasfdm](https://github.com/thomasfdm)) +- Typos and doc block fixes [\#1170](https://github.com/fzaninotto/Faker/pull/1170) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Rewrote deprecated `each\(\)` usage [\#1168](https://github.com/fzaninotto/Faker/pull/1168) ([hboomsma](https://github.com/hboomsma)) +- Refactor text method to remove duplication [\#1163](https://github.com/fzaninotto/Faker/pull/1163) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Generate valid individual identification numbers kk\_KZ [\#1161](https://github.com/fzaninotto/Faker/pull/1161) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +- Added Address and Company \[fa\_IR\] [\#1160](https://github.com/fzaninotto/Faker/pull/1160) ([thisissorna](https://github.com/thisissorna)) +- Add Peruvian DNI generator [\#1158](https://github.com/fzaninotto/Faker/pull/1158) ([jgwong](https://github.com/jgwong)) +- Removed double semicolon [\#1154](https://github.com/fzaninotto/Faker/pull/1154) ([pjona](https://github.com/pjona)) +- Add prefixes for nl\_NL [\#1151](https://github.com/fzaninotto/Faker/pull/1151) ([hyperized](https://github.com/hyperized)) +- Separated male and female names for sr\_RS locale. [\#1144](https://github.com/fzaninotto/Faker/pull/1144) ([bogdanpet](https://github.com/bogdanpet)) +- Add personal ID, VAT for zh\_TW [\#1135](https://github.com/fzaninotto/Faker/pull/1135) ([Dagolin](https://github.com/Dagolin)) +- Updating ninth digit on whole country [\#1132](https://github.com/fzaninotto/Faker/pull/1132) ([gpressutto5](https://github.com/gpressutto5)) +- Indian states added to en\_IN locale [\#1131](https://github.com/fzaninotto/Faker/pull/1131) ([jiveshsg](https://github.com/jiveshsg)) +- Add Text provider for ro\_MD [\#1129](https://github.com/fzaninotto/Faker/pull/1129) ([wecerny](https://github.com/wecerny)) +- Add strict to randomNumber example [\#1124](https://github.com/fzaninotto/Faker/pull/1124) ([leepownall](https://github.com/leepownall)) +- Say Eloquent is supported [\#1123](https://github.com/fzaninotto/Faker/pull/1123) ([guidocella](https://github.com/guidocella)) +- Link Eloquent Populator [\#1120](https://github.com/fzaninotto/Faker/pull/1120) ([guidocella](https://github.com/guidocella)) +- Removed dead code from Luhn.php [\#1118](https://github.com/fzaninotto/Faker/pull/1118) ([Newman101](https://github.com/Newman101)) +- Improve Internet::transliterate performance [\#1112](https://github.com/fzaninotto/Faker/pull/1112) ([dunglas](https://github.com/dunglas)) +- fix typo [\#1109](https://github.com/fzaninotto/Faker/pull/1109) ([johannesnagl](https://github.com/johannesnagl)) +- \[cs\_CZ\] Fixed Czech phone numbers [\#1108](https://github.com/fzaninotto/Faker/pull/1108) ([tomasbedrich](https://github.com/tomasbedrich)) +- Update MasterCard BIN Range [\#1103](https://github.com/fzaninotto/Faker/pull/1103) ([andysnell](https://github.com/andysnell)) +- Add biggest german cities [\#1102](https://github.com/fzaninotto/Faker/pull/1102) ([Konafets](https://github.com/Konafets)) +- Change postal code format for ko\_KR [\#1094](https://github.com/fzaninotto/Faker/pull/1094) ([coozplz](https://github.com/coozplz)) +- Introduced the ability to specify the timezone for dateTimeThis\*\(\) methods [\#1090](https://github.com/fzaninotto/Faker/pull/1090) ([telkins](https://github.com/telkins)) +- Fixed Issue \#1086 [\#1088](https://github.com/fzaninotto/Faker/pull/1088) ([Newman101](https://github.com/Newman101)) +- \[ja\_JP\]kana of Japanese name by gender. [\#1087](https://github.com/fzaninotto/Faker/pull/1087) ([itigoppo](https://github.com/itigoppo)) +- Fix unused code [\#1083](https://github.com/fzaninotto/Faker/pull/1083) ([borgogelli](https://github.com/borgogelli)) +- Amended permissions for en\_GB AddressTest.php [\#1071](https://github.com/fzaninotto/Faker/pull/1071) ([Newman101](https://github.com/Newman101)) +- Ensure unique IDs in randomHtml [\#1068](https://github.com/fzaninotto/Faker/pull/1068) ([vlakoff](https://github.com/vlakoff)) +- Updated \[de\_DE\] city names [\#1067](https://github.com/fzaninotto/Faker/pull/1067) ([plxx](https://github.com/plxx)) +- Update method signature in Generator phpdoc [\#1066](https://github.com/fzaninotto/Faker/pull/1066) ([vlakoff](https://github.com/vlakoff)) +- Add Thai providers [\#1065](https://github.com/fzaninotto/Faker/pull/1065) ([tuwannu](https://github.com/tuwannu)) +- \(Minor\) Fixed the default locale stated in the readme [\#1064](https://github.com/fzaninotto/Faker/pull/1064) ([taylankasap](https://github.com/taylankasap)) +- \[nl\_NL\] Make person provider behave more realistically [\#1061](https://github.com/fzaninotto/Faker/pull/1061) ([curry684](https://github.com/curry684)) +- Add allowDuplicates option to randomElements\(\) [\#1060](https://github.com/fzaninotto/Faker/pull/1060) ([vlakoff](https://github.com/vlakoff)) +- Docblocks: Add some missing @method tags [\#1059](https://github.com/fzaninotto/Faker/pull/1059) ([Kurre](https://github.com/Kurre)) +- \[fi\_FI\] Improve phone number generator [\#1054](https://github.com/fzaninotto/Faker/pull/1054) ([Kurre](https://github.com/Kurre)) +- Add personalIdentityNumber\(\) to fi\_FI/Person.php [\#1053](https://github.com/fzaninotto/Faker/pull/1053) ([oittaa](https://github.com/oittaa)) +- Issue \#1041 [\#1052](https://github.com/fzaninotto/Faker/pull/1052) ([daleattree](https://github.com/daleattree)) +- Update Text.php [\#1051](https://github.com/fzaninotto/Faker/pull/1051) ([gulaandrij](https://github.com/gulaandrij)) +- Fix French phone numbers with 07 prefix [\#1046](https://github.com/fzaninotto/Faker/pull/1046) ([fzaninotto](https://github.com/fzaninotto)) +- \[Generator.php\] mt\_rand\(\) changed in PHP 7.1 [\#1045](https://github.com/fzaninotto/Faker/pull/1045) ([oittaa](https://github.com/oittaa)) +- Add 'FI' to Payment Provider [\#1044](https://github.com/fzaninotto/Faker/pull/1044) ([oittaa](https://github.com/oittaa)) +- Added id number generator to Person Provider for the en\_ZA locale [\#1039](https://github.com/fzaninotto/Faker/pull/1039) ([smithandre](https://github.com/smithandre)) +- \[Feature\] Add nigerian provider [\#1030](https://github.com/fzaninotto/Faker/pull/1030) ([elchroy](https://github.com/elchroy)) +- \[pl\_PL\] Handle state. [\#1029](https://github.com/fzaninotto/Faker/pull/1029) ([piotrooo](https://github.com/piotrooo)) +- Fixed polish text - change '--' into '-'. [\#1027](https://github.com/fzaninotto/Faker/pull/1027) ([piotrooo](https://github.com/piotrooo)) +- Update Text.php [\#1025](https://github.com/fzaninotto/Faker/pull/1025) ([gulaandrij](https://github.com/gulaandrij)) +- Adding Nationalized Citizens to DNI in Person.php [\#1021](https://github.com/fzaninotto/Faker/pull/1021) ([celisflen-bers](https://github.com/celisflen-bers)) +- Add nik to indonesia [\#1019](https://github.com/fzaninotto/Faker/pull/1019) ([Nuffic](https://github.com/Nuffic)) +- fix mb\_substr missing parameter error when generating japanese string with realText method [\#1018](https://github.com/fzaninotto/Faker/pull/1018) ([horan-geeker](https://github.com/horan-geeker)) +- IBAN Formatters for New Locales [\#1015](https://github.com/fzaninotto/Faker/pull/1015) ([okj579](https://github.com/okj579)) +- German Bank Names [\#1014](https://github.com/fzaninotto/Faker/pull/1014) ([okj579](https://github.com/okj579)) +- Adding countries for pl\_PL provider [\#1009](https://github.com/fzaninotto/Faker/pull/1009) ([mertcanesen](https://github.com/mertcanesen)) +- Adding Pattern Lab plugin to list of 3rd party libraries [\#1008](https://github.com/fzaninotto/Faker/pull/1008) ([EvanLovely](https://github.com/EvanLovely)) +- Korea top 100 lastName [\#1006](https://github.com/fzaninotto/Faker/pull/1006) ([tael](https://github.com/tael)) +- Use real Belgian postcodes instead of random number [\#1004](https://github.com/fzaninotto/Faker/pull/1004) ([toonevdb](https://github.com/toonevdb)) +- Add bankAccountNumber implementations [\#1000](https://github.com/fzaninotto/Faker/pull/1000) ([akramfares](https://github.com/akramfares)) +- Generates a random NIR number \(fr\_FR\) [\#997](https://github.com/fzaninotto/Faker/pull/997) ([Ultim4T0m](https://github.com/Ultim4T0m)) +- \#989 Fix country typo [\#996](https://github.com/fzaninotto/Faker/pull/996) ([adriantombu](https://github.com/adriantombu)) +- adding back CNP [\#988](https://github.com/fzaninotto/Faker/pull/988) ([the-noob](https://github.com/the-noob)) +- Fix phpunit tests fail on 64-bit systems \#982 [\#983](https://github.com/fzaninotto/Faker/pull/983) ([Powerhead13](https://github.com/Powerhead13)) +- Remove trailing dot in username if any [\#975](https://github.com/fzaninotto/Faker/pull/975) ([vlakoff](https://github.com/vlakoff)) +- HTML Lorem [\#971](https://github.com/fzaninotto/Faker/pull/971) ([rudkjobing](https://github.com/rudkjobing)) +- Fix a mixup between male and female last names in Icelandic. [\#970](https://github.com/fzaninotto/Faker/pull/970) ([arthur-olafsson](https://github.com/arthur-olafsson)) +- Remove duplicate [\#969](https://github.com/fzaninotto/Faker/pull/969) ([mijgame](https://github.com/mijgame)) +- fix \[zh\_CN\]PhoneNumber illegal operator prefix [\#966](https://github.com/fzaninotto/Faker/pull/966) ([zhwei](https://github.com/zhwei)) +- es\_ES: Generate VAT Number [\#964](https://github.com/fzaninotto/Faker/pull/964) ([miguelgf](https://github.com/miguelgf)) +- Update Image.php [\#963](https://github.com/fzaninotto/Faker/pull/963) ([gulaandrij](https://github.com/gulaandrij)) +- Remove cnp formatter from RO\_ro locale \(fails tests\) [\#962](https://github.com/fzaninotto/Faker/pull/962) ([fzaninotto](https://github.com/fzaninotto)) +- Adding valid en\_GB postcodes [\#961](https://github.com/fzaninotto/Faker/pull/961) ([the-noob](https://github.com/the-noob)) +- Adding Text for ro\_RO [\#959](https://github.com/fzaninotto/Faker/pull/959) ([the-noob](https://github.com/the-noob)) +- Minor: Fixed trailing space in DateTime provider [\#956](https://github.com/fzaninotto/Faker/pull/956) ([tifabien](https://github.com/tifabien)) +- Remove 'Stripper' from en\_US job titles [\#954](https://github.com/fzaninotto/Faker/pull/954) ([amcsi](https://github.com/amcsi)) +- fix 32bits issue [\#953](https://github.com/fzaninotto/Faker/pull/953) ([remicollet](https://github.com/remicollet)) +- Fix EAN8 checkSum generator [\#951](https://github.com/fzaninotto/Faker/pull/951) ([MatthieuMota](https://github.com/MatthieuMota)) +- Fixed description and the use of early undocumented parameters. [\#949](https://github.com/fzaninotto/Faker/pull/949) ([andrey-helldar](https://github.com/andrey-helldar)) +- Pushing new mobile prefixes in philippines [\#944](https://github.com/fzaninotto/Faker/pull/944) ([napoleon101392](https://github.com/napoleon101392)) +- Update Company.php [\#943](https://github.com/fzaninotto/Faker/pull/943) ([thiagotalma](https://github.com/thiagotalma)) +- Fix to Issue \#935 - German Locale [\#936](https://github.com/fzaninotto/Faker/pull/936) ([Newman101](https://github.com/Newman101)) +- el\_CY Locale [\#930](https://github.com/fzaninotto/Faker/pull/930) ([softius](https://github.com/softius)) +- Add phpdoc method dateTimeInInterval in Generator.php [\#926](https://github.com/fzaninotto/Faker/pull/926) ([KeithYeh](https://github.com/KeithYeh)) +- Harmonize fr\_\*\Company [\#918](https://github.com/fzaninotto/Faker/pull/918) ([Max13](https://github.com/Max13)) +- Fix: fix invalid parameter of mb\_substr\(\) [\#917](https://github.com/fzaninotto/Faker/pull/917) ([tkawaji](https://github.com/tkawaji)) +- kk\_KZ Company/person identification numbers unit tests [\#916](https://github.com/fzaninotto/Faker/pull/916) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +- ka\_GE: overall improvements to ka\_GE locale [\#913](https://github.com/fzaninotto/Faker/pull/913) ([hertzg](https://github.com/hertzg)) +- Fix: Do not pick a random float less than minimum [\#909](https://github.com/fzaninotto/Faker/pull/909) ([localheinz](https://github.com/localheinz)) +- Fix: Prefer dependencies installed from dist [\#908](https://github.com/fzaninotto/Faker/pull/908) ([localheinz](https://github.com/localheinz)) +- Add a building number with letter to German speaking locales. [\#903](https://github.com/fzaninotto/Faker/pull/903) ([markuspoerschke](https://github.com/markuspoerschke)) +- \[RFR\] Remove parts of the hu\_HU address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto)) +- use Luhn to calculate ar\_SA id numbers. [\#875](https://github.com/fzaninotto/Faker/pull/875) ([FooBarQuaxx](https://github.com/FooBarQuaxx)) +- Fix Doctrine ODM Support [\#489](https://github.com/fzaninotto/Faker/pull/489) ([cbourgois](https://github.com/cbourgois)) + + +2016-04-29, v1.6.0 +------------------ + +- Remove parts of the Hungarian (hu\_HU) address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto)) +- Renamed norwegian (nb\_NO) locale [\#901](https://github.com/fzaninotto/Faker/pull/901) ([fzaninotto](https://github.com/fzaninotto)) +- Improveed German (de\_DE) titles [\#897](https://github.com/fzaninotto/Faker/pull/897) ([christianbartels](https://github.com/christianbartels)) +- Added VAT formatter to nl\_BE and fr\_BE providers [\#896](https://github.com/fzaninotto/Faker/pull/896) ([anvanza](https://github.com/anvanza)) +- Fixed provider namespace for Lithuanian (lt\_LT) [\#894](https://github.com/fzaninotto/Faker/pull/894) ([sanis](https://github.com/sanis)) +- Removed unnecessary (and incompatible) license from Russian and Ukrainian (uk\_UA & ru\_RU) Text providers [\#892](https://github.com/fzaninotto/Faker/pull/892) ([Newman101](https://github.com/Newman101)) +- Improved `languageCode` formatted to include all ISO-639-1 standard codes [\#889](https://github.com/fzaninotto/Faker/pull/889) ([andrewnicols](https://github.com/andrewnicols)) +- Improved Hungarian provider [\#883](https://github.com/fzaninotto/Faker/pull/883) ([balping](https://github.com/balping)) +- Fixed typo in Austrian Person provider [\#880](https://github.com/fzaninotto/Faker/pull/880) ([xelan](https://github.com/xelan)) +- Added Chines (zh\_CN) `catchPhrase` formatter [\#878](https://github.com/fzaninotto/Faker/pull/878) ([z-song](https://github.com/z-song)) +- Added mention of Brazilian (pt\_BR) providers in readme [\#877](https://github.com/fzaninotto/Faker/pull/877) ([iget-master](https://github.com/iget-master)) +- Updated composer `require` section to allow PHP 7 in safer way [\#874](https://github.com/fzaninotto/Faker/pull/874) ([TomasVotruba](https://github.com/TomasVotruba)) +- Added Greek (el\_GR) `mobilePhoneNumber` and `tollFreeNumber` formatters [\#869](https://github.com/fzaninotto/Faker/pull/869) ([sebdesign](https://github.com/sebdesign)) +- Added Lorempixel check for `ImageTest.php` to avoid test fails when the service is offline [\#866](https://github.com/fzaninotto/Faker/pull/866) ([Newman101](https://github.com/Newman101)) +- Added Chinese (zh\_CN) Providers [\#864](https://github.com/fzaninotto/Faker/pull/864) ([z-song](https://github.com/z-song)) +- Added unit tests for Canadian (en\_CA) provider [\#862](https://github.com/fzaninotto/Faker/pull/862) ([Newman101](https://github.com/Newman101)) +- Added Dutch BTW \(vat\) Number [\#861](https://github.com/fzaninotto/Faker/pull/861) ([LauLaman](https://github.com/LauLaman)) +- Improved Australian (en\_AU) provider [\#858](https://github.com/fzaninotto/Faker/pull/858) ([Newman101](https://github.com/Newman101)) +- Added Propel2 ORM support [\#852](https://github.com/fzaninotto/Faker/pull/852) ([iTechDhaval](https://github.com/iTechDhaval)) +- Added en\_IN unit test for `Address.php` [\#849](https://github.com/fzaninotto/Faker/pull/849) ([Newman101](https://github.com/Newman101)) +- Updated docs to clarify that `randomElements` does not repeat input elements [\#848](https://github.com/fzaninotto/Faker/pull/848) ([sustmi](https://github.com/sustmi)) +- Optimized Taiwanese (zh\_TW) `realText` provider [\#844](https://github.com/fzaninotto/Faker/pull/844) ([Newman101](https://github.com/Newman101)) +- Added more Iranian (fa\_IR) TLDs [\#843](https://github.com/fzaninotto/Faker/pull/843) ([VagrantStory](https://github.com/VagrantStory)) +- Added Hebrew (he\_IL) `country` formatter [\#841](https://github.com/fzaninotto/Faker/pull/841) ([yonirom](https://github.com/yonirom)) +- Documented `boolean` formatter [\#840](https://github.com/fzaninotto/Faker/pull/840) ([danieliancu](https://github.com/danieliancu)) +- Fixed modifiers anchor readme [\#838](https://github.com/fzaninotto/Faker/pull/838) ([danieliancu](https://github.com/danieliancu)) +- Added Dutch (nl\_NL) real text provider [\#837](https://github.com/fzaninotto/Faker/pull/837) ([endroid](https://github.com/endroid)) +- Added `valid` modifier [\#836](https://github.com/fzaninotto/Faker/pull/836) ([fzaninotto](https://github.com/fzaninotto)) +- Added Iranian (fa\_IR) `PhoneNumber` provider [\#833](https://github.com/fzaninotto/Faker/pull/833) ([ghost](https://github.com/ghost)) +- Add Brazilian (pt\_BR) `region` and `regionAbbr` formatters [\#828](https://github.com/fzaninotto/Faker/pull/828) ([francinaldo](https://github.com/francinaldo)) +- Improved Austrian (de\_AT) names, states, and realtext [\#826](https://github.com/fzaninotto/Faker/pull/826) ([Findus23](https://github.com/Findus23)) +- Improved German (de\_DE) names [\#825](https://github.com/fzaninotto/Faker/pull/825) ([Findus23](https://github.com/Findus23)) +- Improved Latvian (lv\_LV) first names [\#823](https://github.com/fzaninotto/Faker/pull/823) ([veisis](https://github.com/veisis)) +- Improved Latvian (lv\_LV) `phoneNumber` formatter [\#822](https://github.com/fzaninotto/Faker/pull/822) ([veisis](https://github.com/veisis)) +- Updated phpDoc link to IBAN format reference in `Payment` provider [\#821](https://github.com/fzaninotto/Faker/pull/821) ([god107](https://github.com/god107)) +- Updated Sport ORM populator to populate values for numeric fields [\#820](https://github.com/fzaninotto/Faker/pull/820) ([urisavka](https://github.com/urisavka)) +- Updated Chinese (zh\_CN) operators' phone number prefix. [\#819](https://github.com/fzaninotto/Faker/pull/819) ([vistart](https://github.com/vistart)) +- Optimized Spot ORM `EntityPopulator` [\#817](https://github.com/fzaninotto/Faker/pull/817) ([Newman101](https://github.com/Newman101)) +- Added Korean (ko\_KR) `realText` formatter [\#815](https://github.com/fzaninotto/Faker/pull/815) ([jdssem](https://github.com/jdssem)) +- Updated `imageUrl` formatter phpDoc [\#814](https://github.com/fzaninotto/Faker/pull/814) ([jonwurtzler](https://github.com/jonwurtzler)) +- Optimized Taiwanese (zh\_TW) text provider [\#809](https://github.com/fzaninotto/Faker/pull/809) ([BePsvPT](https://github.com/BePsvPT)) +- Added strict comparison to Czech (cs\_CS) `birthNumber` formatter [\#807](https://github.com/fzaninotto/Faker/pull/807) ([Newman101](https://github.com/Newman101)) +- Added Greek (el\_GR) `realText` formatter [\#805](https://github.com/fzaninotto/Faker/pull/805) ([hootlex](https://github.com/hootlex)) +- Added Simplified Chinese \(zh\_CN\) `state` and `stateAbbr` formatters [\#804](https://github.com/fzaninotto/Faker/pull/804) ([zhanghuanchong](https://github.com/zhanghuanchong)) +- Update `Image` provider to allow generation of grayscale images [\#801](https://github.com/fzaninotto/Faker/pull/801) ([neutralrockets](https://github.com/neutralrockets)) +- Fixed Taiwanese (zh_TW) incorrect `mb_substr()` arguments [\#799](https://github.com/fzaninotto/Faker/pull/799) ([BePsvPT](https://github.com/BePsvPT)) +- Added Spot ORM populator [\#796](https://github.com/fzaninotto/Faker/pull/796) ([urisavka](https://github.com/urisavka)) +- Added Italian (it\_IT) `vatId` and `taxId` formatters [\#790](https://github.com/fzaninotto/Faker/pull/790) ([brainrepo](https://github.com/brainrepo)) +- Added some fixes to Armenian (hy\_AM) locale [\#788](https://github.com/fzaninotto/Faker/pull/788) ([mhamlet](https://github.com/mhamlet)) +- Removed duplicate entries in `toAscii()` transliteration table, used in `Internet` provider [\#787](https://github.com/fzaninotto/Faker/pull/787) ([vlakoff](https://github.com/vlakoff)) +- Added Indian (en\_IN) providers [\#785](https://github.com/fzaninotto/Faker/pull/785) ([kartiksomani](https://github.com/kartiksomani)) +- Removed duplicate country names in various locales, removed non-random country arrays [\#784](https://github.com/fzaninotto/Faker/pull/784) ([fzaninotto](https://github.com/fzaninotto)) +- Improved Swiss (de\_CH) phone numbers [\#782](https://github.com/fzaninotto/Faker/pull/782) ([z38](https://github.com/z38)) +- Added Swiss (de\_CH) names [\#781](https://github.com/fzaninotto/Faker/pull/781) ([z38](https://github.com/z38)) +- Make capitalization of first word optional in Text Provider [\#778](https://github.com/fzaninotto/Faker/pull/778) ([LagunaJavier](https://github.com/LagunaJavier)) +- Added Georgian (ka\_GE) providers [\#777](https://github.com/fzaninotto/Faker/pull/777) ([akalongman](https://github.com/akalongman)) +- Fix CakePHP populator [\#776](https://github.com/fzaninotto/Faker/pull/776) ([daniel-mueller](https://github.com/daniel-mueller)) +- Added unit tests for `Address` provider in many locales [\#775](https://github.com/fzaninotto/Faker/pull/775) [\#773](https://github.com/fzaninotto/Faker/pull/773) [\#772](https://github.com/fzaninotto/Faker/pull/772) [\#767](https://github.com/fzaninotto/Faker/pull/767) [\#765](https://github.com/fzaninotto/Faker/pull/765) [\#764](https://github.com/fzaninotto/Faker/pull/764) [\#758](https://github.com/fzaninotto/Faker/pull/758) [\#756](https://github.com/fzaninotto/Faker/pull/756) [\#747](https://github.com/fzaninotto/Faker/pull/747) [\#741](https://github.com/fzaninotto/Faker/pull/741) ([Newman101](https://github.com/Newman101)) +- Added `dbi` formatter to Spanish (es\_ES) Person provider [\#763](https://github.com/fzaninotto/Faker/pull/763) ([mikk150](https://github.com/mikk150)) +- Added South Africa (en\_ZA) locale [\#761](https://github.com/fzaninotto/Faker/pull/761) ([smithandre](https://github.com/smithandre)) [\#760](https://github.com/fzaninotto/Faker/pull/760) ([smithandre](https://github.com/smithandre)) [\#759](https://github.com/fzaninotto/Faker/pull/759) ([smithandre](https://github.com/smithandre)) +- Added E.164 phone number generator [\#753](https://github.com/fzaninotto/Faker/pull/753) ([daleattree](https://github.com/daleattree)) +- Fixed serialization issue in `unique` modifier [\#749](https://github.com/fzaninotto/Faker/pull/749) ([EmanueleMinotto](https://github.com/EmanueleMinotto)) +- Added Switzerland (de\_CH, fr\_CH, it\_CH) providers [\#739](https://github.com/fzaninotto/Faker/pull/739) ([r3h6](https://github.com/r3h6)) +- Added PHPDocs, removed unused variable [\#738](https://github.com/fzaninotto/Faker/pull/738) ([daniel-mueller](https://github.com/daniel-mueller)) +- Fixed building numbers to have non-zero first bumber [\#737](https://github.com/fzaninotto/Faker/pull/737) ([jmauerhan](https://github.com/jmauerhan)) +- Updated ninth digit for Brazilian cell phone numbers [\#734](https://github.com/fzaninotto/Faker/pull/734) ([igorsantos07](https://github.com/igorsantos07)) +- Simplified Factory code [\#732](https://github.com/fzaninotto/Faker/pull/732) ([vlakoff](https://github.com/vlakoff)) +- Added mention of [images-generator](https://github.com/bruceheller/images-generator) in readme [\#731](https://github.com/fzaninotto/Faker/pull/731) ([bruceheller](https://github.com/bruceheller)) +- Optimize Internet::toAscii\(\) by using a static cache and translitteration [\#730](https://github.com/fzaninotto/Faker/pull/730) [\#729](https://github.com/fzaninotto/Faker/pull/729) +[\#725](https://github.com/fzaninotto/Faker/pull/725) [\#724](https://github.com/fzaninotto/Faker/pull/724) ([vlakoff](https://github.com/vlakoff)) +- Added more English (en\_GB) Phone Number formats [\#721](https://github.com/fzaninotto/Faker/pull/721) ([nickwebcouk](https://github.com/nickwebcouk)) +- Cleaned up `use` statements across the code [\#719](https://github.com/fzaninotto/Faker/pull/719) ([pomaxa](https://github.com/pomaxa)) +- Fixed CackePHP populator [\#718](https://github.com/fzaninotto/Faker/pull/718) ([sdustinh](https://github.com/sdustinh)) +- Cleaned up various phpmd notices [\#715](https://github.com/fzaninotto/Faker/pull/715) ([pomaxa](https://github.com/pomaxa)) +- Added `Color` provider to Latvian (lv_LV) locale [\#714](https://github.com/fzaninotto/Faker/pull/714) ([pomaxa](https://github.com/pomaxa)) +- Fixed bad randomization in Doctrine populator [\#713](https://github.com/fzaninotto/Faker/pull/713) ([pomaxa](https://github.com/pomaxa)) +- Added Mongolian (mn\_MN) providers [\#709](https://github.com/fzaninotto/Faker/pull/709) ([selmonal](https://github.com/selmonal)) +- Improved Australian (en\_AU) `postcode` formatter [\#703](https://github.com/fzaninotto/Faker/pull/703) ([xfxf](https://github.com/xfxf)) +- Added support for asterisks in `bothify` and `optimize` [\#701](https://github.com/fzaninotto/Faker/pull/701) ([nineinchnick](https://github.com/nineinchnick)) +- Fixed important distinction between ORM and database framework in README’s reference to an external Faker provider for POMM that I have never even tested. Anyway, POMM is highly recommended if you are a Postgres fan, or if you want to please Grégoire and help him finish his lifelong project of listening to music on a hi-fi audio equipment he built from his own hands [\#696](https://github.com/fzaninotto/Faker/pull/696) ([chanmix51](https://github.com/chanmix51)) +- Fixed example `text()` output in README [\#694](https://github.com/fzaninotto/Faker/pull/694) ([vlakoff](https://github.com/vlakoff)) +- Added mention of CakePHP 2.x Seeder Plugin to readme [\#691](https://github.com/fzaninotto/Faker/pull/691) ([ravage84](https://github.com/ravage84)) +- Fixed invalid email bug for Korean (ko\_KR) [\#690](https://github.com/fzaninotto/Faker/pull/690) ([pearlc](https://github.com/pearlc)) +- Removed an invalid Dutch (nl\_NL) lastname that breaks email generator [\#689](https://github.com/fzaninotto/Faker/pull/689) ([SpaceK33z](https://github.com/SpaceK33z)) +- Updated `numberBetween()` to be order agnostic [\#683](https://github.com/fzaninotto/Faker/pull/683) ([xfxf](https://github.com/xfxf)) +- Added several English (en\_US) bank-related formatters [\#682](https://github.com/fzaninotto/Faker/pull/682) ([okj579](https://github.com/okj579)) +- Fixed `ipv4` formatter to avoid generating special purpose addresses [\#681](https://github.com/fzaninotto/Faker/pull/681) ([ravage84](https://github.com/ravage84)) +- Moved `intl` extension to `require-dev` in `composer.json` file [\#680](https://github.com/fzaninotto/Faker/pull/680) ([jaschweder](https://github.com/jaschweder)) +- Added more Turkish (tr\_TR) phones number formats [\#678](https://github.com/fzaninotto/Faker/pull/678) ([Quanthir](https://github.com/Quanthir)) +- Fixed primary Key warning in CakePHP ORM populator [\#677](https://github.com/fzaninotto/Faker/pull/677) ([davidyell](https://github.com/davidyell)) +- Added time zone support for provider methods returning DateTime instance [\#675](https://github.com/fzaninotto/Faker/pull/675) ([bishopb](https://github.com/bishopb)) +- Removed trailing spaces from some Argentinian (es\_AR) female first names [\#674](https://github.com/fzaninotto/Faker/pull/674) ([ivanmirson](https://github.com/ivanmirson)) +- Added Lithuanian (lt\_LT) locale [\#673](https://github.com/fzaninotto/Faker/pull/673) ([ekateiva](https://github.com/ekateiva)) +- Added mention of Alice to readme [\#665](https://github.com/fzaninotto/Faker/pull/665) ([Seldaek](https://github.com/Seldaek)) +- Fixed namespace in tests [\#663](https://github.com/fzaninotto/Faker/pull/663) ([localheinz](https://github.com/localheinz)) +- Fixed trailing spaces in `Color` provider [\#662](https://github.com/fzaninotto/Faker/pull/662) ([apsylone](https://github.com/apsylone)) +- Removed duplicate country names in Russian (ru\_RU) `Address` provider [\#659](https://github.com/fzaninotto/Faker/pull/659) ([nurolopher](https://github.com/nurolopher)) +- Added `rgba` formatter to `Color` provider [\#653](https://github.com/fzaninotto/Faker/pull/653) ([apsylone](https://github.com/apsylone)) +- Fixed bad randomization in CakePHP populator [\#648](https://github.com/fzaninotto/Faker/pull/648) ([jadb](https://github.com/jadb)) +- Updated phpunit configuration to better use colors [\#643](https://github.com/fzaninotto/Faker/pull/643) ([localheinz](https://github.com/localheinz)) +- Updated `makefile` to install dev dependencies by default [\#642](https://github.com/fzaninotto/Faker/pull/642) ([localheinz](https://github.com/localheinz)) +- Updated Travis configuration to cache dependencies between builds [\#641](https://github.com/fzaninotto/Faker/pull/641) ([localheinz](https://github.com/localheinz)) +- Added SVG badge to readme for displaying Travis build status [\#640](https://github.com/fzaninotto/Faker/pull/640) ([localheinz](https://github.com/localheinz)) +- Added Croatian (hr\_HR) locale [\#638](https://github.com/fzaninotto/Faker/pull/638) ([toniperic](https://github.com/toniperic)) +- Updated `dateTimeBetween` PHPDoc [\#635](https://github.com/fzaninotto/Faker/pull/635) ([theofidry](https://github.com/theofidry)) +- Add mention of Symfony2 bundles in readme [\#634](https://github.com/fzaninotto/Faker/pull/634) ([theofidry](https://github.com/theofidry)) +- Added Hebrew (he\_IL) locale [\#633](https://github.com/fzaninotto/Faker/pull/633) ([yonirom](https://github.com/yonirom)) +- Updated `seed` to accept non-integer seeds [\#632](https://github.com/fzaninotto/Faker/pull/632) ([theofidry](https://github.com/theofidry)) +- Added DocBlock to `Factory::create()` [\#631](https://github.com/fzaninotto/Faker/pull/631) ([tonynelson19](https://github.com/tonynelson19)) +- Added `jobTitle` generator [\#630](https://github.com/fzaninotto/Faker/pull/630) ([gregoryduckworth](https://github.com/gregoryduckworth)) +- Updated Chinese (zh\_CN) `Person` provider to generate more correct names [\#628](https://github.com/fzaninotto/Faker/pull/628) ([phoenixgao](https://github.com/phoenixgao)) +- Updated Brazilian (pt\_BR) `cellphone` formatter to make it more flexible [\#623](https://github.com/fzaninotto/Faker/pull/623) ([igorsantos07](https://github.com/igorsantos07)) +- Add Arabic for Saudi Arabia (ar\_SA) locale [\#618](https://github.com/fzaninotto/Faker/pull/618) ([ibrasho](https://github.com/ibrasho)) +- Updated en\_US phone numbers [\#615](https://github.com/fzaninotto/Faker/pull/615) ([okj579](https://github.com/okj579)) +- Fixed typos in variable names and exceptions [\#614](https://github.com/fzaninotto/Faker/pull/614) ([pborreli](https://github.com/pborreli)) +- Added a table of contents to the readme file. [\#613](https://github.com/fzaninotto/Faker/pull/613) ([camilopayan](https://github.com/camilopayan)) +- Added Brazilian (es_BR) credit card formatters [\#608](https://github.com/fzaninotto/Faker/pull/608) ([igorsantos07](https://github.com/igorsantos07)) +- Updated `iban` formatter to be cross-locale [\#607](https://github.com/fzaninotto/Faker/pull/607) ([okj579](https://github.com/okj579)) +- Improved ORM name guesser logic [\#606](https://github.com/fzaninotto/Faker/pull/606) ([watermanio](https://github.com/watermanio)) +- Fixed doc typo [\#605](https://github.com/fzaninotto/Faker/pull/605) ([igorsantos07](https://github.com/igorsantos07)) +- Removed executable bits [\#593](https://github.com/fzaninotto/Faker/pull/593) ([siwinski](https://github.com/siwinski)) +- Fixed `iban` generator [\#590](https://github.com/fzaninotto/Faker/pull/590) ([okj579](https://github.com/okj579)) +- Added Philippines (en\_PH) `mobileNumber` formatter [\#589](https://github.com/fzaninotto/Faker/pull/589) ([lozadaOmr](https://github.com/lozadaOmr)) +- Added support for min / max params in `latitude` and `longitude` formatters [\#570](https://github.com/fzaninotto/Faker/pull/570) ([actuallymab](https://github.com/actuallymab)) +- Added Czech (cs_CZ) `birthNumber` formatter [\#535](https://github.com/fzaninotto/Faker/pull/535) ([tomasbedrich](https://github.com/tomasbedrich)) +- Added `dateTimeInInterval` formatter [\#526](https://github.com/fzaninotto/Faker/pull/526) ([nicodmf](https://github.com/nicodmf)) +- Updated `optional` and `boolean` apis to be more consistent [\#513](https://github.com/fzaninotto/Faker/pull/513) ([EmanueleMinotto](https://github.com/EmanueleMinotto)) +- Added Greek (el\_GR) `Address` provider [\#504](https://github.com/fzaninotto/Faker/pull/504) ([drakakisgeo](https://github.com/drakakisgeo)) + +2015-05-29, v1.5.0 +------------------ + +* Added ability to print custom text on the images fetched by the Image provider [\#583](https://github.com/fzaninotto/Faker/pull/583) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed typos in Peruvian (es\_PE) Person provider [\#581](https://github.com/fzaninotto/Faker/pull/581) [\#580](https://github.com/fzaninotto/Faker/pull/580) ([ysramirez](https://github.com/ysramirez)) +* Added instructions for installing with composer to readme.md [\#572](https://github.com/fzaninotto/Faker/pull/572) ([totophe](https://github.com/totophe)) +* Added Kazakh (kk\_KZ) locale [\#569](https://github.com/fzaninotto/Faker/pull/569) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +* Added Korean (ko\_KR) locale [\#566](https://github.com/fzaninotto/Faker/pull/566) ([pearlc](https://github.com/pearlc)) +* Fixed file provider to ignore unreadable and special files [\#565](https://github.com/fzaninotto/Faker/pull/565) ([svrnm](https://github.com/svrnm)) +* Fixed Dutch (nl\_NL) Address and Person providers [\#560](https://github.com/fzaninotto/Faker/pull/560) ([killerog](https://github.com/killerog)) +* Fixed Dutch (nl\_NL) Person provider [\#559](https://github.com/fzaninotto/Faker/pull/559) ([pauledenburg](https://github.com/pauledenburg)) +* Added Russian (ru\_RU) Bank names provider [\#553](https://github.com/fzaninotto/Faker/pull/553) ([wizardjedi](https://github.com/wizardjedi)) +* Added mobile phone function in French (fr\_FR) provider [\#552](https://github.com/fzaninotto/Faker/pull/552) ([kletellier](https://github.com/kletellier)) +* Added phpdoc for new magic methods in Generator to help IntelliSense completion [\#550](https://github.com/fzaninotto/Faker/pull/550) ([stof](https://github.com/stof)) +* Fixed File provider bug 'The first argument to copy() function cannot be a directory' [\#547](https://github.com/fzaninotto/Faker/pull/547) ([svrnm](https://github.com/svrnm)) +* Added new Brazilian (pt\_BR) Providers [\#545](https://github.com/fzaninotto/Faker/pull/545) ([igorsantos07](https://github.com/igorsantos07)) +* Fixed ability to seed the generator [\#543](https://github.com/fzaninotto/Faker/pull/543) ([schmengler](https://github.com/schmengler)) +* Added streetAddress formatter to Russian (ru\_RU) provider [\#542](https://github.com/fzaninotto/Faker/pull/542) ([ZAYEC77](https://github.com/ZAYEC77)) +* Fixed Internet provider warning "Could not create transliterator"* [\#541](https://github.com/fzaninotto/Faker/pull/541) ([fonsecas72](https://github.com/fonsecas72)) +* Fixed Spanish for Argentina (es\_AR) Address provider [\#540](https://github.com/fzaninotto/Faker/pull/540) ([ivanmirson](https://github.com/ivanmirson)) +* Fixed region names in French for Belgium (fr\_BE) address provider [\#536](https://github.com/fzaninotto/Faker/pull/536) ([miclf](https://github.com/miclf)) +* Fixed broken Doctrine2 link in README [\#534](https://github.com/fzaninotto/Faker/pull/534) ([JonathanKryza](https://github.com/JonathanKryza)) +* Added link to faker-context Behat extension in readme [\#532](https://github.com/fzaninotto/Faker/pull/532) ([denheck](https://github.com/denheck)) +* Added PHP 7.0 nightly to Travis build targets [\#525](https://github.com/fzaninotto/Faker/pull/525) ([TomasVotruba](https://github.com/TomasVotruba)) +* Added Dutch (nl\_NL) color names [\#523](https://github.com/fzaninotto/Faker/pull/523) ([belendel](https://github.com/belendel)) +* Fixed Chinese (zh\_CN) Address provider (remove Taipei) [\#522](https://github.com/fzaninotto/Faker/pull/522) ([asika32764](https://github.com/asika32764)) +* Fixed phonenumber formats in Dutch (nl\_NL) PhoneNumber provider [\#521](https://github.com/fzaninotto/Faker/pull/521) ([SpaceK33z](https://github.com/SpaceK33z)) +* Fixed Russian (ru\_RU) Address provider [\#518](https://github.com/fzaninotto/Faker/pull/518) ([glagola](https://github.com/glagola)) +* Added Italian (it\_IT) Text provider [\#517](https://github.com/fzaninotto/Faker/pull/517) ([endelwar](https://github.com/endelwar)) +* Added Norwegian (no\_NO) locale [\#515](https://github.com/fzaninotto/Faker/pull/515) ([phaza](https://github.com/phaza)) +* Added VAT number to Bulgarian (bg\_BG) Payment provider [\#512](https://github.com/fzaninotto/Faker/pull/512) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed UserAgent provider outdated user agents [\#511](https://github.com/fzaninotto/Faker/pull/511) ([ajbdev](https://github.com/ajbdev)) +* Fixed `image()` formatter to make it work with temp dir of any (decent) OS [\#507](https://github.com/fzaninotto/Faker/pull/507) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added Persian (fa\_IR) locale [\#500](https://github.com/fzaninotto/Faker/pull/500) ([zoli](https://github.com/zoli)) +* Added Currency Code formatter [\#497](https://github.com/fzaninotto/Faker/pull/497) ([stelgenhof](https://github.com/stelgenhof)) +* Added VAT number to Belgium (be_BE) Payment provider [\#495](https://github.com/fzaninotto/Faker/pull/495) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed `imageUrl` formatter bug where it would always return the same image [\#494](https://github.com/fzaninotto/Faker/pull/494) ([fzaninotto](https://github.com/fzaninotto)) +* Added more Indonesian (id\_ID) providers [\#493](https://github.com/fzaninotto/Faker/pull/493) ([deerawan](https://github.com/deerawan)) +* Added Indonesian (id\_ID) locale [\#492](https://github.com/fzaninotto/Faker/pull/492) ([stoutZero](https://github.com/stoutZero)) +* Fixed unique generator performance [\#491](https://github.com/fzaninotto/Faker/pull/491) ([ikwattro](https://github.com/ikwattro)) +* Added transliterator to `email` and `username` [\#490](https://github.com/fzaninotto/Faker/pull/490) ([fzaninotto](https://github.com/fzaninotto)) +* Added Hungarian (hu\_HU) Text provider [\#486](https://github.com/fzaninotto/Faker/pull/486) ([lintaba](https://github.com/lintaba)) +* Fixed CakePHP Entity Popolator (some cases where no entities prev. inserted) [\#483](https://github.com/fzaninotto/Faker/pull/483) ([jadb](https://github.com/jadb)) +* Added Color and DateTime Turkish (tr\_TR) Providers [\#481](https://github.com/fzaninotto/Faker/pull/481) ([behramcelen](https://github.com/behramcelen)) +* Added Latvian (lv\_LV) `personalIdentityNumber` formatter [\#472](https://github.com/fzaninotto/Faker/pull/472) ([MatissJanis](https://github.com/MatissJanis)) +* Added VAT number to Austrian (at_AT) Payment provider [\#470](https://github.com/fzaninotto/Faker/pull/470) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed missing @return phpDoc in Payment provider [\#469](https://github.com/fzaninotto/Faker/pull/469) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added SWIFT/BIC payment type formatter to the Payment provider [\#465](https://github.com/fzaninotto/Faker/pull/465) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed small typo in Base provider exception [\#460](https://github.com/fzaninotto/Faker/pull/460) ([miclf](https://github.com/miclf)) +* Added Georgian (ka\_Ge) locale [\#457](https://github.com/fzaninotto/Faker/pull/457) ([lperto](https://github.com/lperto)) +* Added PSR-4 Autoloading [\#455](https://github.com/fzaninotto/Faker/pull/455) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Added Uganda (en_UG) locale [\#454](https://github.com/fzaninotto/Faker/pull/454) ([tharoldD](https://github.com/tharoldD)) +* Added `regexify` formatter, generating a random string based on a regular expression [\#453](https://github.com/fzaninotto/Faker/pull/453) ([fzaninotto](https://github.com/fzaninotto)) +* Added shuffle formatter, to shuffle an array or a string [\#452](https://github.com/fzaninotto/Faker/pull/452) ([fzaninotto](https://github.com/fzaninotto)) +* Added ISBN-10 & ISBN-13 codes formatters to Barcode provider [\#451](https://github.com/fzaninotto/Faker/pull/451) ([gietos](https://github.com/gietos)) +* Fixed Russian (ru\_RU) middle names (different for different genders) [\#450](https://github.com/fzaninotto/Faker/pull/450) ([gietos](https://github.com/gietos)) +* Fixed Ukranian (uk\_UA) Person provider [\#448](https://github.com/fzaninotto/Faker/pull/448) ([aivus](https://github.com/aivus)) +* Added Vietnamese (vi\_VN) locale [\#447](https://github.com/fzaninotto/Faker/pull/447) ([huy95](https://github.com/huy95)) +* Added type hint to the Documentor constructor [\#446](https://github.com/fzaninotto/Faker/pull/446) ([JeroenDeDauw](https://github.com/JeroenDeDauw)) +* Fixed Russian (ru\_RU) Person provider (joined names) [\#445](https://github.com/fzaninotto/Faker/pull/445) ([aivus](https://github.com/aivus)) +* Added English (en\_GB) `mobileNumber` methods [\#438](https://github.com/fzaninotto/Faker/pull/438) ([daveblake](https://github.com/daveblake)) +* Added Traditional Chinese (zh\_TW) Realtext provider [\#434](https://github.com/fzaninotto/Faker/pull/434) ([tzhuan](https://github.com/tzhuan)) +* Fixed first name in Spanish for Argentina (es\_AR) Person provider [\#433](https://github.com/fzaninotto/Faker/pull/433) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Canadian (en_CA) state abbreviation for Nunavut [\#430](https://github.com/fzaninotto/Faker/pull/430) ([julien-c](https://github.com/julien-c)) +* Added CakePHP ORM entity populator [\#428](https://github.com/fzaninotto/Faker/pull/428) ([jadb](https://github.com/jadb)) +* Added Traditional Chinese (zh\_TW) locale [\#427](https://github.com/fzaninotto/Faker/pull/427) ([tzhuan](https://github.com/tzhuan)) +* Fixed typo in Doctrine Populator phpDoc [\#425](https://github.com/fzaninotto/Faker/pull/425) ([ihsanudin](https://github.com/ihsanudin)) +* Added Chinese (zh_CN) Internet provider [\#424](https://github.com/fzaninotto/Faker/pull/424) ([Lisso-Me](https://github.com/Lisso-Me)) +* Added Country ISO 3166-1 alpha-3 code to the Miscellaneous provider[\#422](https://github.com/fzaninotto/Faker/pull/422) ([gido](https://github.com/gido)) +* Added English (en\_GB) Person provider [\#421](https://github.com/fzaninotto/Faker/pull/421) ([AlexCutts](https://github.com/AlexCutts)) +* Added missing tests for the Color Provider [\#420](https://github.com/fzaninotto/Faker/pull/420) ([bessl](https://github.com/bessl)) +* Added Nepali (ne\_NP) locale [\#419](https://github.com/fzaninotto/Faker/pull/419) ([ankitpokhrel](https://github.com/ankitpokhrel)) +* Fixed latitude and longitude formatters bug (numeric value out of range for 32bits) [\#416](https://github.com/fzaninotto/Faker/pull/416) ([fzaninotto](https://github.com/fzaninotto)) +* Added a dedicated calculator Luhn calculator service [\#414](https://github.com/fzaninotto/Faker/pull/414) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Russian (ru_RU) Person provider (removed lowercase duplications) [\#413](https://github.com/fzaninotto/Faker/pull/413) ([Ragazzo](https://github.com/Ragazzo)) +* Fixed barcode formatter (improved speed, added tests) [\#412](https://github.com/fzaninotto/Faker/pull/412) ([fzaninotto](https://github.com/fzaninotto)) +* Added ipv4 and barcode formatters tests [\#410](https://github.com/fzaninotto/Faker/pull/410) ([bessl](https://github.com/bessl)) +* Fixed typos in various comments blocks [\#409](https://github.com/fzaninotto/Faker/pull/409) ([bessl](https://github.com/bessl)) +* Fixed InternetTest (replaced regex with PHP filter) [\#406](https://github.com/fzaninotto/Faker/pull/406) ([bessl](https://github.com/bessl)) +* Added password formatter to the Internet provider[\#402](https://github.com/fzaninotto/Faker/pull/402) ([fzaninotto](https://github.com/fzaninotto)) +* Added Company and Internet Austrian (de\_AT) Providers [\#400](https://github.com/fzaninotto/Faker/pull/400) ([bessl](https://github.com/bessl)) +* Added third-party libraries section in README [\#399](https://github.com/fzaninotto/Faker/pull/399) ([fzaninotto](https://github.com/fzaninotto)) +* Added Spanish for Venezuela (es\_VE) locale [\#398](https://github.com/fzaninotto/Faker/pull/398) ([DIOHz0r](https://github.com/DIOHz0r)) +* Added PhoneNumber Autrian (de\_AT) Provider, and missing test for the 'locale' method. [\#395](https://github.com/fzaninotto/Faker/pull/395) ([bessl](https://github.com/bessl)) +* Removed wrongly localized Lorem provider [\#394](https://github.com/fzaninotto/Faker/pull/394) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Miscellaneous provider (made the `locale` formatter static) [\#390](https://github.com/fzaninotto/Faker/pull/390) ([bessl](https://github.com/bessl)) +* Added a unit test file for the Miscellaneous Provider [\#389](https://github.com/fzaninotto/Faker/pull/389) ([bessl](https://github.com/bessl)) +* Added warning in README about using `rand()`` and the seed functions [\#386](https://github.com/fzaninotto/Faker/pull/386) ([paulvalla](https://github.com/paulvalla)) +* Fixed French (fr\_FR) Person provider (Uppercased a first name) [\#385](https://github.com/fzaninotto/Faker/pull/385) ([netcarver](https://github.com/netcarver)) +* Added Russian (ru\_RU) and Ukrainian (uk\_UA) Text providers [\#383](https://github.com/fzaninotto/Faker/pull/383) ([terion-name](https://github.com/terion-name)) +* Added more street prefixes to French (fr\_FR) Address provider [\#381](https://github.com/fzaninotto/Faker/pull/381) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added PHP 5.6 to CI targets [\#378](https://github.com/fzaninotto/Faker/pull/378) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Fixed spaces remaining at the end of liine in various files [\#377](https://github.com/fzaninotto/Faker/pull/377) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Fixed UserAgent provider (added space before processor on linux platform) [\#374](https://github.com/fzaninotto/Faker/pull/374) ([TomK](https://github.com/TomK)) +* Added Company generator for Russian (ru\_RU) locale [\#371](https://github.com/fzaninotto/Faker/pull/371) ([kix](https://github.com/kix)) +* Fixed Russian (ru\_RU) Color provider (uppercase letters) [\#370](https://github.com/fzaninotto/Faker/pull/370) ([semanser](https://github.com/semanser)) +* Added more Polish (pl\_PL) phone numbers [\#369](https://github.com/fzaninotto/Faker/pull/369) ([piotrantosik](https://github.com/piotrantosik)) +* Fixed Ruby Faker link in readme [\#368](https://github.com/fzaninotto/Faker/pull/368) ([philsturgeon](https://github.com/philsturgeon)) +* Added more Japanese (ja\_JP) names in Person provider [\#366](https://github.com/fzaninotto/Faker/pull/366) ([kumamidori](https://github.com/kumamidori)) +* Added Slovenian (sl\_SL) locale [\#363](https://github.com/fzaninotto/Faker/pull/363) ([alesf](https://github.com/alesf)) +* Fixed German (de\_DE) Person provider (first names) [\#362](https://github.com/fzaninotto/Faker/pull/362) ([mikehaertl](https://github.com/mikehaertl)) +* Fixed Ukrainian (uk\_UA) Person providr (there is no such letter "ы" in Ukrainian) [\#359](https://github.com/fzaninotto/Faker/pull/359) ([nazar-pc](https://github.com/nazar-pc)) +* Fixed Chinese (zh\_CN) PhoneNumber provider (the length of mobile phone number is 11) [\#358](https://github.com/fzaninotto/Faker/pull/358) ([byan](https://github.com/byan)) +* Added Arabic (ar_\JO) Locale [\#357](https://github.com/fzaninotto/Faker/pull/357) ([zrashwani](https://github.com/zrashwani)) +* Fixed Czech (cs\_CZ) Person provider (missing lowercase in last name) [\#355](https://github.com/fzaninotto/Faker/pull/355) ([halaxa](https://github.com/halaxa)) +* Fixed French for Belgium (fr\_BE) Address Provider (doubled city names) [\#354](https://github.com/fzaninotto/Faker/pull/354) ([miclf](https://github.com/miclf)) +* Added Biased Integer Provider [\#332](https://github.com/fzaninotto/Faker/pull/332) ([TimWolla](https://github.com/TimWolla)) +* Added Swedish (sv\_SE) locale [\#316](https://github.com/fzaninotto/Faker/pull/316) ([ulrikjohansson](https://github.com/ulrikjohansson)) +* Added English for New Zealand (en\_NZ) locale [\#283](https://github.com/fzaninotto/Faker/pull/283) ([JasonMortonNZ](https://github.com/JasonMortonNZ)) +* Added mention of external Provider for cron expressions to readme[\#498](https://github.com/fzaninotto/Faker/pull/498) ([swekaj](https://github.com/swekaj)) + +2014-06-04, v1.4.0 +------------------ + +* Fixed typo in Slovak person names (cinan) +* Added tests for uk_UA providers (serge-kuharev) +* Fixed numerify() performance by making it 30% faster (fzaninotto) +* Added strict option to randomNumber to force number of digits (fzaninotto) +* Fixed randomNumber usage duplicating numberBetween (fzaninotto) +* Fixed address provider for latvian language (MatissJA) +* Added Czech Republic (cs_CZ) address, company, datetime and text providers (Mikulas) +* Fixed da_DK Person provider data containing an 'unnamed' person (tolnem) +* Added slug provider (fzaninotto) +* Fixed IDE insights for new local IP and MAC address providers (hugofonseca) +* Added firstname gender method to all Person providers (csanquer) +* Fixed tr_TR email service, city name, person, and phone number formats (ogunkarakus) +* Fixed US_en state list (fzaninotto) +* Fixed en_US address provider so state abbr are ISO 3166 codes (Garbee) +* Added local IP and MAC address providers (kielabokkie) +* Fixed typo in century list affecting the century provider (fzaninotto) +* Added default value to optional modifier (joshuajabbour) +* Fixed Portuguese phonenumbers have 9 digits (hugofonseca) +* Added fileCopy to File provider to simulate file upload (stefanosala) +* Added pt_PT providers (hugofonseca) +* Fixed dead code in text provider (hugofonseca) +* Fixed IDE insights for magic properties (hugofonseca) +* Added tin (NIF) generator for pt_PT provider (hugofonseca) +* Fixed numberBetween max default value handling (fzaninotto) +* Added pt_PT phone number provider (hugofonseca) +* Fixed PSR-2 standards and add make task to force it on Travis (terite) +* Added new ro_RO Personal Numerical Code (CNP) and phone number providers (avataru) +* Fixed Internet provider for sk_SK locale (cinan) +* Fixed typo in en_ZA Internet provider (bjorntheart) +* Fixed phpdoc for DateTime magic methods (stof) +* Added doc about seeding with maximum timestamp using dateTime formatters (fzaninotto) +* Added Maximum Timestamp option to get always same unix timestamp when using a fixed seed (csanquer) +* Added Montenegrian (me_ME) providers (ognjenm) +* Added ean barcode provider (nineinchnick) +* Added fullPath parameter to Image provider (stefanosala) +* Added more Polish company formats (nineinchnick) +* Added Polish realText provider (nineinchnick) +* Fixed remaining non-seedable random generators (terite) +* Added randomElements provider (terite) +* Added French realText provider (fzaninotto) +* Fixed realText provider bootstrap slowness (fzaninotto) +* Added realText provider for English and German, based on Markov Chains Generator (TimWolla) +* Fixed address format in nl_NL provider (doenietzomoeilijk) +* Fixed potentially offensive word from last name list (joshuajabbour) +* Fixed reamde documentation about the optional modifier (cryode) +* Fixed Image provider and documentor routine (fzaninotto) +* Fixed IDE insights for methods (PedroTroller) +* Fixed missing data in en_US Address provider (Garbee) +* Added Bengali (bn_BD) providers (masnun) +* Fixed warning on test file when short tags are on (bateller) +* Fixed Doctrine populator undefined index warning (dbojdo) +* Added French Canadian (fr_CA) Address and Person providers (marcaube) +* Fixed typo in NullGenerator (mhanson01) +* Fixed Doctrine populator issue with one-to-one nullable relationship (jpetitcolas) +* Added Canadian English (en_CA) address and phone number providers (cviebrock) +* Fixed duplicated Payment example in readme (Garbee) +* Fixed Polish (pl_PL) Person provider data (czogori) +* Added Hungarian (hu_HU) providers (sagikazarmark) +* Added 'kana' (ja_JP) name formatters (kzykhys) +* Added allow_failure for hhvm to travis-ci and test against php 5.5 (toin0u) + +2013-12-16, v1.3.0 +------------------ + +* Fixed state generator in Australian (en_AU) provider (sebklaus) +* Fixed IDE insights for locale specific providers (ulrikjohansson) +* Added English (South Africa) (en_ZA) person, address, Internet and phone number providers (dmfaux) +* Fixed integer values overflowing on signed INTEGER columns on Doctrine populator (Thinkscape) +* Fixed spelling error in French (fr_FR) address provider (leihog) +* Added improvements based on SensioLabsInsights analysis +* Fixed Italian (it_IT) email provider (garak) +* Added Spanish (es_ES) Internet provider (eusonlito) +* Added English Philippines (en_PH) address provider (kamote) +* Added Brazilian (pt_BR) email provider data (KennedyTedesco) +* Fixed UK country code (pgscandeias) +* Added Peruvian (es_PE) person, address, phone number, and company providers (cslucano) +* Added Ukrainian (uk_UA) color provider (ruden) +* Fixed Ukrainian (uk_UA) namespace and email translitteration (ruden) +* Added Romanian (Moldova) (ro_MD) person, address, and phone number providers (AlexanderC) +* Added IBAN generator for every currently known locale that uses it (nineinchnick) +* Added Image generation powered by LoremPixel (weotch) +* Fixed missing timezone with dateTimeBetween (baldurrensch) +* Fixed call to undefined method cardType in Payment (WMeldon) +* Added Romanian (ro_RO) address and person providers (calina-c) +* Fixed Doctrine populator to use ObjectManager instead of EntityManagerInterface (mgiustiniani) +* Fixed docblock for Provider\Base::unique() (pschultz) +* Added Payment providers (creditCardType, creditCardNumber, creditCardExpirationDate, creditCardExpirationDateString) (pomaxa) +* Added unique() modifier +* Added IDE insights to allow better intellisense/phpStorm autocompletion (thallisphp) +* Added Polish (pl_PL) address provider, personal identity number and pesel number generator (nineinchnick) +* Added Turkish (tr_TR) address provider, and improved internet provider (hasandz) +* Fixed Propel column number guesser to use signed range of values (gunnarlium) +* Added Greek (el_GR) person, address, and phone number providers (georgeharito) +* Added Austrian (en_AU) address, Internet, and phone number providers (rcuddy) +* Fixed phpDoc in Doctrine Entity populator (rogamoore) +* Added French (fr_FR) phone number formats (vchabot) +* Added optional() modifier (weotch) +* Fixed typo in the Person provider documentation (jtreminio) +* Fixed Russian (ru_RU) person format (alexshadow007) +* Added Japanese (ja_JP) person, address, Internet, phone number, and company providers (kumamidori) +* Added color providers, driver license and passport number formats for the ru_RU locale (pomaxa) +* Added Latvian (lv_LV) person, address, Internet, and phone number providers (pomaxa) +* Added Brazilian (pt_BR) Internet provider (vjnrv) +* Added more Czech (cs_CZ) lastnames (petrkle) +* Added Chinese Simplified (zh_CN) person, address, Internet, and phone number providers (tlikai) +* Fixed Typos (pborelli) +* Added Color provider with hexColor, rgbColor, rgbColorAsArray, rgbCssColor, safeColorName, and colorName formatters (lsv) +* Added support for associative arrays in `randomElement` (aRn0D) + + +2013-06-09, v1.2.0 +------------------ + +* Added new provider for fr_BE locale (jflefebvre) +* Updated locale provider to use a static locale list (spawn-guy) +* Fixed invalid UTF-8 sequence in domain provider with the Bulgarian provider (Dynom) +* Fixed the nl_NL Person provider (Dynom) +* Removed all requires and added the autoload definition to composer (Dynom) +* Fixed encoding problems in nl_NL Address provider (Dynom) +* Added icelandic provider (is_IS) (birkir) +* Added en_CA address and phone numbers (cviebrock) +* Updated safeEmail provider to be really safe (TimWolla) +* Documented alternative randomNumber usage (Seldaek) +* Added basic file provider (anroots) +* Fixed use of fourth argument on Doctrine addEntity (ecentinela) +* Added nl_BE provider (wimvds) +* Added Random Float provider (csanquer) +* Fixed bug in Faker\ORM\Doctrine\Populator (mmf-amarcos) +* Updated ru_RU provider (rmrevin) +* Added safe email domain provider (csanquer) +* Fixed latitude provider (rumpl) +* Fixed unpredictability of fake data generated by Faker\Provider\Base::numberBetween() (goatherd) +* Added uuid provider (goatherd) +* Added possibility to call methods on Doctrine entities, possibility to generate unique id (nenadalm) +* Fixed prefixes typos in 'pl_PL' Person provider (krymen) +* Added more fake data to the Ukraininan providers (lysenkobv) +* Added more fake data to the Italian providers (EmanueleMinotto) +* Fixed spaces appearing in generated emails (alchy58) +* Added Armenian (hy_AM) provider (artash) +* Added Generation of valid SIREN & SIRET codes to French providers (alexsegura) +* Added Dutch (nl_NL) provider (WouterJ) +* Fixed missing typehint in Base::__construct() (benja-M-1) +* Fixed typo in README (benja-M-1) +* Added Ukrainian (ua_UA) provider (rsvasilyev) +* Added Turkish (tr_TR) Provider (faridmovsumov) +* Fixed executable bit in some PHP files (siwinski) +* Added Brazilian Portuguese (pt_BR) provider (oliveiraev) +* Added Spanish (es_ES) provider (ivannis) +* Fixed Doctrine populator to allow for the population of entity data that has associations to other entities (afishnamedsquish) +* Added Danish (da_DK) providers (toin0u) +* Cleaned up whitespaces (toin0u) +* Fixed utf-8 bug with lowercase generators (toin0u) +* Fixed composer.json (Seldaek) +* Fixed bug in Doctrine EntityPopulator (beberlei) +* Added Finnish (fi_FI) provider (drodil) + +2012-10-29, v1.1.0 +------------------ + +* Updated text provider to return paragraphs as a string instead of array. Great for populating markdown textarea fields (Seldaek) +* Updated dateTimeBetween to accept DateTime instances (Seldaek) +* Added random number generator between a and b, simply like rand() (Seldaek) +* Fixed spaces in generated emails (blaugueux) +* Fixed Person provider in Russian locale (Isamashii) +* Added new UserAgent provider (blaugueux) +* Added locale generator to Miscellaneous provider (blaugueux) +* Added timezone generator to DateTime provider (blaugueux) +* Added new generators to French Address providers (departments, regions) (geoffrey-brier) +* Added new generators to French Company provider (catch phrase, SIREN, and SIRET numbers) (geoffrey-brier) +* Added state generator to German Address provider (Powerhamster) +* Added Slovak provider (bazo) +* Added latitude and longitude formatters to Address provider (fixe) +* Added Serbian provider (umpirsky) + +2012-07-10, v1.0.0 +----------------- + +* Initial Version diff --git a/vendor/fzaninotto/faker/CONTRIBUTING.md b/vendor/fzaninotto/faker/CONTRIBUTING.md new file mode 100644 index 0000000..804bf79 --- /dev/null +++ b/vendor/fzaninotto/faker/CONTRIBUTING.md @@ -0,0 +1,22 @@ +Contributing +============ + +If you've written a new formatter, adapted Faker to a new locale, or fixed a bug, your contribution is welcome! + +Before proposing a pull request, check the following: + +* Your code should follow the [PSR-2 coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `make sniff` to check that the coding standards are followed, and use [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) to fix inconsistencies. +* Unit tests should still pass after your patch. Run the tests on your dev server (with `make test`) or check the continuous integration status for your pull request. +* As much as possible, add unit tests for your code +* Never use `rand()` in your providers. Faker uses the Mersenne Twister Randomizer, so use `mt_rand()` or any of the base generators (`randomNumber`, `randomElement`, etc.) instead. +* If you add new providers (or new locales) and that they embed a lot of data for random generation (e.g. first names in a new language), please add a `@link` to the reference you used for this list (example [in the ru_RU locale](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Provider/ru_RU/Person.php#L13)). This will ease future updates of the list and debates about the most relevant data for this provider. +* If you add long list of random data, please split the list into several lines. This makes diffs easier to read, and facilitates core review. +* If you add new formatters, please include documentation for it in the README. Don't forget to add a line about new formatters in the `@property` or `@method` phpDoc entries in [Generator.php](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Generator.php#L6-L118) to help IDEs auto-complete your formatters. +* If your new formatters are specific to a certain locale, document them in the [Language-specific formatters](https://github.com/fzaninotto/Faker#language-specific-formatters) list instead. +* Avoid changing existing sets of data. Some developers use Faker with seeding for unit tests ; changing the data makes their tests fail. +* Speed is important in all Faker usages. Make sure your code is optimized to generate thousands of fake items in no time, without consuming too much memory or CPU. +* If you commit a new feature, be prepared to help maintaining it. Watch the project on GitHub, and please comment on issues or PRs regarding the feature you contributed. + +Once your code is merged, it is available for free to everybody under the MIT License. Publishing your Pull Request on the Faker GitHub repository means that you agree with this license for your contribution. + +Thank you for your contribution! Faker wouldn't be so great without you. diff --git a/vendor/fzaninotto/faker/LICENSE b/vendor/fzaninotto/faker/LICENSE new file mode 100644 index 0000000..99ed007 --- /dev/null +++ b/vendor/fzaninotto/faker/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011 François Zaninotto +Portions Copyright (c) 2008 Caius Durling +Portions Copyright (c) 2008 Adam Royle +Portions Copyright (c) 2008 Fiona Burrows + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/fzaninotto/faker/Makefile b/vendor/fzaninotto/faker/Makefile new file mode 100644 index 0000000..ccfde5c --- /dev/null +++ b/vendor/fzaninotto/faker/Makefile @@ -0,0 +1,10 @@ +vendor/autoload.php: + composer install --no-interaction --prefer-dist + +.PHONY: sniff +sniff: vendor/autoload.php + vendor/bin/phpcs --standard=PSR2 src -n + +.PHONY: test +test: vendor/autoload.php + vendor/bin/phpunit --verbose diff --git a/vendor/fzaninotto/faker/composer.json b/vendor/fzaninotto/faker/composer.json new file mode 100644 index 0000000..e52016e --- /dev/null +++ b/vendor/fzaninotto/faker/composer.json @@ -0,0 +1,35 @@ +{ + "name": "fzaninotto/faker", + "type": "library", + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": ["faker", "fixtures", "data"], + "license": "MIT", + "authors": [ + { + "name": "François Zaninotto" + } + ], + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5", + "ext-intl": "*" + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "autoload-dev": { + "psr-4": { + "Faker\\Test\\": "test/Faker/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + } +} diff --git a/vendor/fzaninotto/faker/phpunit.xml.dist b/vendor/fzaninotto/faker/phpunit.xml.dist new file mode 100644 index 0000000..4ffa17f --- /dev/null +++ b/vendor/fzaninotto/faker/phpunit.xml.dist @@ -0,0 +1,12 @@ + + + + + + ./test/Faker/ + + + diff --git a/vendor/fzaninotto/faker/readme.md b/vendor/fzaninotto/faker/readme.md new file mode 100644 index 0000000..c375490 --- /dev/null +++ b/vendor/fzaninotto/faker/readme.md @@ -0,0 +1,1707 @@ +# Faker + +Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. + +Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker). + +Faker requires PHP >= 5.3.3. + +[![Monthly Downloads](https://poser.pugx.org/fzaninotto/faker/d/monthly.png)](https://packagist.org/packages/fzaninotto/faker) [![Build Status](https://travis-ci.org/fzaninotto/Faker.svg?branch=master)](https://travis-ci.org/fzaninotto/Faker) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549/mini.png)](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549) + +# Table of Contents + +- [Installation](#installation) +- [Basic Usage](#basic-usage) +- [Formatters](#formatters) + - [Base](#fakerproviderbase) + - [Lorem Ipsum Text](#fakerproviderlorem) + - [Person](#fakerprovideren_usperson) + - [Address](#fakerprovideren_usaddress) + - [Phone Number](#fakerprovideren_usphonenumber) + - [Company](#fakerprovideren_uscompany) + - [Real Text](#fakerprovideren_ustext) + - [Date and Time](#fakerproviderdatetime) + - [Internet](#fakerproviderinternet) + - [User Agent](#fakerprovideruseragent) + - [Payment](#fakerproviderpayment) + - [Color](#fakerprovidercolor) + - [File](#fakerproviderfile) + - [Image](#fakerproviderimage) + - [Uuid](#fakerprovideruuid) + - [Barcode](#fakerproviderbarcode) + - [Miscellaneous](#fakerprovidermiscellaneous) + - [Biased](#fakerproviderbiased) + - [Html Lorem](#fakerproviderhtmllorem) +- [Modifiers](#modifiers) +- [Localization](#localization) +- [Populating Entities Using an ORM or an ODM](#populating-entities-using-an-orm-or-an-odm) +- [Seeding the Generator](#seeding-the-generator) +- [Faker Internals: Understanding Providers](#faker-internals-understanding-providers) +- [Real Life Usage](#real-life-usage) +- [Language specific formatters](#language-specific-formatters) +- [Third-Party Libraries Extending/Based On Faker](#third-party-libraries-extendingbased-on-faker) +- [License](#license) + + +## Installation + +```sh +composer require fzaninotto/faker +``` + +## Basic Usage + +Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want. + +```php +name; + // 'Lucy Cechtelar'; +echo $faker->address; + // "426 Jordy Lodge + // Cartwrightshire, SC 88120-6700" +echo $faker->text; + // Dolores sit sint laboriosam dolorem culpa et autem. Beatae nam sunt fugit + // et sit et mollitia sed. + // Fuga deserunt tempora facere magni omnis. Omnis quia temporibus laudantium + // sit minima sint. +``` + +Even if this example shows a property access, each call to `$faker->name` yields a different (random) result. This is because Faker uses `__get()` magic, and forwards `Faker\Generator->$property` calls to `Faker\Generator->format($property)`. + +```php +name, "\n"; +} + // Adaline Reichel + // Dr. Santa Prosacco DVM + // Noemy Vandervort V + // Lexi O'Conner + // Gracie Weber + // Roscoe Johns + // Emmett Lebsack + // Keegan Thiel + // Wellington Koelpin II + // Ms. Karley Kiehn V +``` + +**Tip**: For a quick generation of fake data, you can also use Faker as a command line tool thanks to [faker-cli](https://github.com/bit3/faker-cli). + +## Formatters + +Each of the generator properties (like `name`, `address`, and `lorem`) are called "formatters". A faker generator has many of them, packaged in "providers". Here is a list of the bundled formatters in the default locale. + +### `Faker\Provider\Base` + + randomDigit // 7 + randomDigitNotNull // 5 + randomNumber($nbDigits = NULL, $strict = false) // 79907610 + randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL) // 48.8932 + numberBetween($min = 1000, $max = 9000) // 8567 + randomLetter // 'b' + // returns randomly ordered subsequence of a provided array + randomElements($array = array ('a','b','c'), $count = 1) // array('c') + randomElement($array = array ('a','b','c')) // 'b' + shuffle('hello, world') // 'rlo,h eoldlw' + shuffle(array(1, 2, 3)) // array(2, 1, 3) + numerify('Hello ###') // 'Hello 609' + lexify('Hello ???') // 'Hello wgt' + bothify('Hello ##??') // 'Hello 42jz' + asciify('Hello ***') // 'Hello R6+' + regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + +### `Faker\Provider\Lorem` + + word // 'aut' + words($nb = 3, $asText = false) // array('porro', 'sed', 'magni') + sentence($nbWords = 6, $variableNbWords = true) // 'Sit vitae voluptas sint non voluptates.' + sentences($nb = 3, $asText = false) // array('Optio quos qui illo error.', 'Laborum vero a officia id corporis.', 'Saepe provident esse hic eligendi.') + paragraph($nbSentences = 3, $variableNbSentences = true) // 'Ut ab voluptas sed a nam. Sint autem inventore aut officia aut aut blanditiis. Ducimus eos odit amet et est ut eum.' + paragraphs($nb = 3, $asText = false) // array('Quidem ut sunt et quidem est accusamus aut. Fuga est placeat rerum ut. Enim ex eveniet facere sunt.', 'Aut nam et eum architecto fugit repellendus illo. Qui ex esse veritatis.', 'Possimus omnis aut incidunt sunt. Asperiores incidunt iure sequi cum culpa rem. Rerum exercitationem est rem.') + text($maxNbChars = 200) // 'Fuga totam reiciendis qui architecto fugiat nemo. Consequatur recusandae qui cupiditate eos quod.' + +### `Faker\Provider\en_US\Person` + + title($gender = null|'male'|'female') // 'Ms.' + titleMale // 'Mr.' + titleFemale // 'Ms.' + suffix // 'Jr.' + name($gender = null|'male'|'female') // 'Dr. Zane Stroman' + firstName($gender = null|'male'|'female') // 'Maynard' + firstNameMale // 'Maynard' + firstNameFemale // 'Rachel' + lastName // 'Zulauf' + +### `Faker\Provider\en_US\Address` + + cityPrefix // 'Lake' + secondaryAddress // 'Suite 961' + state // 'NewMexico' + stateAbbr // 'OH' + citySuffix // 'borough' + streetSuffix // 'Keys' + buildingNumber // '484' + city // 'West Judge' + streetName // 'Keegan Trail' + streetAddress // '439 Karley Loaf Suite 897' + postcode // '17916' + address // '8888 Cummings Vista Apt. 101, Susanbury, NY 95473' + country // 'Falkland Islands (Malvinas)' + latitude($min = -90, $max = 90) // 77.147489 + longitude($min = -180, $max = 180) // 86.211205 + +### `Faker\Provider\en_US\PhoneNumber` + + phoneNumber // '201-886-0269 x3767' + tollFreePhoneNumber // '(888) 937-7238' + e164PhoneNumber // '+27113456789' + +### `Faker\Provider\en_US\Company` + + catchPhrase // 'Monitored regional contingency' + bs // 'e-enable robust architectures' + company // 'Bogan-Treutel' + companySuffix // 'and Sons' + jobTitle // 'Cashier' + +### `Faker\Provider\en_US\Text` + + realText($maxNbChars = 200, $indexSize = 2) // "And yet I wish you could manage it?) 'And what are they made of?' Alice asked in a shrill, passionate voice. 'Would YOU like cats if you were never even spoke to Time!' 'Perhaps not,' Alice replied." + +### `Faker\Provider\DateTime` + + unixTime($max = 'now') // 58781813 + dateTime($max = 'now', $timezone = null) // DateTime('2008-04-25 08:37:17', 'UTC') + dateTimeAD($max = 'now', $timezone = null) // DateTime('1800-04-29 20:38:49', 'Europe/Paris') + iso8601($max = 'now') // '1978-12-09T10:10:29+0000' + date($format = 'Y-m-d', $max = 'now') // '1979-06-09' + time($format = 'H:i:s', $max = 'now') // '20:49:42' + dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) // DateTime('2003-03-15 02:00:49', 'Africa/Lagos') + dateTimeInInterval($startDate = '-30 years', $interval = '+ 5 days', $timezone = null) // DateTime('2003-03-15 02:00:49', 'Antartica/Vostok') + dateTimeThisCentury($max = 'now', $timezone = null) // DateTime('1915-05-30 19:28:21', 'UTC') + dateTimeThisDecade($max = 'now', $timezone = null) // DateTime('2007-05-29 22:30:48', 'Europe/Paris') + dateTimeThisYear($max = 'now', $timezone = null) // DateTime('2011-02-27 20:52:14', 'Africa/Lagos') + dateTimeThisMonth($max = 'now', $timezone = null) // DateTime('2011-10-23 13:46:23', 'Antarctica/Vostok') + amPm($max = 'now') // 'pm' + dayOfMonth($max = 'now') // '04' + dayOfWeek($max = 'now') // 'Friday' + month($max = 'now') // '06' + monthName($max = 'now') // 'January' + year($max = 'now') // '1993' + century // 'VI' + timezone // 'Europe/Paris' + +Methods accepting a `$timezone` argument default to `date_default_timezone_get()`. You can pass a custom timezone string to each method, or define a custom timezone for all time methods at once using `$faker::setDefaultTimezone($timezone)`. + +### `Faker\Provider\Internet` + + email // 'tkshlerin@collins.com' + safeEmail // 'king.alford@example.org' + freeEmail // 'bradley72@gmail.com' + companyEmail // 'russel.durward@mcdermott.org' + freeEmailDomain // 'yahoo.com' + safeEmailDomain // 'example.org' + userName // 'wade55' + password // 'k&|X+a45*2[' + domainName // 'wolffdeckow.net' + domainWord // 'feeney' + tld // 'biz' + url // 'http://www.skilesdonnelly.biz/aut-accusantium-ut-architecto-sit-et.html' + slug // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + ipv4 // '109.133.32.252' + localIpv4 // '10.242.58.8' + ipv6 // '8e65:933d:22ee:a232:f1c1:2741:1f10:117c' + macAddress // '43:85:B7:08:10:CA' + +### `Faker\Provider\UserAgent` + + userAgent // 'Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350' + chrome // 'Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) AppleWebKit/5312 (KHTML, like Gecko) Chrome/14.0.894.0 Safari/5312' + firefox // 'Mozilla/5.0 (X11; Linuxi686; rv:7.0) Gecko/20101231 Firefox/3.6' + safari // 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_1 rv:3.0; en-US) AppleWebKit/534.11.3 (KHTML, like Gecko) Version/4.0 Safari/534.11.3' + opera // 'Opera/8.25 (Windows NT 5.1; en-US) Presto/2.9.188 Version/10.00' + internetExplorer // 'Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Win 9x 4.90; Trident/3.0)' + +### `Faker\Provider\Payment` + + creditCardType // 'MasterCard' + creditCardNumber // '4485480221084675' + creditCardExpirationDate // 04/13 + creditCardExpirationDateString // '04/13' + creditCardDetails // array('MasterCard', '4485480221084675', 'Aleksander Nowak', '04/13') + // Generates a random IBAN. Set $countryCode to null for a random country + iban($countryCode) // 'IT31A8497112740YZ575DJ28BP4' + swiftBicNumber // 'RZTIAT22263' + +### `Faker\Provider\Color` + + hexcolor // '#fa3cc2' + rgbcolor // '0,255,122' + rgbColorAsArray // array(0,255,122) + rgbCssColor // 'rgb(0,255,122)' + safeColorName // 'fuchsia' + colorName // 'Gainsbor' + +### `Faker\Provider\File` + + fileExtension // 'avi' + mimeType // 'video/x-msvideo' + // Copy a random file from the source to the target directory and returns the fullpath or filename + file($sourceDir = '/tmp', $targetDir = '/tmp') // '/path/to/targetDir/13b73edae8443990be1aa8f1a483bc27.jpg' + file($sourceDir, $targetDir, false) // '13b73edae8443990be1aa8f1a483bc27.jpg' + +### `Faker\Provider\Image` + + // Image generation provided by LoremPixel (http://lorempixel.com/) + imageUrl($width = 640, $height = 480) // 'http://lorempixel.com/640/480/' + imageUrl($width, $height, 'cats') // 'http://lorempixel.com/800/600/cats/' + imageUrl($width, $height, 'cats', true, 'Faker') // 'http://lorempixel.com/800/400/cats/Faker' + imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/grey/800/400/cats/Faker/' Monochrome image + image($dir = '/tmp', $width = 640, $height = 480) // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg' + image($dir, $width, $height, 'cats') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat! + image($dir, $width, $height, 'cats', false) // '13b73edae8443990be1aa8f1a483bc27.jpg' it's a filename without path + image($dir, $width, $height, 'cats', true, false) // it's a no randomize images (default: `true`) + image($dir, $width, $height, 'cats', true, true, 'Faker') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat with 'Faker' text. Default, `null`. + +### `Faker\Provider\Uuid` + + uuid // '7e57d004-2b97-0e7a-b45f-5387367791cd' + +### `Faker\Provider\Barcode` + + ean13 // '4006381333931' + ean8 // '73513537' + isbn13 // '9790404436093' + isbn10 // '4881416324' + +### `Faker\Provider\Miscellaneous` + + boolean // false + boolean($chanceOfGettingTrue = 50) // true + md5 // 'de99a620c50f2990e87144735cd357e7' + sha1 // 'f08e7f04ca1a413807ebc47551a40a20a0b4de5c' + sha256 // '0061e4c60dac5c1d82db0135a42e00c89ae3a333e7c26485321f24348c7e98a5' + locale // en_UK + countryCode // UK + languageCode // en + currencyCode // EUR + emoji // 😁 + +### `Faker\Provider\Biased` + + // get a random number between 10 and 20, + // with more chances to be close to 20 + biasedNumberBetween($min = 10, $max = 20, $function = 'sqrt') + +### `Faker\Provider\HtmlLorem` + + //Generate HTML document which is no more than 2 levels deep, and no more than 3 elements wide at any level. + randomHtml(2,3) // Aut illo dolorem et accusantium eum.
Id aut saepe non mollitia voluptas voluptas.Non consequatur.Incidunt est.Aut voluptatem.Officia voluptas rerum quo.Asperiores similique.
Sapiente dolorum dolorem sint laboriosam commodi qui.Commodi nihil nesciunt eveniet quo repudiandae.Voluptates explicabo numquam distinctio necessitatibus repellat.Provident ut doloremque nam eum modi aspernatur.Iusto inventore.
Animi nihil ratione id mollitia libero ipsa quia tempore.Velit est officia et aut tenetur dolorem sed mollitia expedita.Modi modi repudiandae pariatur voluptas rerum ea incidunt non molestiae eligendi eos deleniti.Exercitationem voluptatibus dolor est iste quod molestiae.Quia reiciendis.
Inventore impedit exercitationem voluptatibus rerum cupiditate.Qui.Aliquam.Autem nihil aut et.Dolor ut quia error.
Enim facilis iusto earum et minus rerum assumenda quis quia.Reprehenderit ut sapiente occaecati voluptatum dolor voluptatem vitae qui velit.Quod fugiat non.Sunt nobis totam mollitia sed nesciunt est deleniti cumque.Repudiandae quo.
Modi dicta libero quisquam doloremque qui autem.Voluptatem aliquid saepe laudantium facere eos sunt dolor.Est eos quis laboriosam officia expedita repellendus quia natus.Et neque delectus quod fugit enim repudiandae qui.Fugit soluta sit facilis facere repellat culpa magni voluptatem maiores tempora.
Enim dolores doloremque.Assumenda voluptatem eum perferendis exercitationem.Quasi in fugit deserunt ea perferendis sunt nemo consequatur dolorum soluta.Maxime repellat qui numquam voluptatem est modi.Alias rerum rerum hic hic eveniet.
Tempore voluptatem.Eaque.Et sit quas fugit iusto.Nemo nihil rerum dignissimos et esse.Repudiandae ipsum numquam.
Nemo sunt quia.Sint tempore est neque ducimus harum sed.Dicta placeat atque libero nihil.Et qui aperiam temporibus facilis eum.Ut dolores qui enim et maiores nesciunt.
Dolorum totam sint debitis saepe laborum.Quidem corrupti ea.Cum voluptas quod.Possimus consequatur quasi dolorem ut et.Et velit non hic labore repudiandae quis.
+ +## Modifiers + +Faker provides three special providers, `unique()`, `optional()`, and `valid()`, to be called before any provider. + +```php +// unique() forces providers to return unique values +$values = array(); +for ($i=0; $i < 10; $i++) { + // get a random digit, but always a new one, to avoid duplicates + $values []= $faker->unique()->randomDigit; +} +print_r($values); // [4, 1, 8, 5, 0, 2, 6, 9, 7, 3] + +// providers with a limited range will throw an exception when no new unique value can be generated +$values = array(); +try { + for ($i=0; $i < 10; $i++) { + $values []= $faker->unique()->randomDigitNotNull; + } +} catch (\OverflowException $e) { + echo "There are only 9 unique digits not null, Faker can't generate 10 of them!"; +} + +// you can reset the unique modifier for all providers by passing true as first argument +$faker->unique($reset = true)->randomDigitNotNull; // will not throw OverflowException since unique() was reset +// tip: unique() keeps one array of values per provider + +// optional() sometimes bypasses the provider to return a default value instead (which defaults to NULL) +$values = array(); +for ($i=0; $i < 10; $i++) { + // get a random digit, but also null sometimes + $values []= $faker->optional()->randomDigit; +} +print_r($values); // [1, 4, null, 9, 5, null, null, 4, 6, null] + +// optional() accepts a weight argument to specify the probability of receiving the default value. +// 0 will always return the default value; 1 will always return the provider. Default weight is 0.5 (50% chance). +$faker->optional($weight = 0.1)->randomDigit; // 90% chance of NULL +$faker->optional($weight = 0.9)->randomDigit; // 10% chance of NULL + +// optional() accepts a default argument to specify the default value to return. +// Defaults to NULL. +$faker->optional($weight = 0.5, $default = false)->randomDigit; // 50% chance of FALSE +$faker->optional($weight = 0.9, $default = 'abc')->word; // 10% chance of 'abc' + +// valid() only accepts valid values according to the passed validator functions +$values = array(); +$evenValidator = function($digit) { + return $digit % 2 === 0; +}; +for ($i=0; $i < 10; $i++) { + $values []= $faker->valid($evenValidator)->randomDigit; +} +print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + +// just like unique(), valid() throws an overflow exception when it can't generate a valid value +$values = array(); +try { + $faker->valid($evenValidator)->randomElement(1, 3, 5, 7, 9); +} catch (\OverflowException $e) { + echo "Can't pick an even number in that set!"; +} +``` + +If you would like to use a modifier with a value not generated by Faker, use the `passthrough()` method. `passthrough()` simply returns whatever value it was given. + +```php +$faker->optional()->passthrough(mt_rand(5, 15)); +``` + +## Localization + +`Faker\Factory` can take a locale as an argument, to return localized data. If no localized provider is found, the factory fallbacks to the default locale (en_US). + +```php +name, "\n"; +} + // Luce du Coulon + // Auguste Dupont + // Roger Le Voisin + // Alexandre Lacroix + // Jacques Humbert-Roy + // Thérèse Guillet-Andre + // Gilles Gros-Bodin + // Amélie Pires + // Marcel Laporte + // Geneviève Marchal +``` + +You can check available Faker locales in the source code, [under the `Provider` directory](https://github.com/fzaninotto/Faker/tree/master/src/Faker/Provider). The localization of Faker is an ongoing process, for which we need your help. Don't hesitate to create localized providers to your own locale and submit a PR! + +## Populating Entities Using an ORM or an ODM + +Faker provides adapters for Object-Relational and Object-Document Mappers (currently, [Propel](http://www.propelorm.org), [Doctrine2](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/), [CakePHP](http://cakephp.org), [Spot2](https://github.com/vlucas/spot2), [Mandango](https://github.com/mandango/mandango) and [Eloquent](https://laravel.com/docs/master/eloquent) are supported). These adapters ease the population of databases through the Entity classes provided by an ORM library (or the population of document stores using Document classes provided by an ODM library). + +To populate entities, create a new populator class (using a generator instance as parameter), then list the class and number of all the entities that must be generated. To launch the actual data population, call the `execute()` method. + +Here is an example showing how to populate 5 `Author` and 10 `Book` objects: + +```php +addEntity('Author', 5); +$populator->addEntity('Book', 10); +$insertedPKs = $populator->execute(); +``` + +The populator uses name and column type guessers to populate each column with relevant data. For instance, Faker populates a column named `first_name` using the `firstName` formatter, and a column with a `TIMESTAMP` type using the `dateTime` formatter. The resulting entities are therefore coherent. If Faker misinterprets a column name, you can still specify a custom closure to be used for populating a particular column, using the third argument to `addEntity()`: + +```php +addEntity('Book', 5, array( + 'ISBN' => function() use ($generator) { return $generator->ean13(); } +)); +``` + +In this example, Faker will guess a formatter for all columns except `ISBN`, for which the given anonymous function will be used. + +**Tip**: To ignore some columns, specify `null` for the column names in the third argument of `addEntity()`. This is usually necessary for columns added by a behavior: + +```php +addEntity('Book', 5, array( + 'CreatedAt' => null, + 'UpdatedAt' => null, +)); +``` + +Of course, Faker does not populate autoincremented primary keys. In addition, `Faker\ORM\Propel\Populator::execute()` returns the list of inserted PKs, indexed by class: + +```php + (34, 35, 36, 37, 38), +// 'Book' => (456, 457, 458, 459, 470, 471, 472, 473, 474, 475) +// ) +``` + +In the previous example, the `Book` and `Author` models share a relationship. Since `Author` entities are populated first, Faker is smart enough to relate the populated `Book` entities to one of the populated `Author` entities. + +Lastly, if you want to execute an arbitrary function on an entity before insertion, use the fourth argument of the `addEntity()` method: + +```php +addEntity('Book', 5, array(), array( + function($book) { $book->publish(); }, +)); +``` + +## Seeding the Generator + +You may want to get always the same generated data - for instance when using Faker for unit testing purposes. The generator offers a `seed()` method, which seeds the random number generator. Calling the same script twice with the same seed produces the same results. + +```php +seed(1234); + +echo $faker->name; // 'Jess Mraz I'; +``` + +> **Tip**: DateTime formatters won't reproduce the same fake data if you don't fix the `$max` value: +> +> ```php +> // even when seeded, this line will return different results because $max varies +> $faker->dateTime(); // equivalent to $faker->dateTime($max = 'now') +> // make sure you fix the $max parameter +> $faker->dateTime('2014-02-25 08:37:17'); // will return always the same date when seeded +> ``` +> +> **Tip**: Formatters won't reproduce the same fake data if you use the `rand()` php function. Use `$faker` or `mt_rand()` instead: +> +> ```php +> // bad +> $faker->realText(rand(10,20)); +> // good +> $faker->realText($faker->numberBetween(10,20)); +> ``` + + + +## Faker Internals: Understanding Providers + +A `Faker\Generator` alone can't do much generation. It needs `Faker\Provider` objects to delegate the data generation to them. `Faker\Factory::create()` actually creates a `Faker\Generator` bundled with the default providers. Here is what happens under the hood: + +```php +addProvider(new Faker\Provider\en_US\Person($faker)); +$faker->addProvider(new Faker\Provider\en_US\Address($faker)); +$faker->addProvider(new Faker\Provider\en_US\PhoneNumber($faker)); +$faker->addProvider(new Faker\Provider\en_US\Company($faker)); +$faker->addProvider(new Faker\Provider\Lorem($faker)); +$faker->addProvider(new Faker\Provider\Internet($faker)); +```` + +Whenever you try to access a property on the `$faker` object, the generator looks for a method with the same name in all the providers attached to it. For instance, calling `$faker->name` triggers a call to `Faker\Provider\Person::name()`. And since Faker starts with the last provider, you can easily override existing formatters: just add a provider containing methods named after the formatters you want to override. + +That means that you can easily add your own providers to a `Faker\Generator` instance. A provider is usually a class extending `\Faker\Provider\Base`. This parent class allows you to use methods like `lexify()` or `randomNumber()`; it also gives you access to formatters of other providers, through the protected `$generator` property. The new formatters are the public methods of the provider class. + +Here is an example provider for populating Book data: + +```php +generator->sentence($nbWords); + return substr($sentence, 0, strlen($sentence) - 1); + } + + public function ISBN() + { + return $this->generator->ean13(); + } +} +``` + +To register this provider, just add a new instance of `\Faker\Provider\Book` to an existing generator: + +```php +addProvider(new \Faker\Provider\Book($faker)); +``` + +Now you can use the two new formatters like any other Faker formatter: + +```php +setTitle($faker->title); +$book->setISBN($faker->ISBN); +$book->setSummary($faker->text); +$book->setPrice($faker->randomNumber(2)); +``` + +**Tip**: A provider can also be a Plain Old PHP Object. In that case, all the public methods of the provider become available to the generator. + +## Real Life Usage + +The following script generates a valid XML document: + +```php + + + + + + +boolean(25)): ?> + + +
+ streetAddress ?> + city ?> + postcode ?> + state ?> +
+ +boolean(33)): ?> + bs ?> + +boolean(33)): ?> + + + +boolean(15)): ?> +
+text(400) ?> +]]> +
+ +
+ +
+``` + +Running this script produces a document looking like: + +```xml + + + + +
+ 182 Harrison Cove + North Lloyd + 45577 + Alabama +
+ + orchestrate compelling web-readiness + +
+ +
+
+ + +
+ 90111 Hegmann Inlet + South Geovanymouth + 69961-9311 + Colorado +
+ + +
+ + +
+ 9791 Nona Corner + Harberhaven + 74062-8191 + RhodeIsland +
+ + +
+ + +
+ 11161 Schultz Via + Feilstad + 98019 + NewJersey +
+ + + +
+ +
+
+ + +
+ 6106 Nader Village Suite 753 + McLaughlinstad + 43189-8621 + Missouri +
+ + expedite viral synergies + + +
+ + +
+ 7546 Kuvalis Plaza + South Wilfrid + 77069 + Georgia +
+ + +
+ + + +
+ 478 Daisha Landing Apt. 510 + West Lizethhaven + 30566-5362 + WestVirginia +
+ + orchestrate dynamic networks + + +
+ +
+
+ + +
+ 1251 Koelpin Mission + North Revastad + 81620 + Maryland +
+ + +
+ + +
+ 6396 Langworth Hills Apt. 446 + New Carlos + 89399-0268 + Wyoming +
+ + + +
+ + + +
+ 2246 Kreiger Station Apt. 291 + Kaydenmouth + 11397-1072 + Wyoming +
+ + grow sticky portals + +
+ +
+
+
+``` + +## Language specific formatters + +### `Faker\Provider\ar_SA\Person` + +```php +idNumber; // ID number +echo $faker->nationalIdNumber // Citizen ID number +echo $faker->foreignerIdNumber // Foreigner ID number +echo $faker->companyIdNumber // Company ID number +``` + +### `Faker\Provider\ar_SA\Payment` + +```php +bankAccountNumber // "SA0218IBYZVZJSEC8536V4XC" +``` + +### `Faker\Provider\at_AT\Payment` + +```php +vat; // "AT U12345678" - Austrian Value Added Tax number +echo $faker->vat(false); // "ATU12345678" - unspaced Austrian Value Added Tax number +``` + +### `Faker\Provider\bg_BG\Payment` + +```php +vat; // "BG 0123456789" - Bulgarian Value Added Tax number +echo $faker->vat(false); // "BG0123456789" - unspaced Bulgarian Value Added Tax number +``` + +### `Faker\Provider\cs_CZ\Address` + +```php +region; // "Liberecký kraj" +``` + +### `Faker\Provider\cs_CZ\Company` + +```php +ico; // "69663963" +``` + +### `Faker\Provider\cs_CZ\DateTime` + +```php +monthNameGenitive; // "prosince" +echo $faker->formattedDate; // "12. listopadu 2015" +``` + +### `Faker\Provider\cs_CZ\Person` + +```php +birthNumber; // "7304243452" +``` + +### `Faker\Provider\da_DK\Person` + +```php +cpr; // "051280-2387" +``` + +### `Faker\Provider\da_DK\Address` + +```php +kommune; // "Frederiksberg" + +// Generates a random region name +echo $faker->region; // "Region Sjælland" +``` + +### `Faker\Provider\da_DK\Company` + +```php +cvr; // "32458723" + +// Generates a random P number +echo $faker->p; // "5398237590" +``` + +### `Faker\Provider\de_DE\Payment` + +```php +bankAccountNumber; // "DE41849025553661169313" +echo $faker->bank; // "Volksbank Stuttgart" + +``` + +### `Faker\Provider\en_HK\Address` + +```php +town; // "Yuen Long" + +// Generates a fake village name based on the words commonly found in Hong Kong +echo $faker->village; // "O Tau" + +// Generates a fake estate name based on the words commonly found in Hong Kong +echo $faker->estate; // "Ching Lai Court" + +``` + +### `Faker\Provider\en_HK\Phone` + +```php +mobileNumber; // "92150087" + +// Generates a Hong Kong landline number (starting with 2 or 3) +echo $faker->landlineNumber; // "32750132" + +// Generates a Hong Kong fax number (starting with 7) +echo $faker->faxNumber; // "71937729" + +``` + +### `Faker\Provider\en_NG\Address` + +```php +region; // 'Katsina' +``` + +### `Faker\Provider\en_NG\Person` + +```php +name; // 'Oluwunmi Mayowa' +``` + +### `Faker\Provider\en_NZ\Phone` + +```php +cellNumber; // "021 123 4567" + +// Generates a toll free number +echo $faker->tollFreeNumber; // "0800 123 456" + +// Area Code +echo $faker->areaCode; // "03" +``` + +### `Faker\Provider\en_US\Company` + +```php +ein; // '12-3456789' +``` + +### `Faker\Provider\en_US\Payment` + +```php +bankAccountNumber; // '51915734310' +echo $faker->bankRoutingNumber; // '212240302' +``` + +### `Faker\Provider\en_US\Person` + +```php +ssn; // '123-45-6789' +``` + +### `Faker\Provider\en_ZA\Company` + +```php +companyNumber; // 1999/789634/01 +``` + +### `Faker\Provider\en_ZA\Person` + +```php +idNumber; // 6606192211041 + +// Generates a random valid licence code +echo $faker->licenceCode; // EB +``` + +### `Faker\Provider\en_ZA\PhoneNumber` + +```php +tollFreeNumber; // 0800 555 5555 + +// Generates a mobile phone number +echo $faker->mobileNumber; // 082 123 5555 +``` + +### `Faker\Provider\es_ES\Person` + +```php +dni; // '77446565E' + +// Generates a random valid licence code +echo $faker->licenceCode; // B +``` + +### `Faker\Provider\es_ES\Payment` + +```php +vat; // "A35864370" +``` + +### `Faker\Provider\es_PE\Person` + +```php +dni; // '83367512' +``` + +### `Faker\Provider\fa_IR\Address` + +```php +building; // "ساختمان آفتاب" + +// Returns a random city name +echo $faker->city // "استان زنجان" +``` + +### `Faker\Provider\fa_IR\Company` + +```php +contract; // "رسمی" +``` + +### `Faker\Provider\fi_FI\Payment` + +```php +bankAccountNumber; // "FI8350799879879616" +``` + +### `Faker\Provider\fi_FI\Person` + +```php +personalIdentityNumber() // '170974-007J' + +//Since the numbers are different for male and female persons, optionally you can specify gender. +echo $faker->personalIdentityNumber(\DateTime::createFromFormat('Y-m-d', '2015-12-14'), 'female') // '141215A520B' +``` + +### `Faker\Provider\fr_BE\Payment` + +```php +vat; // "BE 0123456789" - Belgian Value Added Tax number +echo $faker->vat(false); // "BE0123456789" - unspaced Belgian Value Added Tax number +``` + +### `Faker\Provider\es_VE\Person` + +```php +nationalId; // 'V11223344' +``` + +### `Faker\Provider\es_VE\Company` + +```php +taxpayerIdentificationNumber; // 'J1234567891' +``` + +### `Faker\Provider\fr_FR\Address` + +```php +departmentName; // "Haut-Rhin" + +// Generates a random department number +echo $faker->departmentNumber; // "2B" + +// Generates a random department info (department number => department name) +$faker->department; // array('18' => 'Cher'); + +// Generates a random region +echo $faker->region; // "Saint-Pierre-et-Miquelon" + +// Generates a random appartement,stair +echo $faker->secondaryAddress; // "Bat. 961" +``` + +### `Faker\Provider\fr_FR\Company` + +```php +siren; // 082 250 104 + +// Generates a random SIRET number +echo $faker->siret; // 347 355 708 00224 +``` + +### `Faker\Provider\fr_FR\Payment` + +```php +vat; // FR 12 123 456 789 +``` + +### `Faker\Provider\fr_FR\Person` + +```php +nir; // 1 88 07 35 127 571 - 19 +``` + +### `Faker\Provider\fr_FR\PhoneNumber` + +```php +phoneNumber; // +33 (0)1 67 97 01 31 +echo $faker->mobileNumber; // +33 6 21 12 72 84 +echo $faker->serviceNumber // 08 98 04 84 46 +``` + + +### `Faker\Provider\he_IL\Payment` + +```php +bankAccountNumber // "IL392237392219429527697" +``` + +### `Faker\Provider\hr_HR\Payment` + +```php +bankAccountNumber // "HR3789114847226078672" +``` + +### `Faker\Provider\hu_HU\Payment` + +```php +bankAccountNumber; // "HU09904437680048220079300783" +``` + +### `Faker\Provider\id_ID\Person` + +```php +nik(); // "8522246001570940" +``` + +### `Faker\Provider\it_IT\Company` + +```php +vatId(); // "IT98746784967" +``` + +### `Faker\Provider\it_IT\Person` + +```php +taxId(); // "DIXDPZ44E08F367A" +``` + +### `Faker\Provider\ja_JP\Person` + +```php +kanaName($gender = null|'male'|'female') // "アオタ ミノル" + +// Generates a 'kana' first name +echo $faker->firstKanaName($gender = null|'male'|'female') // "ヒデキ" + +// Generates a 'kana' first name on the male +echo $faker->firstKanaNameMale // "ヒデキ" + +// Generates a 'kana' first name on the female +echo $faker->firstKanaNameFemale // "マアヤ" + +// Generates a 'kana' last name +echo $faker->lastKanaName; // "ナカジマ" +``` + +### `Faker\Provider\ka_GE\Payment` + +```php +bankAccountNumber; // "GE33ZV9773853617253389" +``` + +### `Faker\Provider\kk_KZ\Company` + +```php +businessIdentificationNumber; // "150140000019" +``` + +### `Faker\Provider\kk_KZ\Payment` + +```php +bank; // "Қазкоммерцбанк" + +// Generates a random bank account number +echo $faker->bankAccountNumber; // "KZ1076321LO4H6X41I37" +``` + +### `Faker\Provider\kk_KZ\Person` + +```php +individualIdentificationNumber; // "780322300455" + +// Generates an individual identification number based on his/her birth date +echo $faker->individualIdentificationNumber(new \DateTime('1999-03-01')); // "990301300455" +``` + +### `Faker\Provider\ko_KR\Address` + +```php +metropolitanCity; // "서울특별시" + +// Generates a borough +echo $faker->borough; // "강남구" +``` + +### `Faker\Provider\ko_KR\PhoneNumber` + +```php +localAreaPhoneNumber; // "02-1234-4567" + +// Generates a cell phone number +echo $faker->cellPhoneNumber; // "010-9876-5432" +``` + +### `Faker\Provider\lt_LT\Payment` + +```php +bankAccountNumber // "LT300848876740317118" +``` + +### `Faker\Provider\lv_LV\Person` + +```php +personalIdentityNumber; // "140190-12301" +``` + +### `Faker\Provider\ms_MY\Address` + +```php +township; // "Taman Bahagia" + +// Generates a random Malaysian town address with matching postcode and state +echo $faker->townState; // "55100 Bukit Bintang, Kuala Lumpur" +``` + +### `Faker\Provider\ms_MY\Miscellaneous` + +```php +jpjNumberPlate; // "WPL 5169" +``` + +### `Faker\Provider\ms_MY\Payment` + +```php +bank; // "Maybank" + +// Generates a random Malaysian bank account number (10-16 digits) +echo $faker->bankAccountNumber; // "1234567890123456" + +// Generates a random Malaysian insurance company +echo $faker->insurance; // "AIA Malaysia" + +// Generates a random Malaysian bank SWIFT Code +echo $faker->swiftCode; // "MBBEMYKLXXX" +``` + +### `Faker\Provider\ms_MY\Person` + +```php +myKadNumber($gender = null|'male'|'female', $hyphen = null|true|false); // "710703471796" +``` + +### `Faker\Provider\ms_MY\PhoneNumber` + +```php +mobileNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "+6012-705 3767" + +// Generates a random Malaysian landline number +echo $faker->fixedLineNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "03-7112 0455" + +// Generates a random Malaysian voip number +echo $faker->voipNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "015-458 7099" +``` + +### `Faker\Provider\ne_NP\Address` + +```php +district; + +//Generates a Nepali city name +echo $faker->cityName; +``` + +### `Faker\Provider\nl_BE\Payment` + +```php +vat; // "BE 0123456789" - Belgian Value Added Tax number +echo $faker->vat(false); // "BE0123456789" - unspaced Belgian Value Added Tax number +``` + +### `Faker\Provider\nl_BE\Person` + +```php +rrn(); // "83051711784" - Belgian Rijksregisternummer +echo $faker->rrn('female'); // "50032089858" - Belgian Rijksregisternummer for a female +``` + +### `Faker\Provider\nl_NL\Company` + +```php +vat; // "NL123456789B01" - Dutch Value Added Tax number +echo $faker->btw; // "NL123456789B01" - Dutch Value Added Tax number (alias) +``` + +### `Faker\Provider\nl_NL\Person` + +```php +idNumber; // "111222333" - Dutch Personal identification number (BSN) +``` + +### `Faker\Provider\nb_NO\Payment` + +```php +bankAccountNumber; // "NO3246764709816" +``` + +### `Faker\Provider\pl_PL\Person` + +```php +pesel; // "40061451555" +// Generates a random personal identity card number +echo $faker->personalIdentityNumber; // "AKX383360" +// Generates a random taxpayer identification number (NIP) +echo $faker->taxpayerIdentificationNumber; // '8211575109' +``` + +### `Faker\Provider\pl_PL\Company` + +```php +regon; // "714676680" +// Generates a random local REGON number +echo $faker->regonLocal; // "15346111382836" +``` + +### `Faker\Provider\pl_PL\Payment` + +```php +bank; // "Narodowy Bank Polski" +// Generates a random bank account number +echo $faker->bankAccountNumber; // "PL14968907563953822118075816" +``` + +### `Faker\Provider\pt_PT\Person` + +```php +taxpayerIdentificationNumber; // '165249277' +``` + +### `Faker\Provider\pt_BR\Address` + +```php +region; // 'Nordeste' + +// Generates a random region abbreviation +echo $faker->regionAbbr; // 'NE' +``` + +### `Faker\Provider\pt_BR\PhoneNumber` + +```php +areaCode; // 21 +echo $faker->cellphone; // 9432-5656 +echo $faker->landline; // 2654-3445 +echo $faker->phone; // random landline, 8-digit or 9-digit cellphone number + +// Using the phone functions with a false argument returns unformatted numbers +echo $faker->cellphone(false); // 74336667 + +// cellphone() has a special second argument to add the 9th digit. Ignored if generated a Radio number +echo $faker->cellphone(true, true); // 98983-3945 or 7343-1290 + +// Using the "Number" suffix adds area code to the phone +echo $faker->cellphoneNumber; // (11) 98309-2935 +echo $faker->landlineNumber(false); // 3522835934 +echo $faker->phoneNumber; // formatted, random landline or cellphone (obeying the 9th digit rule) +echo $faker->phoneNumberCleared; // not formatted, random landline or cellphone (obeying the 9th digit rule) +``` + +### `Faker\Provider\pt_BR\Person` + +```php +name; // 'Sr. Luis Adriano Sepúlveda Filho' + +// Valid document generators have a boolean argument to remove formatting +echo $faker->cpf; // '145.343.345-76' +echo $faker->cpf(false); // '45623467866' +echo $faker->rg; // '84.405.736-3' +echo $faker->rg(false); // '844057363' +``` + +### `Faker\Provider\pt_BR\Company` + +```php +cnpj; // '23.663.478/0001-24' +echo $faker->cnpj(false); // '23663478000124' +``` + +### `Faker\Provider\ro_MD\Payment` + +```php +bankAccountNumber; // "MD83BQW1CKMUW34HBESDP3A8" +``` + +### `Faker\Provider\ro_RO\Payment` + +```php +bankAccountNumber; // "RO55WRJE3OE8X3YQI7J26U1E" +``` + +### `Faker\Provider\ro_RO\Person` + +```php +prefixMale; // "ing." +// Generates a random female name prefix/title +echo $faker->prefixFemale; // "d-na." +// Generates a random male first name +echo $faker->firstNameMale; // "Adrian" +// Generates a random female first name +echo $faker->firstNameFemale; // "Miruna" + + +// Generates a random Personal Numerical Code (CNP) +echo $faker->cnp; // "2800523081231" +// Valid option values: +// $gender: null (random), male, female +// $dateOfBirth (1800+): null (random), Y-m-d, Y-m (random day), Y (random month and day) +// i.e. '1981-06-16', '2015-03', '1900' +// $county: 2 letter ISO 3166-2:RO county codes and B1, B2, B3, B4, B5, B6 for Bucharest's 6 sectors +// $isResident true/false flag if the person resides in Romania +echo $faker->cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true); + +``` + +### `Faker\Provider\ro_RO\PhoneNumber` + +```php +tollFreePhoneNumber; // "0800123456" +// Generates a random premium-rate phone number +echo $faker->premiumRatePhoneNumber; // "0900123456" +``` + +### `Faker\Provider\ru_RU\Payment` + +```php +bank; // "ОТП Банк" + +//Generate a Russian Tax Payment Number for Company +echo $faker->inn; // 7813540735 + +//Generate a Russian Tax Code for Company +echo $faker->kpp; // 781301001 +``` + +### `Faker\Provider\sv_SE\Payment` + +```php +bankAccountNumber; // "SE5018548608468284909192" +``` + +### `Faker\Provider\sv_SE\Person` + +```php +personalIdentityNumber() // '950910-0799' + +//Since the numbers are different for male and female persons, optionally you can specify gender. +echo $faker->personalIdentityNumber('female') // '950910-0781' +``` +### `Faker\Provider\tr_TR\Person` + +```php +tcNo // '55300634882' + +``` + + +### `Faker\Provider\zh_CN\Payment` + +```php +bank; // '中国建设银行' +``` + +### `Faker\Provider\uk_UA\Payment` + +```php +bank; // "Ощадбанк" +``` + +### `Faker\Provider\zh_TW\Person` + +```php +personalIdentityNumber; // A223456789 +``` + +### `Faker\Provider\zh_TW\Company` + +```php +VAT; //23456789 +``` + + +## Third-Party Libraries Extending/Based On Faker + +* Symfony2 bundles: + * [BazingaFakerBundle](https://github.com/willdurand/BazingaFakerBundle): Put the awesome Faker library into the Symfony2 DIC and populate your database with fake data. + * [AliceBundle](https://github.com/hautelook/AliceBundle), [AliceFixturesBundle](https://github.com/h4cc/AliceFixturesBundle): Bundles for using [Alice](https://packagist.org/packages/nelmio/alice) and Faker with data fixtures. Able to use Doctrine ORM as well as Doctrine MongoDB ODM. +* [FakerServiceProvider](https://github.com/EmanueleMinotto/FakerServiceProvider): Faker Service Provider for Silex +* [faker-cli](https://github.com/bit3/faker-cli): Command Line Tool for the Faker PHP library +* [Factory Muffin](https://github.com/thephpleague/factory-muffin): enable the rapid creation of objects (PHP port of factory-girl) +* [CompanyNameGenerator](https://github.com/fzaninotto/CompanyNameGenerator): Generate names for English tech companies with class +* [PlaceholdItProvider](https://github.com/EmanueleMinotto/PlaceholdItProvider): Generate images using placehold.it +* [datalea](https://github.com/spyrit/datalea) A highly customizable random test data generator web app +* [newage-ipsum](https://github.com/frequenc1/newage-ipsum): A new aged ipsum provider for the faker library inspired by http://sebpearce.com/bullshit/ +* [xml-faker](https://github.com/prewk/xml-faker): Create fake XML with Faker +* [faker-context](https://github.com/denheck/faker-context): Behat context using Faker to generate testdata +* [CronExpressionGenerator](https://github.com/swekaj/CronExpressionGenerator): Faker provider for generating random, valid cron expressions. +* [pragmafabrik/Pomm2Faker](https://github.com/pragmafabrik/Pomm2Faker): Faker client for Pomm database framework (PostgreSQL) +* [nelmio/alice](https://packagist.org/packages/nelmio/alice): Fixtures/object generator with a yaml DSL that can use Faker as data generator. +* [CakePHP 2.x Fake Seeder Plugin](https://github.com/ravage84/cakephp-fake-seeder) A CakePHP 2.x shell to seed your database with fake and/or fixed data. +* [images-generator](https://github.com/bruceheller/images-generator): An image generator provider using GD for placeholder type pictures +* [pattern-lab/plugin-php-faker](https://github.com/pattern-lab/plugin-php-faker): Pattern Lab is a Styleguide, Component Library, and Prototyping tool. This creates unique content each time Pattern Lab is generated. +* [guidocella/eloquent-populator](https://github.com/guidocella/eloquent-populator): Adapter for Laravel's Eloquent ORM. +* [tamperdata/exiges](https://github.com/tamperdata/exiges): Faker provider for generating random temperatures +* [jzonta/FakerRestaurant](https://github.com/jzonta/FakerRestaurant): Faker for Food and Beverage names generate +* [aalaap/faker-youtube](https://github.com/aalaap/faker-youtube): Faker for YouTube URLs in various formats +* [pelmered/fake-car](https://github.com/pelmered/fake-car): Faker for cars and car data + +## License + +Faker is released under the MIT Licence. See the bundled LICENSE file for details. diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php b/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php new file mode 100644 index 0000000..8a58231 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php @@ -0,0 +1,73 @@ + 2, 2 => 4, 3 => 10, 4 => 3, 5 => 5, 6 => 9, 7 => 4, 8 => 6, 9 => 8); + $sum = 0; + for ($i = 1; $i <= 9; $i++) { + $sum += intval(substr($inn, $i-1, 1)) * $multipliers[$i]; + } + return strval(($sum % 11) % 10); + } + + /** + * Checks whether an INN has a valid checksum + * + * @param string $inn + * @return boolean + */ + public static function isValid($inn) + { + return self::checksum(substr($inn, 0, -1)) === substr($inn, -1, 1); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php b/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php new file mode 100644 index 0000000..c37c6c1 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php @@ -0,0 +1,75 @@ += 0; $i -= 2) { + $sum += $number{$i}; + } + for ($i = $length - 2; $i >= 0; $i -= 2) { + $sum += array_sum(str_split($number{$i} * 2)); + } + + return $sum % 10; + } + + /** + * @param $partialNumber + * @return string + */ + public static function computeCheckDigit($partialNumber) + { + $checkDigit = self::checksum($partialNumber . '0'); + if ($checkDigit === 0) { + return 0; + } + + return (string) (10 - $checkDigit); + } + + /** + * Checks whether a number (partial number + check digit) is Luhn compliant + * + * @param string $number + * @return bool + */ + public static function isValid($number) + { + return self::checksum($number) === 0; + } + + /** + * Generate a Luhn compliant number. + * + * @param string $partialValue + * + * @return string + */ + public static function generateLuhnNumber($partialValue) + { + if (!preg_match('/^\d+$/', $partialValue)) { + throw new InvalidArgumentException('Argument should be an integer.'); + } + return $partialValue . Luhn::computeCheckDigit($partialValue); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php b/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php new file mode 100644 index 0000000..392d455 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php @@ -0,0 +1,52 @@ + $digit) { + if ($index % 2 == 0) { + $evenSum += $digit; + } else { + $oddSum += $digit; + } + } + + $tenthDigit = (7 * $evenSum - $oddSum) % 10; + $eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10; + + return $tenthDigit . $eleventhDigit; + } + + /** + * Checks whether an TCNo has a valid checksum + * + * @param string $tcNo + * @return boolean + */ + public static function isValid($tcNo) + { + return self::checksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php b/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php new file mode 100644 index 0000000..eafd2ec --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php @@ -0,0 +1,38 @@ +optional(). + */ +class DefaultGenerator +{ + protected $default; + + public function __construct($default = null) + { + $this->default = $default; + } + + /** + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->default; + } + + /** + * @param string $method + * @param array $attributes + * + * @return mixed + */ + public function __call($method, $attributes) + { + return $this->default; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Documentor.php b/vendor/fzaninotto/faker/src/Faker/Documentor.php new file mode 100644 index 0000000..e42bdf4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Documentor.php @@ -0,0 +1,66 @@ +generator = $generator; + } + + /** + * @return array + */ + public function getFormatters() + { + $formatters = array(); + $providers = array_reverse($this->generator->getProviders()); + $providers[]= new Provider\Base($this->generator); + foreach ($providers as $provider) { + $providerClass = get_class($provider); + $formatters[$providerClass] = array(); + $refl = new \ReflectionObject($provider); + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) { + if ($reflmethod->getDeclaringClass()->getName() == 'Faker\Provider\Base' && $providerClass != 'Faker\Provider\Base') { + continue; + } + $methodName = $reflmethod->name; + if ($reflmethod->isConstructor()) { + continue; + } + $parameters = array(); + foreach ($reflmethod->getParameters() as $reflparameter) { + $parameter = '$'. $reflparameter->getName(); + if ($reflparameter->isDefaultValueAvailable()) { + $parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true); + } + $parameters []= $parameter; + } + $parameters = $parameters ? '('. join(', ', $parameters) . ')' : ''; + try { + $example = $this->generator->format($methodName); + } catch (\InvalidArgumentException $e) { + $example = ''; + } + if (is_array($example)) { + $example = "array('". join("', '", $example) . "')"; + } elseif ($example instanceof \DateTime) { + $example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')"; + } elseif ($example instanceof Generator || $example instanceof UniqueGenerator) { // modifier + $example = ''; + } else { + $example = var_export($example, true); + } + $formatters[$providerClass][$methodName . $parameters] = $example; + } + } + + return $formatters; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Factory.php b/vendor/fzaninotto/faker/src/Faker/Factory.php new file mode 100644 index 0000000..1d68781 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Factory.php @@ -0,0 +1,61 @@ +addProvider(new $providerClassName($generator)); + } + + return $generator; + } + + /** + * @param string $provider + * @param string $locale + * @return string + */ + protected static function getProviderClassname($provider, $locale = '') + { + if ($providerClass = self::findProviderClassname($provider, $locale)) { + return $providerClass; + } + // fallback to default locale + if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) { + return $providerClass; + } + // fallback to no locale + if ($providerClass = self::findProviderClassname($provider)) { + return $providerClass; + } + throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale)); + } + + /** + * @param string $provider + * @param string $locale + * @return string + */ + protected static function findProviderClassname($provider, $locale = '') + { + $providerClass = 'Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider)); + if (class_exists($providerClass, true)) { + return $providerClass; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Generator.php b/vendor/fzaninotto/faker/src/Faker/Generator.php new file mode 100644 index 0000000..0a4e050 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Generator.php @@ -0,0 +1,281 @@ +providers, $provider); + } + + public function getProviders() + { + return $this->providers; + } + + public function seed($seed = null) + { + if ($seed === null) { + mt_srand(); + } else { + if (PHP_VERSION_ID < 70100) { + mt_srand((int) $seed); + } else { + mt_srand((int) $seed, MT_RAND_PHP); + } + } + } + + public function format($formatter, $arguments = array()) + { + return call_user_func_array($this->getFormatter($formatter), $arguments); + } + + /** + * @param string $formatter + * + * @return Callable + */ + public function getFormatter($formatter) + { + if (isset($this->formatters[$formatter])) { + return $this->formatters[$formatter]; + } + foreach ($this->providers as $provider) { + if (method_exists($provider, $formatter)) { + $this->formatters[$formatter] = array($provider, $formatter); + + return $this->formatters[$formatter]; + } + } + throw new \InvalidArgumentException(sprintf('Unknown formatter "%s"', $formatter)); + } + + /** + * Replaces tokens ('{{ tokenName }}') with the result from the token method call + * + * @param string $string String that needs to bet parsed + * @return string + */ + public function parse($string) + { + return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/u', array($this, 'callFormatWithMatches'), $string); + } + + protected function callFormatWithMatches($matches) + { + return $this->format($matches[1]); + } + + /** + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->format($attribute); + } + + /** + * @param string $method + * @param array $attributes + * + * @return mixed + */ + public function __call($method, $attributes) + { + return $this->format($method, $attributes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php b/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php new file mode 100644 index 0000000..0b303db --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php @@ -0,0 +1,156 @@ +generator = $generator; + } + + /** + * @param string $name + * @param int|null $size Length of field, if known + * @return callable + */ + public function guessFormat($name, $size = null) + { + $name = Base::toLower($name); + $generator = $this->generator; + if (preg_match('/^is[_A-Z]/', $name)) { + return function () use ($generator) { + return $generator->boolean; + }; + } + if (preg_match('/(_a|A)t$/', $name)) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + switch (str_replace('_', '', $name)) { + case 'firstname': + return function () use ($generator) { + return $generator->firstName; + }; + case 'lastname': + return function () use ($generator) { + return $generator->lastName; + }; + case 'username': + case 'login': + return function () use ($generator) { + return $generator->userName; + }; + case 'email': + case 'emailaddress': + return function () use ($generator) { + return $generator->email; + }; + case 'phonenumber': + case 'phone': + case 'telephone': + case 'telnumber': + return function () use ($generator) { + return $generator->phoneNumber; + }; + case 'address': + return function () use ($generator) { + return $generator->address; + }; + case 'city': + case 'town': + return function () use ($generator) { + return $generator->city; + }; + case 'streetaddress': + return function () use ($generator) { + return $generator->streetAddress; + }; + case 'postcode': + case 'zipcode': + return function () use ($generator) { + return $generator->postcode; + }; + case 'state': + return function () use ($generator) { + return $generator->state; + }; + case 'county': + if ($this->generator->locale == 'en_US') { + return function () use ($generator) { + return sprintf('%s County', $generator->city); + }; + } + + return function () use ($generator) { + return $generator->state; + }; + case 'country': + switch ($size) { + case 2: + return function () use ($generator) { + return $generator->countryCode; + }; + case 3: + return function () use ($generator) { + return $generator->countryISOAlpha3; + }; + case 5: + case 6: + return function () use ($generator) { + return $generator->locale; + }; + default: + return function () use ($generator) { + return $generator->country; + }; + } + break; + case 'locale': + return function () use ($generator) { + return $generator->locale; + }; + case 'currency': + case 'currencycode': + return function () use ($generator) { + return $generator->currencyCode; + }; + case 'url': + case 'website': + return function () use ($generator) { + return $generator->url; + }; + case 'company': + case 'companyname': + case 'employer': + return function () use ($generator) { + return $generator->company; + }; + case 'title': + if ($size !== null && $size <= 10) { + return function () use ($generator) { + return $generator->title; + }; + } + + return function () use ($generator) { + return $generator->sentence; + }; + case 'body': + case 'summary': + case 'article': + case 'description': + return function () use ($generator) { + return $generator->text; + }; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php new file mode 100644 index 0000000..0b871ed --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php @@ -0,0 +1,67 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($column, $table) + { + $generator = $this->generator; + $schema = $table->schema(); + + switch ($schema->columnType($column)) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'integer': + return function () { + return mt_rand(0, intval('2147483647')); + }; + case 'biginteger': + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case 'decimal': + case 'float': + return function () use ($generator) { + return $generator->randomFloat(); + }; + case 'uuid': + return function () use ($generator) { + return $generator->uuid(); + }; + case 'string': + $columnData = $schema->column($column); + $length = $columnData['length']; + return function () use ($generator, $length) { + return $generator->text($length); + }; + case 'text': + return function () use ($generator) { + return $generator->text(); + }; + case 'date': + case 'datetime': + case 'timestamp': + case 'time': + return function () use ($generator) { + return $generator->datetime(); + }; + + case 'binary': + default: + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php new file mode 100644 index 0000000..2ec312a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php @@ -0,0 +1,166 @@ +class = $class; + } + + /** + * @param string $name + */ + public function __get($name) + { + return $this->{$name}; + } + + /** + * @param string $name + */ + public function __set($name, $value) + { + $this->{$name} = $value; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters($populator) + { + $formatters = []; + $class = $this->class; + $table = $this->getTable($class); + $schema = $table->schema(); + $pk = $schema->primaryKey(); + $guessers = $populator->getGuessers() + ['ColumnTypeGuesser' => new ColumnTypeGuesser($populator->getGenerator())]; + $isForeignKey = function ($column) use ($table) { + foreach ($table->associations()->type('BelongsTo') as $assoc) { + if ($column == $assoc->foreignKey()) { + return true; + } + } + return false; + }; + + + foreach ($schema->columns() as $column) { + if ($column == $pk[0] || $isForeignKey($column)) { + continue; + } + + foreach ($guessers as $guesser) { + if ($formatter = $guesser->guessFormat($column, $table)) { + $formatters[$column] = $formatter; + break; + } + } + } + + return $formatters; + } + + /** + * @return array + */ + public function guessModifiers() + { + $modifiers = []; + $table = $this->getTable($this->class); + + $belongsTo = $table->associations()->type('BelongsTo'); + foreach ($belongsTo as $assoc) { + $modifiers['belongsTo' . $assoc->name()] = function ($data, $insertedEntities) use ($assoc) { + $table = $assoc->target(); + $foreignModel = $table->alias(); + + $foreignKeys = []; + if (!empty($insertedEntities[$foreignModel])) { + $foreignKeys = $insertedEntities[$foreignModel]; + } else { + $foreignKeys = $table->find('all') + ->select(['id']) + ->map(function ($row) { + return $row->id; + }) + ->toArray(); + } + + if (empty($foreignKeys)) { + throw new \Exception(sprintf('%s belongsTo %s, which seems empty at this point.', $this->getTable($this->class)->table(), $assoc->table())); + } + + $foreignKey = $foreignKeys[array_rand($foreignKeys)]; + $data[$assoc->foreignKey()] = $foreignKey; + return $data; + }; + } + + // TODO check if TreeBehavior attached to modify lft/rgt cols + + return $modifiers; + } + + /** + * @param array $options + */ + public function execute($class, $insertedEntities, $options = []) + { + $table = $this->getTable($class); + $entity = $table->newEntity(); + + foreach ($this->columnFormatters as $column => $format) { + if (!is_null($format)) { + $entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format; + } + } + + foreach ($this->modifiers as $modifier) { + $entity = $modifier($entity, $insertedEntities); + } + + if (!$entity = $table->save($entity, $options)) { + throw new \RuntimeException("Failed saving $class record"); + } + + $pk = $table->primaryKey(); + if (is_string($pk)) { + return $entity->{$pk}; + } + + return $entity->{$pk[0]}; + } + + public function setConnection($name) + { + $this->connectionName = $name; + } + + protected function getTable($class) + { + $options = []; + if (!empty($this->connectionName)) { + $options['connection'] = $this->connectionName; + } + return TableRegistry::get($class, $options); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php new file mode 100644 index 0000000..eda30a8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php @@ -0,0 +1,109 @@ +generator = $generator; + } + + /** + * @return \Faker\Generator + */ + public function getGenerator() + { + return $this->generator; + } + + /** + * @return array + */ + public function getGuessers() + { + return $this->guessers; + } + + /** + * @return $this + */ + public function removeGuesser($name) + { + if ($this->guessers[$name]) { + unset($this->guessers[$name]); + } + return $this; + } + + /** + * @return $this + * @throws \Exception + */ + public function addGuesser($class) + { + if (!is_object($class)) { + $class = new $class($this->generator); + } + + if (!method_exists($class, 'guessFormat')) { + throw new \Exception('Missing required custom guesser method: ' . get_class($class) . '::guessFormat()'); + } + + $this->guessers[get_class($class)] = $class; + return $this; + } + + /** + * @param array $customColumnFormatters + * @param array $customModifiers + * @return $this + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof EntityPopulator) { + $entity = new EntityPopulator($entity); + } + + $entity->columnFormatters = $entity->guessColumnFormatters($this); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + + $entity->modifiers = $entity->guessModifiers($this); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + + $class = $entity->class; + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + return $this; + } + + /** + * @param array $options + * @return array + */ + public function execute($options = []) + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; $i++) { + $insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities, $options); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php new file mode 100644 index 0000000..824f8c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php @@ -0,0 +1,75 @@ +generator = $generator; + } + + /** + * @param ClassMetadata $class + * @return \Closure|null + */ + public function guessFormat($fieldName, ClassMetadata $class) + { + $generator = $this->generator; + $type = $class->getTypeOfField($fieldName); + switch ($type) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'decimal': + $size = isset($class->fieldMappings[$fieldName]['precision']) ? $class->fieldMappings[$fieldName]['precision'] : 2; + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case 'smallint': + return function () { + return mt_rand(0, 65535); + }; + case 'integer': + return function () { + return mt_rand(0, intval('2147483647')); + }; + case 'bigint': + return function () { + return mt_rand(0, intval('18446744073709551615')); + }; + case 'float': + return function () { + return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295')); + }; + case 'string': + $size = isset($class->fieldMappings[$fieldName]['length']) ? $class->fieldMappings[$fieldName]['length'] : 255; + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case 'text': + return function () use ($generator) { + return $generator->text; + }; + case 'datetime': + case 'date': + case 'time': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php new file mode 100644 index 0000000..bc703e5 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php @@ -0,0 +1,251 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class->getName(); + } + + /** + * @param $columnFormatters + */ + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param array $modifiers + */ + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + /** + * @param array $modifiers + */ + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + foreach ($this->class->getFieldNames() as $fieldName) { + if ($this->class->isIdentifier($fieldName) || !$this->class->hasField($fieldName)) { + continue; + } + + $size = isset($this->class->fieldMappings[$fieldName]['length']) ? $this->class->fieldMappings[$fieldName]['length'] : null; + if ($formatter = $nameGuesser->guessFormat($fieldName, $size)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($fieldName, $this->class)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + + foreach ($this->class->getAssociationNames() as $assocName) { + if ($this->class->isCollectionValuedAssociation($assocName)) { + continue; + } + + $relatedClass = $this->class->getAssociationTargetClass($assocName); + + $unique = $optional = false; + if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) { + $mappings = $this->class->getAssociationMappings(); + foreach ($mappings as $mapping) { + if ($mapping['targetEntity'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_ONE) { + $unique = true; + $optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false; + break; + } + } + } + } elseif ($this->class instanceof \Doctrine\ODM\MongoDB\Mapping\ClassMetadata) { + $mappings = $this->class->associationMappings; + foreach ($mappings as $mapping) { + if ($mapping['targetDocument'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::ONE && $mapping['association'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::REFERENCE_ONE) { + $unique = true; + $optional = isset($mapping['nullable']) ? $mapping['nullable'] : false; + break; + } + } + } + } + + $index = 0; + $formatters[$assocName] = function ($inserted) use ($relatedClass, &$index, $unique, $optional) { + + if (isset($inserted[$relatedClass])) { + if ($unique) { + $related = null; + if (isset($inserted[$relatedClass][$index]) || !$optional) { + $related = $inserted[$relatedClass][$index]; + } + + $index++; + + return $related; + } + + return $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)]; + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * @param ObjectManager $manager + * @param bool $generateId + * @return EntityPopulator + */ + public function execute(ObjectManager $manager, $insertedEntities, $generateId = false) + { + $obj = $this->class->newInstance(); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + if ($generateId) { + $idsName = $this->class->getIdentifier(); + foreach ($idsName as $idName) { + $id = $this->generateId($obj, $idName, $manager); + $this->class->reflFields[$idName]->setValue($obj, $id); + } + } + + $manager->persist($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + // Add some extended debugging information to any errors thrown by the formatter + try { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + } catch (\InvalidArgumentException $ex) { + throw new \InvalidArgumentException(sprintf( + "Failed to generate a value for %s::%s: %s", + get_class($obj), + $field, + $ex->getMessage() + )); + } + // Try a standard setter if it's available, otherwise fall back on reflection + $setter = sprintf("set%s", ucfirst($field)); + if (is_callable(array($obj, $setter))) { + $obj->$setter($value); + } else { + $this->class->reflFields[$field]->setValue($obj, $value); + } + } + } + } + + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } + + /** + * @param ObjectManager $manager + * @return int|null + */ + private function generateId($obj, $column, ObjectManager $manager) + { + /* @var $repository \Doctrine\Common\Persistence\ObjectRepository */ + $repository = $manager->getRepository(get_class($obj)); + $result = $repository->createQueryBuilder('e') + ->select(sprintf('e.%s', $column)) + ->getQuery() + ->execute(); + $ids = array_map('current', $result->toArray()); + + $id = null; + do { + $id = mt_rand(); + } while (in_array($id, $ids)); + + return $id; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php new file mode 100644 index 0000000..d4fe897 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php @@ -0,0 +1,82 @@ +generator = $generator; + $this->manager = $manager; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array(), $generateId = false) + { + if (!$entity instanceof \Faker\ORM\Doctrine\EntityPopulator) { + if (null === $this->manager) { + throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator."); + } + $entity = new \Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity)); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + $this->generateId[$entity->getClass()] = $generateId; + + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param null|EntityManager $entityManager A Doctrine connection object + * + * @return array A list of the inserted PKs + */ + public function execute($entityManager = null) + { + if (null === $entityManager) { + $entityManager = $this->manager; + } + if (null === $entityManager) { + throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator."); + } + + $insertedEntities = array(); + foreach ($this->quantities as $class => $number) { + $generateId = $this->generateId[$class]; + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($entityManager, $insertedEntities, $generateId); + } + $entityManager->flush(); + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php new file mode 100644 index 0000000..d318b0a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php @@ -0,0 +1,49 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($field) + { + $generator = $this->generator; + switch ($field['type']) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'integer': + return function () { + return mt_rand(0, intval('4294967295')); + }; + case 'float': + return function () { + return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295')); + }; + case 'string': + return function () use ($generator) { + return $generator->text(255); + }; + case 'date': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php new file mode 100644 index 0000000..667f5be --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php @@ -0,0 +1,122 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @param Mandango $mandango + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator, Mandango $mandango) + { + $formatters = array(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Mandango\ColumnTypeGuesser($generator); + + $metadata = $mandango->getMetadata($this->class); + + // fields + foreach ($metadata['fields'] as $fieldName => $field) { + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + + // references + foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) { + if (!isset($reference['class'])) { + continue; + } + $referenceClass = $reference['class']; + + $formatters[$referenceName] = function ($insertedEntities) use ($referenceClass) { + if (isset($insertedEntities[$referenceClass])) { + return Base::randomElement($insertedEntities[$referenceClass]); + } + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * @param Mandango $mandango + */ + public function execute(Mandango $mandango, $insertedEntities) + { + $metadata = $mandango->getMetadata($this->class); + + $obj = $mandango->create($this->class); + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + + if (isset($metadata['fields'][$column]) || + isset($metadata['referencesOne'][$column])) { + $obj->set($column, $value); + } + + if (isset($metadata['referencesMany'][$column])) { + $adder = 'add'.ucfirst($column); + $obj->$adder($value); + } + } + } + $mandango->persist($obj); + + return $obj; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php new file mode 100644 index 0000000..26736dc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php @@ -0,0 +1,65 @@ +generator = $generator; + $this->mandango = $mandango; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array()) + { + if (!$entity instanceof \Faker\ORM\Mandango\EntityPopulator) { + $entity = new \Faker\ORM\Mandango\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @return array A list of the inserted entities. + */ + public function execute() + { + $insertedEntities = array(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($this->mandango, $insertedEntities); + } + } + $this->mandango->flush(); + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php new file mode 100644 index 0000000..1df7049 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php @@ -0,0 +1,107 @@ +generator = $generator; + } + + /** + * @param ColumnMap $column + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + if ($column->isTemporal()) { + if ($column->isEpochTemporal()) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + + return function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + switch ($type) { + case PropelColumnTypes::BOOLEAN: + case PropelColumnTypes::BOOLEAN_EMU: + return function () use ($generator) { + return $generator->boolean; + }; + case PropelColumnTypes::NUMERIC: + case PropelColumnTypes::DECIMAL: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case PropelColumnTypes::TINYINT: + return function () { + return mt_rand(0, 127); + }; + case PropelColumnTypes::SMALLINT: + return function () { + return mt_rand(0, 32767); + }; + case PropelColumnTypes::INTEGER: + return function () { + return mt_rand(0, intval('2147483647')); + }; + case PropelColumnTypes::BIGINT: + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case PropelColumnTypes::FLOAT: + return function () { + return mt_rand(0, intval('2147483647'))/mt_rand(1, intval('2147483647')); + }; + case PropelColumnTypes::DOUBLE: + case PropelColumnTypes::REAL: + return function () { + return mt_rand(0, intval('9223372036854775807'))/mt_rand(1, intval('9223372036854775807')); + }; + case PropelColumnTypes::CHAR: + case PropelColumnTypes::VARCHAR: + case PropelColumnTypes::BINARY: + case PropelColumnTypes::VARBINARY: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case PropelColumnTypes::LONGVARCHAR: + case PropelColumnTypes::LONGVARBINARY: + case PropelColumnTypes::CLOB: + case PropelColumnTypes::CLOB_EMU: + case PropelColumnTypes::BLOB: + return function () use ($generator) { + return $generator->text; + }; + case PropelColumnTypes::ENUM: + $valueSet = $column->getValueSet(); + + return function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + case PropelColumnTypes::OBJECT: + case PropelColumnTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php new file mode 100644 index 0000000..1976a40 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php @@ -0,0 +1,191 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel\ColumnTypeGuesser($generator); + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) { + return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null; + }; + continue; + } + if ($columnMap->isPrimaryKey()) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + } + + return $formatters; + } + + /** + * @param ColumnMap $columnMap + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + switch ($name) { + case 'nested_set': + $columnNames = array($params['left_column'], $params['right_column'], $params['level_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + case 'timestampable': + $columnNames = array($params['create_column'], $params['update_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = array(); + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + break; + case 'sortable': + $modifiers['sortable'] = function ($obj, $inserted) use ($class) { + $maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0; + $obj->insertAtRank(mt_rand(1, $maxRank + 1)); + }; + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php new file mode 100644 index 0000000..4285727 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php @@ -0,0 +1,89 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array()) + { + if (!$entity instanceof \Faker\ORM\Propel\EntityPopulator) { + $entity = new \Faker\ORM\Propel\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled(); + \Propel::disableInstancePooling(); + $insertedEntities = array(); + $con->beginTransaction(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + if ($isInstancePoolingEnabled) { + \Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::PEER; + + return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php new file mode 100644 index 0000000..024965a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php @@ -0,0 +1,107 @@ +generator = $generator; + } + + /** + * @param ColumnMap $column + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + if ($column->isTemporal()) { + if ($column->getType() == PropelTypes::BU_DATE || $column->getType() == PropelTypes::BU_TIMESTAMP) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + + return function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + switch ($type) { + case PropelTypes::BOOLEAN: + case PropelTypes::BOOLEAN_EMU: + return function () use ($generator) { + return $generator->boolean; + }; + case PropelTypes::NUMERIC: + case PropelTypes::DECIMAL: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case PropelTypes::TINYINT: + return function () { + return mt_rand(0, 127); + }; + case PropelTypes::SMALLINT: + return function () { + return mt_rand(0, 32767); + }; + case PropelTypes::INTEGER: + return function () { + return mt_rand(0, intval('2147483647')); + }; + case PropelTypes::BIGINT: + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case PropelTypes::FLOAT: + return function () { + return mt_rand(0, intval('2147483647'))/mt_rand(1, intval('2147483647')); + }; + case PropelTypes::DOUBLE: + case PropelTypes::REAL: + return function () { + return mt_rand(0, intval('9223372036854775807'))/mt_rand(1, intval('9223372036854775807')); + }; + case PropelTypes::CHAR: + case PropelTypes::VARCHAR: + case PropelTypes::BINARY: + case PropelTypes::VARBINARY: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case PropelTypes::LONGVARCHAR: + case PropelTypes::LONGVARBINARY: + case PropelTypes::CLOB: + case PropelTypes::CLOB_EMU: + case PropelTypes::BLOB: + return function () use ($generator) { + return $generator->text; + }; + case PropelTypes::ENUM: + $valueSet = $column->getValueSet(); + + return function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + case PropelTypes::OBJECT: + case PropelTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php new file mode 100644 index 0000000..df5b671 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php @@ -0,0 +1,192 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel2\ColumnTypeGuesser($generator); + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) { + $relatedClass = trim($relatedClass, "\\"); + return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null; + }; + continue; + } + if ($columnMap->isPrimaryKey()) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + } + + return $formatters; + } + + /** + * @param ColumnMap $columnMap + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + switch ($name) { + case 'nested_set': + $columnNames = array($params['left_column'], $params['right_column'], $params['level_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + case 'timestampable': + $columnNames = array($params['create_column'], $params['update_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = array(); + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + break; + case 'sortable': + $modifiers['sortable'] = function ($obj, $inserted) use ($class) { + $maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0; + $obj->insertAtRank(mt_rand(1, $maxRank + 1)); + }; + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php new file mode 100644 index 0000000..c0efe3b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php @@ -0,0 +1,92 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array()) + { + if (!$entity instanceof \Faker\ORM\Propel2\EntityPopulator) { + $entity = new \Faker\ORM\Propel2\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = Propel::isInstancePoolingEnabled(); + Propel::disableInstancePooling(); + $insertedEntities = array(); + $con->beginTransaction(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + if ($isInstancePoolingEnabled) { + Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::TABLE_MAP; + + return Propel::getConnection($peer::DATABASE_NAME, ServiceContainerInterface::CONNECTION_WRITE); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php new file mode 100644 index 0000000..716a9f2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php @@ -0,0 +1,77 @@ +generator = $generator; + } + + /** + * @param array $field + * @return \Closure|null + */ + public function guessFormat(array $field) + { + $generator = $this->generator; + $type = $field['type']; + switch ($type) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'decimal': + $size = isset($field['precision']) ? $field['precision'] : 2; + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case 'smallint': + return function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + case 'integer': + return function () use ($generator) { + return $generator->numberBetween(0, intval('2147483647')); + }; + case 'bigint': + return function () use ($generator) { + return $generator->numberBetween(0, intval('18446744073709551615')); + }; + case 'float': + return function () use ($generator) { + return $generator->randomFloat(null, 0, intval('4294967295')); + }; + case 'string': + $size = isset($field['length']) ? $field['length'] : 255; + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case 'text': + return function () use ($generator) { + return $generator->text; + }; + case 'datetime': + case 'date': + case 'time': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php new file mode 100644 index 0000000..ba5bddb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php @@ -0,0 +1,222 @@ +mapper = $mapper; + $this->locator = $locator; + $this->useExistingData = $useExistingData; + } + + /** + * @return string + */ + public function getMapper() + { + return $this->mapper; + } + + /** + * @param $columnFormatters + */ + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + /** + * @param $columnFormatters + */ + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param array $modifiers + */ + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + /** + * @param array $modifiers + */ + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param Generator $generator + * @return array + */ + public function guessColumnFormatters(Generator $generator) + { + $formatters = array(); + $nameGuesser = new Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $fields = $this->mapper->fields(); + foreach ($fields as $fieldName => $field) { + if ($field['primary'] === true) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + $entityName = $this->mapper->entity(); + $entity = $this->mapper->build([]); + $relations = $entityName::relations($this->mapper, $entity); + foreach ($relations as $relation) { + // We don't need any other relation here. + if ($relation instanceof BelongsTo) { + + $fieldName = $relation->localKey(); + $entityName = $relation->entityName(); + $field = $fields[$fieldName]; + $required = $field['required']; + + $locator = $this->locator; + + $formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator) { + if (!empty($inserted[$entityName])) { + return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->get('id'); + } + + if ($required && $this->useExistingData) { + // We did not add anything like this, but it's required, + // So let's find something existing in DB. + $mapper = $locator->mapper($entityName); + $records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray(); + if (empty($records)) { + return null; + } + $id = $records[mt_rand(0, count($records) - 1)]['id']; + + return $id; + } + + return null; + }; + + } + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @param $insertedEntities + * @return string + */ + public function execute($insertedEntities) + { + $obj = $this->mapper->build([]); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + $this->mapper->insert($obj); + + + return $obj; + } + + /** + * @param $obj + * @param $insertedEntities + */ + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + $obj->set($field, $value); + } + } + } + + /** + * @param $obj + * @param $insertedEntities + */ + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php new file mode 100644 index 0000000..c834b04 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php @@ -0,0 +1,88 @@ +generator = $generator; + $this->locator = $locator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param $entityName string Name of Entity object to generate + * @param $number int The number of entities to populate + * @param $customColumnFormatters array + * @param $customModifiers array + * @param $useExistingData bool Should we use existing rows (e.g. roles) to populate relations? + */ + public function addEntity( + $entityName, + $number, + $customColumnFormatters = array(), + $customModifiers = array(), + $useExistingData = false + ) { + $mapper = $this->locator->mapper($entityName); + if (null === $mapper) { + throw new \InvalidArgumentException("No mapper can be found for entity " . $entityName); + } + $entity = new EntityPopulator($mapper, $this->locator, $useExistingData); + + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + + $this->entities[$entityName] = $entity; + $this->quantities[$entityName] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param Locator $locator A Spot locator + * + * @return array A list of the inserted PKs + */ + public function execute($locator = null) + { + if (null === $locator) { + $locator = $this->locator; + } + if (null === $locator) { + throw new \InvalidArgumentException("No entity manager passed to Spot Populator."); + } + + $insertedEntities = array(); + foreach ($this->quantities as $entityName => $number) { + for ($i = 0; $i < $number; $i++) { + $insertedEntities[$entityName][] = $this->entities[$entityName]->execute( + $insertedEntities + ); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/Address.php new file mode 100644 index 0000000..24f538a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Address.php @@ -0,0 +1,139 @@ +generator->parse($format); + } + + /** + * @example 'Crist Parks' + */ + public function streetName() + { + $format = static::randomElement(static::$streetNameFormats); + + return $this->generator->parse($format); + } + + /** + * @example '791 Crist Parks' + */ + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 86039-9874 + */ + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + /** + * @example '791 Crist Parks, Sashabury, IL 86039-9874' + */ + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'Japan' + */ + public static function country() + { + return static::randomElement(static::$country); + } + + /** + * @example '77.147489' + * @param float|int $min + * @param float|int $max + * @return float Uses signed degrees format (returns a float number between -90 and 90) + */ + public static function latitude($min = -90, $max = 90) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example '86.211205' + * @param float|int $min + * @param float|int $max + * @return float Uses signed degrees format (returns a float number between -180 and 180) + */ + public static function longitude($min = -180, $max = 180) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * @return array | latitude, longitude + */ + public static function localCoordinates() + { + return array( + 'latitude' => static::latitude(), + 'longitude' => static::longitude() + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php b/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php new file mode 100644 index 0000000..05759a3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php @@ -0,0 +1,114 @@ + $digit) { + $sums += $digit * $sequence[$n % 2]; + } + return (10 - $sums % 10) % 10; + } + + /** + * ISBN-10 check digit + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digits + * + * @param string $input ISBN without check-digit + * @throws \LengthException When wrong input length passed + * + * @return integer Check digit + */ + protected static function isbnChecksum($input) + { + // We're calculating check digit for ISBN-10 + // so, the length of the input should be 9 + $length = 9; + + if (strlen($input) !== $length) { + throw new \LengthException(sprintf('Input length should be equal to %d', $length)); + } + + $digits = str_split($input); + array_walk( + $digits, + function (&$digit, $position) { + $digit = (10 - $position) * $digit; + } + ); + $result = (11 - array_sum($digits) % 11) % 11; + + // 10 is replaced by X + return ($result < 10)?$result:'X'; + } + + /** + * Get a random EAN13 barcode. + * @return string + * @example '4006381333931' + */ + public function ean13() + { + return $this->ean(13); + } + + /** + * Get a random EAN8 barcode. + * @return string + * @example '73513537' + */ + public function ean8() + { + return $this->ean(8); + } + + /** + * Get a random ISBN-10 code + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * @example '4881416324' + */ + public function isbn10() + { + $code = static::numerify(str_repeat('#', 9)); + + return $code . static::isbnChecksum($code); + } + + /** + * Get a random ISBN-13 code + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * @example '9790404436093' + */ + public function isbn13() + { + $code = '97' . static::numberBetween(8, 9) . static::numerify(str_repeat('#', 9)); + + return $code . static::eanChecksum($code); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Base.php b/vendor/fzaninotto/faker/src/Faker/Provider/Base.php new file mode 100644 index 0000000..fa321ee --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Base.php @@ -0,0 +1,612 @@ +generator = $generator; + } + + /** + * Returns a random number between 0 and 9 + * + * @return integer + */ + public static function randomDigit() + { + return mt_rand(0, 9); + } + + /** + * Returns a random number between 1 and 9 + * + * @return integer + */ + public static function randomDigitNotNull() + { + return mt_rand(1, 9); + } + + /** + * Generates a random digit, which cannot be $except + * + * @param int $except + * @return int + */ + public static function randomDigitNot($except) + { + $result = self::numberBetween(0, 8); + if ($result >= $except) { + $result++; + } + return $result; + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param integer $nbDigits Defaults to a random number between 1 and 9 + * @param boolean $strict Whether the returned number should have exactly $nbDigits + * @example 79907610 + * + * @return integer + */ + public static function randomNumber($nbDigits = null, $strict = false) + { + if (!is_bool($strict)) { + throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.'); + } + if (null === $nbDigits) { + $nbDigits = static::randomDigitNotNull(); + } + $max = pow(10, $nbDigits) - 1; + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + if ($strict) { + return mt_rand(pow(10, $nbDigits - 1), $max); + } + + return mt_rand(0, $max); + } + + /** + * Return a random float number + * + * @param int $nbMaxDecimals + * @param int|float $min + * @param int|float $max + * @example 48.8932 + * + * @return float + */ + public static function randomFloat($nbMaxDecimals = null, $min = 0, $max = null) + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = static::randomDigit(); + } + + if (null === $max) { + $max = static::randomNumber(); + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @param integer $int1 default to 0 + * @param integer $int2 defaults to 32 bit max integer, ie 2147483647 + * @example 79907610 + * + * @return integer + */ + public static function numberBetween($int1 = 0, $int2 = 2147483647) + { + $min = $int1 < $int2 ? $int1 : $int2; + $max = $int1 < $int2 ? $int2 : $int1; + return mt_rand($min, $max); + } + + /** + * Returns the passed value + * + * @param mixed $value + * + * @return mixed + */ + public static function passthrough($value) + { + return $value; + } + + /** + * Returns a random letter from a to z + * + * @return string + */ + public static function randomLetter() + { + return chr(mt_rand(97, 122)); + } + + /** + * Returns a random ASCII character (excluding accents and special chars) + */ + public static function randomAscii() + { + return chr(mt_rand(33, 126)); + } + + /** + * Returns randomly ordered subsequence of $count elements from a provided array + * + * @param array $array Array to take elements from. Defaults to a-f + * @param integer $count Number of elements to take. + * @param boolean $allowDuplicates Allow elements to be picked several times. Defaults to false + * @throws \LengthException When requesting more elements than provided + * + * @return array New array with $count elements from $array + */ + public static function randomElements($array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false) + { + $traversables = array(); + + if ($array instanceof \Traversable) { + foreach ($array as $element) { + $traversables[] = $element; + } + } + + $arr = count($traversables) ? $traversables : $array; + + $allKeys = array_keys($arr); + $numKeys = count($allKeys); + + if (!$allowDuplicates && $numKeys < $count) { + throw new \LengthException(sprintf('Cannot get %d elements, only %d in array', $count, $numKeys)); + } + + $highKey = $numKeys - 1; + $keys = $elements = array(); + $numElements = 0; + + while ($numElements < $count) { + $num = mt_rand(0, $highKey); + + if (!$allowDuplicates) { + if (isset($keys[$num])) { + continue; + } + $keys[$num] = true; + } + + $elements[] = $arr[$allKeys[$num]]; + $numElements++; + } + + return $elements; + } + + /** + * Returns a random element from a passed array + * + * @param array $array + * @return mixed + */ + public static function randomElement($array = array('a', 'b', 'c')) + { + if (!$array || ($array instanceof \Traversable && !count($array))) { + return null; + } + $elements = static::randomElements($array, 1); + + return $elements[0]; + } + + /** + * Returns a random key from a passed associative array + * + * @param array $array + * @return int|string|null + */ + public static function randomKey($array = array()) + { + if (!$array) { + return null; + } + $keys = array_keys($array); + $key = $keys[mt_rand(0, count($keys) - 1)]; + + return $key; + } + + /** + * Returns a shuffled version of the argument. + * + * This function accepts either an array, or a string. + * + * @example $faker->shuffle([1, 2, 3]); // [2, 1, 3] + * @example $faker->shuffle('hello, world'); // 'rlo,h eold!lw' + * + * @see shuffleArray() + * @see shuffleString() + * + * @param array|string $arg The set to shuffle + * @return array|string The shuffled set + */ + public static function shuffle($arg = '') + { + if (is_array($arg)) { + return static::shuffleArray($arg); + } + if (is_string($arg)) { + return static::shuffleString($arg); + } + throw new \InvalidArgumentException('shuffle() only supports strings or arrays'); + } + + /** + * Returns a shuffled version of the array. + * + * This function does not mutate the original array. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. + * + * @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleArray([1, 2, 3]); // [2, 1, 3] + * + * @param array $array The set to shuffle + * @return array The shuffled set + */ + public static function shuffleArray($array = array()) + { + $shuffledArray = array(); + $i = 0; + reset($array); + foreach ($array as $key => $value) { + if ($i == 0) { + $j = 0; + } else { + $j = mt_rand(0, $i); + } + if ($j == $i) { + $shuffledArray[]= $value; + } else { + $shuffledArray[]= $shuffledArray[$j]; + $shuffledArray[$j] = $value; + } + $i++; + } + return $shuffledArray; + } + + /** + * Returns a shuffled version of the string. + * + * This function does not mutate the original string. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. Additionally, it is + * UTF8 safe if the mb extension is available. + * + * @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleString('hello, world'); // 'rlo,h eold!lw' + * + * @param string $string The set to shuffle + * @param string $encoding The string encoding (defaults to UTF-8) + * @return string The shuffled set + */ + public static function shuffleString($string = '', $encoding = 'UTF-8') + { + if (function_exists('mb_strlen')) { + // UTF8-safe str_split() + $array = array(); + $strlen = mb_strlen($string, $encoding); + for ($i = 0; $i < $strlen; $i++) { + $array []= mb_substr($string, $i, 1, $encoding); + } + } else { + $array = str_split($string, 1); + } + return implode('', static::shuffleArray($array)); + } + + private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit') + { + if (($pos = strpos($string, $wildcard)) === false) { + return $string; + } + for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; $i++) { + if ($string[$i] === $wildcard) { + $string[$i] = call_user_func($callback); + } + } + return $string; + } + + /** + * Replaces all hash sign ('#') occurrences with a random number + * Replaces all percentage sign ('%') occurrences with a not null number + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function numerify($string = '###') + { + // instead of using randomDigit() several times, which is slow, + // count the number of hashes and generate once a large number + $toReplace = array(); + if (($pos = strpos($string, '#')) !== false) { + for ($i = $pos, $last = strrpos($string, '#', $pos) + 1; $i < $last; $i++) { + if ($string[$i] === '#') { + $toReplace[] = $i; + } + } + } + if ($nbReplacements = count($toReplace)) { + $maxAtOnce = strlen((string) mt_getrandmax()) - 1; + $numbers = ''; + $i = 0; + while ($i < $nbReplacements) { + $size = min($nbReplacements - $i, $maxAtOnce); + $numbers .= str_pad(static::randomNumber($size), $size, '0', STR_PAD_LEFT); + $i += $size; + } + for ($i = 0; $i < $nbReplacements; $i++) { + $string[$toReplace[$i]] = $numbers[$i]; + } + } + $string = self::replaceWildcard($string, '%', 'static::randomDigitNotNull'); + + return $string; + } + + /** + * Replaces all question mark ('?') occurrences with a random letter + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function lexify($string = '????') + { + return self::replaceWildcard($string, '?', 'static::randomLetter'); + } + + /** + * Replaces hash signs ('#') and question marks ('?') with random numbers and letters + * An asterisk ('*') is replaced with either a random number or a random letter + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function bothify($string = '## ??') + { + $string = self::replaceWildcard($string, '*', function () { + return mt_rand(0, 1) ? '#' : '?'; + }); + return static::lexify(static::numerify($string)); + } + + /** + * Replaces * signs with random numbers and letters and special characters + * + * @example $faker->asciify(''********'); // "s5'G!uC3" + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function asciify($string = '****') + { + return preg_replace_callback('/\*/u', 'static::randomAscii', $string); + } + + /** + * Transforms a basic regular expression into a random string satisfying the expression. + * + * @example $faker->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + * + * Regex delimiters '/.../' and begin/end markers '^...$' are ignored. + * + * Only supports a small subset of the regex syntax. For instance, + * unicode, negated classes, unbounded ranges, subpatterns, back references, + * assertions, recursive patterns, and comments are not supported. Escaping + * support is extremely fragile. + * + * This method is also VERY slow. Use it only when no other formatter + * can generate the fake data you want. For instance, prefer calling + * `$faker->email` rather than `regexify` with the previous regular + * expression. + * + * Also note than `bothify` can probably do most of what this method does, + * but much faster. For instance, for a dummy email generation, try + * `$faker->bothify('?????????@???.???')`. + * + * @see https://github.com/icomefromthenet/ReverseRegex for a more robust implementation + * + * @param string $regex A regular expression (delimiters are optional) + * @return string + */ + public static function regexify($regex = '') + { + // ditch the anchors + $regex = preg_replace('/^\/?\^?/', '', $regex); + $regex = preg_replace('/\$?\/?$/', '', $regex); + // All {2} become {2,2} + $regex = preg_replace('/\{(\d+)\}/', '{\1,\1}', $regex); + // Single-letter quantifiers (?, *, +) become bracket quantifiers ({0,1}, {0,rand}, {1, rand}) + $regex = preg_replace('/(? 0 && $weight < 1 && mt_rand() / mt_getrandmax() <= $weight) { + return $this->generator; + } + + // new system with percentage + if (is_int($weight) && mt_rand(1, 100) <= $weight) { + return $this->generator; + } + + return new DefaultGenerator($default); + } + + /** + * Chainable method for making any formatter unique. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param boolean $reset If set to true, resets the list of existing values + * @param integer $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return UniqueGenerator A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || !$this->unique) { + $this->unique = new UniqueGenerator($this->generator, $maxRetries); + } + + return $this->unique; + } + + /** + * Chainable method for forcing any formatter to return only valid values. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param Closure $validator A function returning true for valid values + * @param integer $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return ValidGenerator A proxy class returning only valid values + */ + public function valid($validator = null, $maxRetries = 10000) + { + return new ValidGenerator($this->generator, $validator, $maxRetries); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php b/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php new file mode 100644 index 0000000..b9e3f08 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php @@ -0,0 +1,64 @@ +generator->parse($format); + } + + /** + * @example 'Ltd' + */ + public static function companySuffix() + { + return static::randomElement(static::$companySuffix); + } + + /** + * @example 'Job' + */ + public function jobTitle() + { + $format = static::randomElement(static::$jobTitleFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php new file mode 100644 index 0000000..fb0f474 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php @@ -0,0 +1,340 @@ +getTimestamp(); + } + + return strtotime(empty($max) ? 'now' : $max); + } + + /** + * Get a timestamp between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return int + * + * @example 1061306726 + */ + public static function unixTime($max = 'now') + { + return mt_rand(0, static::getMaxTimestamp($max)); + } + + /** + * Get a datetime object for a date between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2005-08-16 20:39:21') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTime($max = 'now', $timezone = null) + { + return static::setTimezone( + new \DateTime('@' . static::unixTime($max)), + $timezone + ); + } + + /** + * Get a datetime object for a date between January 1, 001 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1265-03-22 21:15:52') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeAD($max = 'now', $timezone = null) + { + $min = (PHP_INT_SIZE>4 ? -62135597361 : -PHP_INT_MAX); + return static::setTimezone( + new \DateTime('@' . mt_rand($min, static::getMaxTimestamp($max))), + $timezone + ); + } + + /** + * get a date string formatted with ISO8601 + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2003-10-21T16:05:52+0000' + */ + public static function iso8601($max = 'now') + { + return static::date(\DateTime::ISO8601, $max); + } + + /** + * Get a date string between January 1, 1970 and now + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2008-11-27' + */ + public static function date($format = 'Y-m-d', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a time string (24h format by default) + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '15:02:34' + */ + public static function time($format = 'H:i:s', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a DateTime object based on a random date between two given dates. + * Accepts date strings that can be recognized by strtotime(). + * + * @param \DateTime|string $startDate Defaults to 30 years ago + * @param \DateTime|string $endDate Defaults to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1999-02-02 11:42:52') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) + { + $startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate); + $endTimestamp = static::getMaxTimestamp($endDate); + + if ($startTimestamp > $endTimestamp) { + throw new \InvalidArgumentException('Start date must be anterior to end date.'); + } + + $timestamp = mt_rand($startTimestamp, $endTimestamp); + + return static::setTimezone( + new \DateTime('@' . $timestamp), + $timezone + ); + } + + /** + * Get a DateTime object based on a random date between one given date and + * an interval + * Accepts date string that can be recognized by strtotime(). + * + * @param string $date Defaults to 30 years ago + * @param string $interval Defaults to 5 days after + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null) + { + $intervalObject = \DateInterval::createFromDateString($interval); + $datetime = $date instanceof \DateTime ? $date : new \DateTime($date); + $otherDatetime = clone $datetime; + $otherDatetime->add($intervalObject); + + $begin = $datetime > $otherDatetime ? $otherDatetime : $datetime; + $end = $datetime===$begin ? $otherDatetime : $datetime; + + return static::dateTimeBetween( + $begin, + $end, + $timezone + ); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1964-04-04 11:02:02') + * @return \DateTime + */ + public static function dateTimeThisCentury($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-100 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2010-03-10 05:18:58') + * @return \DateTime + */ + public static function dateTimeThisDecade($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-10 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2011-09-19 09:24:37') + * @return \DateTime + */ + public static function dateTimeThisYear($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2011-10-05 12:51:46') + * @return \DateTime + */ + public static function dateTimeThisMonth($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 month', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'am' + */ + public static function amPm($max = 'now') + { + return static::dateTime($max)->format('a'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '22' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('d'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'Tuesday' + */ + public static function dayOfWeek($max = 'now') + { + return static::dateTime($max)->format('l'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '7' + */ + public static function month($max = 'now') + { + return static::dateTime($max)->format('m'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'September' + */ + public static function monthName($max = 'now') + { + return static::dateTime($max)->format('F'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '1673' + */ + public static function year($max = 'now') + { + return static::dateTime($max)->format('Y'); + } + + /** + * @return string + * @example 'XVII' + */ + public static function century() + { + return static::randomElement(static::$century); + } + + /** + * @return string + * @example 'Europe/Paris' + */ + public static function timezone() + { + return static::randomElement(\DateTimeZone::listIdentifiers()); + } + + /** + * Internal method to set the time zone on a DateTime. + * + * @param \DateTime $dt + * @param string|null $timezone + * + * @return \DateTime + */ + private static function setTimezone(\DateTime $dt, $timezone) + { + return $dt->setTimezone(new \DateTimeZone(static::resolveTimezone($timezone))); + } + + /** + * Sets default time zone. + * + * @param string $timezone + * + * @return void + */ + public static function setDefaultTimezone($timezone = null) + { + static::$defaultTimezone = $timezone; + } + + /** + * Gets default time zone. + * + * @return string|null + */ + public static function getDefaultTimezone() + { + return static::$defaultTimezone; + } + + /** + * @param string|null $timezone + * @return null|string + */ + private static function resolveTimezone($timezone) + { + return ((null === $timezone) ? ((null === static::$defaultTimezone) ? date_default_timezone_get() : static::$defaultTimezone) : $timezone); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/File.php b/vendor/fzaninotto/faker/src/Faker/Provider/File.php new file mode 100644 index 0000000..ba01594 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/File.php @@ -0,0 +1,606 @@ + file extension(s) + * @link http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + protected static $mimeTypes = array( + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => array('doc', 'dot'), + 'application/octet-stream' => array( + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy' + ), + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => array('asc', 'sig'), + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => array('ai', 'eps', 'ps'), + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => array('uvf', 'uvvf', 'uvd', 'uvvd'), + 'application/vnd.dece.ttml+xml' => array('uvt', 'uvvt'), + 'application/vnd.dece.unspecified' => array('uvx', 'uvvx'), + 'application/vnd.dece.zip' => array('uvz', 'uvvz'), + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => array('seed', 'dataless'), + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => array('icc', 'icm'), + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => array('kpr', 'kpt'), + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => array('kwd', 'kwt'), + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => array('kne', 'knp'), + 'application/vnd.koan' => array('skp', 'skd', 'skt', 'skm'), + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => array( + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw' + ), + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => array('ppt', 'pps', 'pot'), + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => array('mpp', 'mpt'), + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => array('wps', 'wks', 'wcm', 'wdb'), + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => array( + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb' + ), + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => array('twd', 'twds'), + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => array('sus', 'susp'), + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => array('sis', 'sisx'), + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => array('pcap', 'cap', 'dmp'), + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => array('ufd', 'ufdl'), + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => array('vsd', 'vst', 'vss', 'vsw'), + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => array('blb', 'blorb'), + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => array('deb', 'udeb'), + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => array( + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa' + ), + 'application/x-font-ttf' => array('ttf', 'ttc'), + 'application/x-font-type1' => array('pfa', 'pfb', 'pfm', 'afm'), + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => array('lzh', 'lha'), + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => array('prc', 'mobi'), + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => array('exe', 'dll', 'com', 'bat', 'msi'), + 'application/x-msmediaview' => array( + 'mvb', + 'm13', + 'm14' + ), + 'application/x-msmetafile' => array('wmf', 'wmz', 'emf', 'emz'), + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => array('texinfo', 'texi'), + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => array('der', 'crt'), + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => array('xhtml', 'xht'), + 'application/xml' => array('xml', 'xsl'), + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => array('mxml', 'xhvml', 'xvml', 'xvm'), + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => array('au', 'snd'), + 'audio/midi' => array('mid', 'midi', 'kar', 'rmi'), + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => array( + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a' + ), + 'audio/ogg' => array('oga', 'ogg', 'spx'), + 'audio/vnd.dece.audio' => array('uva', 'uvva'), + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => array('aif', 'aiff', 'aifc'), + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => array('ram', 'ra'), + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => array('jpeg', 'jpg', 'jpe'), + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => array('svg', 'svgz'), + 'image/tiff' => array('tiff', 'tif'), + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => array('uvi', 'uvvi', 'uvg', 'uvvg'), + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => array('djvu', 'djv'), + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => array('fh', 'fhc', 'fh4', 'fh5', 'fh7'), + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => array('pic', 'pct'), + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => array('eml', 'mime'), + 'model/iges' => array('igs', 'iges'), + 'model/mesh' => array('msh', 'mesh', 'silo'), + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => array('wrl', 'vrml'), + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => array('ics', 'ifb'), + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => array('html', 'htm'), + 'text/n3' => 'n3', + 'text/plain' => array( + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in' + ), + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => array('sgml', 'sgm'), + 'text/tab-separated-values' => 'tsv', + 'text/troff' => array( + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms' + ), + 'text/turtle' => 'ttl', + 'text/uri-list' => array('uri', 'uris', 'urls'), + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => array('s', 'asm'), + 'text/x-fortran' => array('f', 'for', 'f77', 'f90'), + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => array('p', 'pas'), + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => array('jpm', 'jpgm'), + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => array('mpeg', 'mpg', 'mpe', 'm1v', 'm2v'), + 'video/ogg' => 'ogv', + 'video/quicktime' => array('qt', 'mov'), + 'video/vnd.dece.hd' => array('uvh', 'uvvh'), + 'video/vnd.dece.mobile' => array('uvm', 'uvvm'), + 'video/vnd.dece.pd' => array('uvp', 'uvvp'), + 'video/vnd.dece.sd' => array('uvs', 'uvvs'), + 'video/vnd.dece.video' => array('uvv', 'uvvv'), + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => array('mxu', 'm4u'), + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => array('uvu', 'uvvu'), + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => array('mkv', 'mk3d', 'mks'), + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => array('asf', 'asx'), + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ); + + /** + * Get a random MIME type + * + * @return string + * @example 'video/avi' + */ + public static function mimeType() + { + return static::randomElement(array_keys(static::$mimeTypes)); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + * @return string + */ + public static function fileExtension() + { + $random_extension = static::randomElement(array_values(static::$mimeTypes)); + + return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension; + } + + /** + * Copy a random file from the source directory to the target directory and returns the filename/fullpath + * + * @param string $sourceDirectory The directory to look for random file taking + * @param string $targetDirectory + * @param boolean $fullPath Whether to have the full path or just the filename + * @return string + */ + public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true) + { + if (!is_dir($sourceDirectory)) { + throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory)); + } + + if (!is_dir($targetDirectory)) { + throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory)); + } + + if ($sourceDirectory == $targetDirectory) { + throw new \InvalidArgumentException('Source and target directories must differ.'); + } + + // Drop . and .. and reset array keys + $files = array_filter(array_values(array_diff(scandir($sourceDirectory), array('.', '..'))), function ($file) use ($sourceDirectory) { + return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file); + }); + + if (empty($files)) { + throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory)); + } + + $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files); + + $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION); + $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile; + + if (false === copy($sourceFullPath, $destinationFullPath)) { + return false; + } + + return $fullPath ? $destinationFullPath : $destinationFile; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php b/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php new file mode 100644 index 0000000..b4b2ec1 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php @@ -0,0 +1,277 @@ +addProvider(new Lorem($generator)); + $generator->addProvider(new Internet($generator)); + } + + /** + * @param integer $maxDepth + * @param integer $maxWidth + * + * @return string + */ + public function randomHtml($maxDepth = 4, $maxWidth = 4) + { + $document = new \DOMDocument(); + $this->idGenerator = new UniqueGenerator($this->generator); + + $head = $document->createElement("head"); + $this->addRandomTitle($head); + + $body = $document->createElement("body"); + $this->addLoginForm($body); + $this->addRandomSubTree($body, $maxDepth, $maxWidth); + + $html = $document->createElement("html"); + $html->appendChild($head); + $html->appendChild($body); + + $document->appendChild($html); + return $document->saveHTML(); + } + + private function addRandomSubTree(\DOMElement $root, $maxDepth, $maxWidth) + { + $maxDepth--; + if ($maxDepth <= 0) { + return $root; + } + + $siblings = mt_rand(1, $maxWidth); + for ($i = 0; $i < $siblings; $i++) { + if ($maxDepth == 1) { + $this->addRandomLeaf($root); + } else { + $sibling = $root->ownerDocument->createElement("div"); + $root->appendChild($sibling); + $this->addRandomAttribute($sibling); + $this->addRandomSubTree($sibling, mt_rand(0, $maxDepth), $maxWidth); + } + }; + return $root; + } + + private function addRandomLeaf(\DOMElement $node) + { + $rand = mt_rand(1, 10); + switch($rand){ + case 1: + $this->addRandomP($node); + break; + case 2: + $this->addRandomA($node); + break; + case 3: + $this->addRandomSpan($node); + break; + case 4: + $this->addRandomUL($node); + break; + case 5: + $this->addRandomH($node); + break; + case 6: + $this->addRandomB($node); + break; + case 7: + $this->addRandomI($node); + break; + case 8: + $this->addRandomTable($node); + break; + default: + $this->addRandomText($node); + break; + } + } + + private function addRandomAttribute(\DOMElement $node) + { + $rand = mt_rand(1, 2); + switch ($rand) { + case 1: + $node->setAttribute("class", $this->generator->word); + break; + case 2: + $node->setAttribute("id", (string)$this->idGenerator->randomNumber(5)); + break; + } + } + + private function addRandomP(\DOMElement $element, $maxLength = 10) + { + + $node = $element->ownerDocument->createElement(static::P_TAG); + $node->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $element->appendChild($node); + } + + private function addRandomText(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $element->appendChild($text); + } + + private function addRandomA(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::A_TAG); + $node->setAttribute("href", $this->generator->safeEmailDomain); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomTitle(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::TITLE_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomH(\DOMElement $element, $maxLength = 10) + { + $h = static::H_TAG . (string)mt_rand(1, 3); + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement($h); + $node->appendChild($text); + $element->appendChild($node); + + } + + private function addRandomB(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::B_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomI(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::I_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomSpan(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::SPAN_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addLoginForm(\DOMElement $element) + { + + $textInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $textInput->setAttribute("type", "text"); + $textInput->setAttribute("id", "username"); + + $textLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $textLabel->setAttribute("for", "username"); + $textLabel->textContent = $this->generator->word; + + $passwordInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $passwordInput->setAttribute("type", "password"); + $passwordInput->setAttribute("id", "password"); + + $passwordLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $passwordLabel->setAttribute("for", "password"); + $passwordLabel->textContent = $this->generator->word; + + $submit = $element->ownerDocument->createElement(static::INPUT_TAG); + $submit->setAttribute("type", "submit"); + $submit->setAttribute("value", $this->generator->word); + + $submit = $element->ownerDocument->createElement(static::FORM_TAG); + $submit->setAttribute("action", $this->generator->safeEmailDomain); + $submit->setAttribute("method", "POST"); + $submit->appendChild($textLabel); + $submit->appendChild($textInput); + $submit->appendChild($passwordLabel); + $submit->appendChild($passwordInput); + $element->appendChild($submit); + } + + private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10) + { + $rows = mt_rand(1, $maxRows); + $cols = mt_rand(1, $maxCols); + + $table = $element->ownerDocument->createElement(static::TABLE_TAG); + $thead = $element->ownerDocument->createElement(static::THEAD_TAG); + $tbody = $element->ownerDocument->createElement(static::TBODY_TAG); + + $table->appendChild($thead); + $table->appendChild($tbody); + + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $thead->appendChild($tr); + for ($i = 0; $i < $cols; $i++) { + $th = $element->ownerDocument->createElement(static::TH_TAG); + $th->textContent = $this->generator->sentence(mt_rand(1, $maxTitle)); + $tr->appendChild($th); + } + for ($i = 0; $i < $rows; $i++) { + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $tbody->appendChild($tr); + for ($j = 0; $j < $cols; $j++) { + $th = $element->ownerDocument->createElement(static::TD_TAG); + $th->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $tr->appendChild($th); + } + } + $element->appendChild($table); + } + + private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4) + { + $num = mt_rand(1, $maxItems); + $ul = $element->ownerDocument->createElement(static::UL_TAG); + for ($i = 0; $i < $num; $i++) { + $li = $element->ownerDocument->createElement(static::LI_TAG); + $li->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $ul->appendChild($li); + } + $element->appendChild($ul); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Image.php b/vendor/fzaninotto/faker/src/Faker/Provider/Image.php new file mode 100644 index 0000000..0458ceb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Image.php @@ -0,0 +1,105 @@ +generator->parse($format); + } + + /** + * @example 'jdoe@example.com' + */ + final public function safeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain()); + } + + /** + * @example 'jdoe@gmail.com' + */ + public function freeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain()); + } + + /** + * @example 'jdoe@dawson.com' + */ + public function companyEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName()); + } + + /** + * @example 'gmail.com' + */ + public static function freeEmailDomain() + { + return static::randomElement(static::$freeEmailDomain); + } + + /** + * @example 'example.org' + */ + final public static function safeEmailDomain() + { + $domains = array( + 'example.com', + 'example.org', + 'example.net' + ); + + return static::randomElement($domains); + } + /** + * @example 'jdoe' + */ + public function userName() + { + $format = static::randomElement(static::$userNameFormats); + $username = static::bothify($this->generator->parse($format)); + + $username = strtolower(static::transliterate($username)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($username, '._') === '') { + throw new \Exception('userName failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dots from first/last names + $username = str_replace('..', '.', $username); + $username = rtrim($username, '.'); + + return $username; + } + /** + * @example 'fY4èHdZv68' + */ + public function password($minLength = 6, $maxLength = 20) + { + $pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength)); + + return $this->asciify($pattern); + } + + /** + * @example 'tiramisu.com' + */ + public function domainName() + { + return $this->domainWord() . '.' . $this->tld(); + } + + /** + * @example 'faber' + */ + public function domainWord() + { + $lastName = $this->generator->format('lastName'); + + $lastName = strtolower(static::transliterate($lastName)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($lastName, '._') === '') { + throw new \Exception('domainWord failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dot from last name + $lastName = rtrim($lastName, '.'); + + return $lastName; + } + + /** + * @example 'com' + */ + public function tld() + { + return static::randomElement(static::$tld); + } + + /** + * @example 'http://www.runolfsdottir.com/' + */ + public function url() + { + $format = static::randomElement(static::$urlFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + */ + public function slug($nbWords = 6, $variableNbWords = true) + { + if ($nbWords <= 0) { + return ''; + } + if ($variableNbWords) { + $nbWords = (int) ($nbWords * mt_rand(60, 140) / 100) + 1; + } + $words = $this->generator->words($nbWords); + + return join($words, '-'); + } + + /** + * @example '237.149.115.38' + */ + public function ipv4() + { + return long2ip(mt_rand(0, 1) == 0 ? mt_rand(-2147483648, -2) : mt_rand(16777216, 2147483647)); + } + + /** + * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1' + */ + public function ipv6() + { + $res = array(); + for ($i=0; $i < 8; $i++) { + $res []= dechex(mt_rand(0, "65535")); + } + + return join(':', $res); + } + + /** + * @example '10.1.1.17' + */ + public static function localIpv4() + { + if (static::numberBetween(0, 1) === 0) { + // 10.x.x.x range + return long2ip(static::numberBetween(ip2long("10.0.0.0"), ip2long("10.255.255.255"))); + } + + // 192.168.x.x range + return long2ip(static::numberBetween(ip2long("192.168.0.0"), ip2long("192.168.255.255"))); + } + + /** + * @example '32:F1:39:2F:D6:18' + */ + public static function macAddress() + { + for ($i=0; $i<6; $i++) { + $mac[] = sprintf('%02X', static::numberBetween(0, 0xff)); + } + $mac = implode(':', $mac); + + return $mac; + } + + protected static function transliterate($string) + { + if (0 === preg_match('/[^A-Za-z0-9_.]/', $string)) { + return $string; + } + + $transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;'; + if (class_exists('Transliterator') && $transliterator = \Transliterator::create($transId)) { + $transString = $transliterator->transliterate($string); + } else { + $transString = static::toAscii($string); + } + + return preg_replace('/[^A-Za-z0-9_.]/u', '', $transString); + } + + protected static function toAscii($string) + { + static $arrayFrom, $arrayTo; + + if (empty($arrayFrom)) { + $transliterationTable = array( + 'IJ'=>'I', 'Ö'=>'O', 'Œ'=>'O', 'Ü'=>'U', 'ä'=>'a', 'æ'=>'a', + 'ij'=>'i', 'ö'=>'o', 'œ'=>'o', 'ü'=>'u', 'ß'=>'s', 'ſ'=>'s', + 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', + 'Æ'=>'A', 'Ā'=>'A', 'Ą'=>'A', 'Ă'=>'A', 'Ç'=>'C', 'Ć'=>'C', + 'Č'=>'C', 'Ĉ'=>'C', 'Ċ'=>'C', 'Ď'=>'D', 'Đ'=>'D', 'È'=>'E', + 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ē'=>'E', 'Ę'=>'E', 'Ě'=>'E', + 'Ĕ'=>'E', 'Ė'=>'E', 'Ĝ'=>'G', 'Ğ'=>'G', 'Ġ'=>'G', 'Ģ'=>'G', + 'Ĥ'=>'H', 'Ħ'=>'H', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', + 'Ī'=>'I', 'Ĩ'=>'I', 'Ĭ'=>'I', 'Į'=>'I', 'İ'=>'I', 'Ĵ'=>'J', + 'Ķ'=>'K', 'Ľ'=>'K', 'Ĺ'=>'K', 'Ļ'=>'K', 'Ŀ'=>'K', 'Ł'=>'L', + 'Ñ'=>'N', 'Ń'=>'N', 'Ň'=>'N', 'Ņ'=>'N', 'Ŋ'=>'N', 'Ò'=>'O', + 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ø'=>'O', 'Ō'=>'O', 'Ő'=>'O', + 'Ŏ'=>'O', 'Ŕ'=>'R', 'Ř'=>'R', 'Ŗ'=>'R', 'Ś'=>'S', 'Ş'=>'S', + 'Ŝ'=>'S', 'Ș'=>'S', 'Š'=>'S', 'Ť'=>'T', 'Ţ'=>'T', 'Ŧ'=>'T', + 'Ț'=>'T', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ū'=>'U', 'Ů'=>'U', + 'Ű'=>'U', 'Ŭ'=>'U', 'Ũ'=>'U', 'Ų'=>'U', 'Ŵ'=>'W', 'Ŷ'=>'Y', + 'Ÿ'=>'Y', 'Ý'=>'Y', 'Ź'=>'Z', 'Ż'=>'Z', 'Ž'=>'Z', 'à'=>'a', + 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ā'=>'a', 'ą'=>'a', 'ă'=>'a', + 'å'=>'a', 'ç'=>'c', 'ć'=>'c', 'č'=>'c', 'ĉ'=>'c', 'ċ'=>'c', + 'ď'=>'d', 'đ'=>'d', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', + 'ē'=>'e', 'ę'=>'e', 'ě'=>'e', 'ĕ'=>'e', 'ė'=>'e', 'ƒ'=>'f', + 'ĝ'=>'g', 'ğ'=>'g', 'ġ'=>'g', 'ģ'=>'g', 'ĥ'=>'h', 'ħ'=>'h', + 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ī'=>'i', 'ĩ'=>'i', + 'ĭ'=>'i', 'į'=>'i', 'ı'=>'i', 'ĵ'=>'j', 'ķ'=>'k', 'ĸ'=>'k', + 'ł'=>'l', 'ľ'=>'l', 'ĺ'=>'l', 'ļ'=>'l', 'ŀ'=>'l', 'ñ'=>'n', + 'ń'=>'n', 'ň'=>'n', 'ņ'=>'n', 'ʼn'=>'n', 'ŋ'=>'n', 'ò'=>'o', + 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ø'=>'o', 'ō'=>'o', 'ő'=>'o', + 'ŏ'=>'o', 'ŕ'=>'r', 'ř'=>'r', 'ŗ'=>'r', 'ś'=>'s', 'š'=>'s', + 'ť'=>'t', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ū'=>'u', 'ů'=>'u', + 'ű'=>'u', 'ŭ'=>'u', 'ũ'=>'u', 'ų'=>'u', 'ŵ'=>'w', 'ÿ'=>'y', + 'ý'=>'y', 'ŷ'=>'y', 'ż'=>'z', 'ź'=>'z', 'ž'=>'z', 'Α'=>'A', + 'Ά'=>'A', 'Ἀ'=>'A', 'Ἁ'=>'A', 'Ἂ'=>'A', 'Ἃ'=>'A', 'Ἄ'=>'A', + 'Ἅ'=>'A', 'Ἆ'=>'A', 'Ἇ'=>'A', 'ᾈ'=>'A', 'ᾉ'=>'A', 'ᾊ'=>'A', + 'ᾋ'=>'A', 'ᾌ'=>'A', 'ᾍ'=>'A', 'ᾎ'=>'A', 'ᾏ'=>'A', 'Ᾰ'=>'A', + 'Ᾱ'=>'A', 'Ὰ'=>'A', 'ᾼ'=>'A', 'Β'=>'B', 'Γ'=>'G', 'Δ'=>'D', + 'Ε'=>'E', 'Έ'=>'E', 'Ἐ'=>'E', 'Ἑ'=>'E', 'Ἒ'=>'E', 'Ἓ'=>'E', + 'Ἔ'=>'E', 'Ἕ'=>'E', 'Ὲ'=>'E', 'Ζ'=>'Z', 'Η'=>'I', 'Ή'=>'I', + 'Ἠ'=>'I', 'Ἡ'=>'I', 'Ἢ'=>'I', 'Ἣ'=>'I', 'Ἤ'=>'I', 'Ἥ'=>'I', + 'Ἦ'=>'I', 'Ἧ'=>'I', 'ᾘ'=>'I', 'ᾙ'=>'I', 'ᾚ'=>'I', 'ᾛ'=>'I', + 'ᾜ'=>'I', 'ᾝ'=>'I', 'ᾞ'=>'I', 'ᾟ'=>'I', 'Ὴ'=>'I', 'ῌ'=>'I', + 'Θ'=>'T', 'Ι'=>'I', 'Ί'=>'I', 'Ϊ'=>'I', 'Ἰ'=>'I', 'Ἱ'=>'I', + 'Ἲ'=>'I', 'Ἳ'=>'I', 'Ἴ'=>'I', 'Ἵ'=>'I', 'Ἶ'=>'I', 'Ἷ'=>'I', + 'Ῐ'=>'I', 'Ῑ'=>'I', 'Ὶ'=>'I', 'Κ'=>'K', 'Λ'=>'L', 'Μ'=>'M', + 'Ν'=>'N', 'Ξ'=>'K', 'Ο'=>'O', 'Ό'=>'O', 'Ὀ'=>'O', 'Ὁ'=>'O', + 'Ὂ'=>'O', 'Ὃ'=>'O', 'Ὄ'=>'O', 'Ὅ'=>'O', 'Ὸ'=>'O', 'Π'=>'P', + 'Ρ'=>'R', 'Ῥ'=>'R', 'Σ'=>'S', 'Τ'=>'T', 'Υ'=>'Y', 'Ύ'=>'Y', + 'Ϋ'=>'Y', 'Ὑ'=>'Y', 'Ὓ'=>'Y', 'Ὕ'=>'Y', 'Ὗ'=>'Y', 'Ῠ'=>'Y', + 'Ῡ'=>'Y', 'Ὺ'=>'Y', 'Φ'=>'F', 'Χ'=>'X', 'Ψ'=>'P', 'Ω'=>'O', + 'Ώ'=>'O', 'Ὠ'=>'O', 'Ὡ'=>'O', 'Ὢ'=>'O', 'Ὣ'=>'O', 'Ὤ'=>'O', + 'Ὥ'=>'O', 'Ὦ'=>'O', 'Ὧ'=>'O', 'ᾨ'=>'O', 'ᾩ'=>'O', 'ᾪ'=>'O', + 'ᾫ'=>'O', 'ᾬ'=>'O', 'ᾭ'=>'O', 'ᾮ'=>'O', 'ᾯ'=>'O', 'Ὼ'=>'O', + 'ῼ'=>'O', 'α'=>'a', 'ά'=>'a', 'ἀ'=>'a', 'ἁ'=>'a', 'ἂ'=>'a', + 'ἃ'=>'a', 'ἄ'=>'a', 'ἅ'=>'a', 'ἆ'=>'a', 'ἇ'=>'a', 'ᾀ'=>'a', + 'ᾁ'=>'a', 'ᾂ'=>'a', 'ᾃ'=>'a', 'ᾄ'=>'a', 'ᾅ'=>'a', 'ᾆ'=>'a', + 'ᾇ'=>'a', 'ὰ'=>'a', 'ᾰ'=>'a', 'ᾱ'=>'a', 'ᾲ'=>'a', 'ᾳ'=>'a', + 'ᾴ'=>'a', 'ᾶ'=>'a', 'ᾷ'=>'a', 'β'=>'b', 'γ'=>'g', 'δ'=>'d', + 'ε'=>'e', 'έ'=>'e', 'ἐ'=>'e', 'ἑ'=>'e', 'ἒ'=>'e', 'ἓ'=>'e', + 'ἔ'=>'e', 'ἕ'=>'e', 'ὲ'=>'e', 'ζ'=>'z', 'η'=>'i', 'ή'=>'i', + 'ἠ'=>'i', 'ἡ'=>'i', 'ἢ'=>'i', 'ἣ'=>'i', 'ἤ'=>'i', 'ἥ'=>'i', + 'ἦ'=>'i', 'ἧ'=>'i', 'ᾐ'=>'i', 'ᾑ'=>'i', 'ᾒ'=>'i', 'ᾓ'=>'i', + 'ᾔ'=>'i', 'ᾕ'=>'i', 'ᾖ'=>'i', 'ᾗ'=>'i', 'ὴ'=>'i', 'ῂ'=>'i', + 'ῃ'=>'i', 'ῄ'=>'i', 'ῆ'=>'i', 'ῇ'=>'i', 'θ'=>'t', 'ι'=>'i', + 'ί'=>'i', 'ϊ'=>'i', 'ΐ'=>'i', 'ἰ'=>'i', 'ἱ'=>'i', 'ἲ'=>'i', + 'ἳ'=>'i', 'ἴ'=>'i', 'ἵ'=>'i', 'ἶ'=>'i', 'ἷ'=>'i', 'ὶ'=>'i', + 'ῐ'=>'i', 'ῑ'=>'i', 'ῒ'=>'i', 'ῖ'=>'i', 'ῗ'=>'i', 'κ'=>'k', + 'λ'=>'l', 'μ'=>'m', 'ν'=>'n', 'ξ'=>'k', 'ο'=>'o', 'ό'=>'o', + 'ὀ'=>'o', 'ὁ'=>'o', 'ὂ'=>'o', 'ὃ'=>'o', 'ὄ'=>'o', 'ὅ'=>'o', + 'ὸ'=>'o', 'π'=>'p', 'ρ'=>'r', 'ῤ'=>'r', 'ῥ'=>'r', 'σ'=>'s', + 'ς'=>'s', 'τ'=>'t', 'υ'=>'y', 'ύ'=>'y', 'ϋ'=>'y', 'ΰ'=>'y', + 'ὐ'=>'y', 'ὑ'=>'y', 'ὒ'=>'y', 'ὓ'=>'y', 'ὔ'=>'y', 'ὕ'=>'y', + 'ὖ'=>'y', 'ὗ'=>'y', 'ὺ'=>'y', 'ῠ'=>'y', 'ῡ'=>'y', 'ῢ'=>'y', + 'ῦ'=>'y', 'ῧ'=>'y', 'φ'=>'f', 'χ'=>'x', 'ψ'=>'p', 'ω'=>'o', + 'ώ'=>'o', 'ὠ'=>'o', 'ὡ'=>'o', 'ὢ'=>'o', 'ὣ'=>'o', 'ὤ'=>'o', + 'ὥ'=>'o', 'ὦ'=>'o', 'ὧ'=>'o', 'ᾠ'=>'o', 'ᾡ'=>'o', 'ᾢ'=>'o', + 'ᾣ'=>'o', 'ᾤ'=>'o', 'ᾥ'=>'o', 'ᾦ'=>'o', 'ᾧ'=>'o', 'ὼ'=>'o', + 'ῲ'=>'o', 'ῳ'=>'o', 'ῴ'=>'o', 'ῶ'=>'o', 'ῷ'=>'o', 'А'=>'A', + 'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ё'=>'E', + 'Ж'=>'Z', 'З'=>'Z', 'И'=>'I', 'Й'=>'I', 'К'=>'K', 'Л'=>'L', + 'М'=>'M', 'Н'=>'N', 'О'=>'O', 'П'=>'P', 'Р'=>'R', 'С'=>'S', + 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Х'=>'K', 'Ц'=>'T', 'Ч'=>'C', + 'Ш'=>'S', 'Щ'=>'S', 'Ы'=>'Y', 'Э'=>'E', 'Ю'=>'Y', 'Я'=>'Y', + 'а'=>'A', 'б'=>'B', 'в'=>'V', 'г'=>'G', 'д'=>'D', 'е'=>'E', + 'ё'=>'E', 'ж'=>'Z', 'з'=>'Z', 'и'=>'I', 'й'=>'I', 'к'=>'K', + 'л'=>'L', 'м'=>'M', 'н'=>'N', 'о'=>'O', 'п'=>'P', 'р'=>'R', + 'с'=>'S', 'т'=>'T', 'у'=>'U', 'ф'=>'F', 'х'=>'K', 'ц'=>'T', + 'ч'=>'C', 'ш'=>'S', 'щ'=>'S', 'ы'=>'Y', 'э'=>'E', 'ю'=>'Y', + 'я'=>'Y', 'ð'=>'d', 'Ð'=>'D', 'þ'=>'t', 'Þ'=>'T', 'ა'=>'a', + 'ბ'=>'b', 'გ'=>'g', 'დ'=>'d', 'ე'=>'e', 'ვ'=>'v', 'ზ'=>'z', + 'თ'=>'t', 'ი'=>'i', 'კ'=>'k', 'ლ'=>'l', 'მ'=>'m', 'ნ'=>'n', + 'ო'=>'o', 'პ'=>'p', 'ჟ'=>'z', 'რ'=>'r', 'ს'=>'s', 'ტ'=>'t', + 'უ'=>'u', 'ფ'=>'p', 'ქ'=>'k', 'ღ'=>'g', 'ყ'=>'q', 'შ'=>'s', + 'ჩ'=>'c', 'ც'=>'t', 'ძ'=>'d', 'წ'=>'t', 'ჭ'=>'c', 'ხ'=>'k', + 'ჯ'=>'j', 'ჰ'=>'h', 'ţ'=>'t', 'ʼ'=>"'", '̧'=>'', 'ḩ'=>'h', + '‘'=>"'", '’'=>"'", 'ừ'=>'u', '/'=>'', 'ế'=>'e', 'ả'=>'a', + 'ị'=>'i', 'ậ'=>'a', 'ệ'=>'e', 'ỉ'=>'i', 'ồ'=>'o', 'ề'=>'e', + 'ơ'=>'o', 'ạ'=>'a', 'ẵ'=>'a', 'ư'=>'u', 'ằ'=>'a', 'ầ'=>'a', + 'ḑ'=>'d', 'Ḩ'=>'H', 'Ḑ'=>'D', 'ș'=>'s', 'ț'=>'t', 'ộ'=>'o', + 'ắ'=>'a', 'ş'=>'s', "'"=>'', 'ու'=>'u', 'ա'=>'a', 'բ'=>'b', + 'գ'=>'g', 'դ'=>'d', 'ե'=>'e', 'զ'=>'z', 'է'=>'e', 'ը'=>'y', + 'թ'=>'t', 'ժ'=>'zh', 'ի'=>'i', 'լ'=>'l', 'խ'=>'kh', 'ծ'=>'ts', + 'կ'=>'k', 'հ'=>'h', 'ձ'=>'dz', 'ղ'=>'gh', 'ճ'=>'ch', 'մ'=>'m', + 'յ'=>'y', 'ն'=>'n', 'շ'=>'sh', 'ո'=>'o', 'չ'=>'ch', 'պ'=>'p', + 'ջ'=>'j', 'ռ'=>'r', 'ս'=>'s', 'վ'=>'v', 'տ'=>'t', 'ր'=>'r', + 'ց'=>'ts', 'փ'=>'p', 'ք'=>'q', 'և'=>'ev', 'օ'=>'o', 'ֆ'=>'f', + ); + $arrayFrom = array_keys($transliterationTable); + $arrayTo = array_values($transliterationTable); + } + + return str_replace($arrayFrom, $arrayTo, $string); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php b/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php new file mode 100644 index 0000000..6356ebf --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php @@ -0,0 +1,203 @@ + array( + "4539###########", + "4556###########", + "4916###########", + "4532###########", + "4929###########", + "40240071#######", + "4485###########", + "4716###########", + "4##############" + ), + 'Visa Retired' => array( + "4539########", + "4556########", + "4916########", + "4532########", + "4929########", + "40240071####", + "4485########", + "4716########", + "4###########", + ), + 'MasterCard' => array( + "2221###########", + "23#############", + "24#############", + "25#############", + "26#############", + "2720###########", + "51#############", + "52#############", + "53#############", + "54#############", + "55#############" + ), + 'American Express' => array( + "34############", + "37############" + ), + 'Discover Card' => array( + "6011###########" + ), + ); + + /** + * @var array list of IBAN formats, source: @link https://www.swift.com/standards/data-standards/iban + */ + protected static $ibanFormats = array( + 'AD' => array(array('n', 4), array('n', 4), array('c', 12)), + 'AE' => array(array('n', 3), array('n', 16)), + 'AL' => array(array('n', 8), array('c', 16)), + 'AT' => array(array('n', 5), array('n', 11)), + 'AZ' => array(array('a', 4), array('c', 20)), + 'BA' => array(array('n', 3), array('n', 3), array('n', 8), array('n', 2)), + 'BE' => array(array('n', 3), array('n', 7), array('n', 2)), + 'BG' => array(array('a', 4), array('n', 4), array('n', 2), array('c', 8)), + 'BH' => array(array('a', 4), array('c', 14)), + 'BR' => array(array('n', 8), array('n', 5), array('n', 10), array('a', 1), array('c', 1)), + 'CH' => array(array('n', 5), array('c', 12)), + 'CR' => array(array('n', 3), array('n', 14)), + 'CY' => array(array('n', 3), array('n', 5), array('c', 16)), + 'CZ' => array(array('n', 4), array('n', 6), array('n', 10)), + 'DE' => array(array('n', 8), array('n', 10)), + 'DK' => array(array('n', 4), array('n', 9), array('n', 1)), + 'DO' => array(array('c', 4), array('n', 20)), + 'EE' => array(array('n', 2), array('n', 2), array('n', 11), array('n', 1)), + 'ES' => array(array('n', 4), array('n', 4), array('n', 1), array('n', 1), array('n', 10)), + 'FI' => array(array('n', 6), array('n', 7), array('n', 1)), + 'FR' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)), + 'GB' => array(array('a', 4), array('n', 6), array('n', 8)), + 'GE' => array(array('a', 2), array('n', 16)), + 'GI' => array(array('a', 4), array('c', 15)), + 'GR' => array(array('n', 3), array('n', 4), array('c', 16)), + 'GT' => array(array('c', 4), array('c', 20)), + 'HR' => array(array('n', 7), array('n', 10)), + 'HU' => array(array('n', 3), array('n', 4), array('n', 1), array('n', 15), array('n', 1)), + 'IE' => array(array('a', 4), array('n', 6), array('n', 8)), + 'IL' => array(array('n', 3), array('n', 3), array('n', 13)), + 'IS' => array(array('n', 4), array('n', 2), array('n', 6), array('n', 10)), + 'IT' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)), + 'KW' => array(array('a', 4), array('n', 22)), + 'KZ' => array(array('n', 3), array('c', 13)), + 'LB' => array(array('n', 4), array('c', 20)), + 'LI' => array(array('n', 5), array('c', 12)), + 'LT' => array(array('n', 5), array('n', 11)), + 'LU' => array(array('n', 3), array('c', 13)), + 'LV' => array(array('a', 4), array('c', 13)), + 'MC' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)), + 'MD' => array(array('c', 2), array('c', 18)), + 'ME' => array(array('n', 3), array('n', 13), array('n', 2)), + 'MK' => array(array('n', 3), array('c', 10), array('n', 2)), + 'MR' => array(array('n', 5), array('n', 5), array('n', 11), array('n', 2)), + 'MT' => array(array('a', 4), array('n', 5), array('c', 18)), + 'MU' => array(array('a', 4), array('n', 2), array('n', 2), array('n', 12), array('n', 3), array('a', 3)), + 'NL' => array(array('a', 4), array('n', 10)), + 'NO' => array(array('n', 4), array('n', 6), array('n', 1)), + 'PK' => array(array('a', 4), array('c', 16)), + 'PL' => array(array('n', 8), array('n', 16)), + 'PS' => array(array('a', 4), array('c', 21)), + 'PT' => array(array('n', 4), array('n', 4), array('n', 11), array('n', 2)), + 'RO' => array(array('a', 4), array('c', 16)), + 'RS' => array(array('n', 3), array('n', 13), array('n', 2)), + 'SA' => array(array('n', 2), array('c', 18)), + 'SE' => array(array('n', 3), array('n', 16), array('n', 1)), + 'SI' => array(array('n', 5), array('n', 8), array('n', 2)), + 'SK' => array(array('n', 4), array('n', 6), array('n', 10)), + 'SM' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)), + 'TN' => array(array('n', 2), array('n', 3), array('n', 13), array('n', 2)), + 'TR' => array(array('n', 5), array('n', 1), array('c', 16)), + 'VG' => array(array('a', 4), array('n', 16)), + ); + + /** + * @return string Returns a credit card vendor name + * + * @example 'MasterCard' + */ + public static function creditCardType() + { + return static::randomElement(static::$cardVendors); + } + + /** + * Returns the String of a credit card number. + * + * @param string $type Supporting any of 'Visa', 'MasterCard', 'American Express', and 'Discover' + * @param boolean $formatted Set to true if the output string should contain one separator every 4 digits + * @param string $separator Separator string for formatting card number. Defaults to dash (-). + * @return string + * + * @example '4485480221084675' + */ + public static function creditCardNumber($type = null, $formatted = false, $separator = '-') + { + if (is_null($type)) { + $type = static::creditCardType(); + } + $mask = static::randomElement(static::$cardParams[$type]); + + $number = static::numerify($mask); + $number .= Luhn::computeCheckDigit($number); + + if ($formatted) { + $p1 = substr($number, 0, 4); + $p2 = substr($number, 4, 4); + $p3 = substr($number, 8, 4); + $p4 = substr($number, 12); + $number = $p1 . $separator . $p2 . $separator . $p3 . $separator . $p4; + } + + return $number; + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @return \DateTime + * @example 04/13 + */ + public function creditCardExpirationDate($valid = true) + { + if ($valid) { + return $this->generator->dateTimeBetween('now', '36 months'); + } + + return $this->generator->dateTimeBetween('-36 months', '36 months'); + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @param string $expirationDateFormat + * @return string + * @example '04/13' + */ + public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null) + { + return $this->creditCardExpirationDate($valid)->format(is_null($expirationDateFormat) ? static::$expirationDateFormat : $expirationDateFormat); + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @return array + */ + public function creditCardDetails($valid = true) + { + $type = static::creditCardType(); + + return array( + 'type' => $type, + 'number' => static::creditCardNumber($type), + 'name' => $this->generator->name(), + 'expirationDate' => $this->creditCardExpirationDateString($valid) + ); + } + + /** + * International Bank Account Number (IBAN) + * + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param string $prefix for generating bank account number of a specific bank + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function iban($countryCode = null, $prefix = '', $length = null) + { + $countryCode = is_null($countryCode) ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode); + + $format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode]; + if ($length === null) { + if ($format === null) { + $length = 24; + } else { + $length = 0; + foreach ($format as $part) { + list($class, $groupCount) = $part; + $length += $groupCount; + } + } + } + if ($format === null) { + $format = array(array('n', $length)); + } + + $expandedFormat = ''; + foreach ($format as $item) { + list($class, $length) = $item; + $expandedFormat .= str_repeat($class, $length); + } + + $result = $prefix; + $expandedFormat = substr($expandedFormat, strlen($result)); + foreach (str_split($expandedFormat) as $class) { + switch ($class) { + default: + case 'c': + $result .= mt_rand(0, 100) <= 50 ? static::randomDigit() : strtoupper(static::randomLetter()); + break; + case 'a': + $result .= strtoupper(static::randomLetter()); + break; + case 'n': + $result .= static::randomDigit(); + break; + } + } + + $checksum = Iban::checksum($countryCode . '00' . $result); + + return $countryCode . $checksum . $result; + } + + /** + * Return the String of a SWIFT/BIC number + * + * @example 'RZTIAT22263' + * @link http://en.wikipedia.org/wiki/ISO_9362 + * @return string Swift/Bic number + */ + public static function swiftBicNumber() + { + return self::regexify("^([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?$"); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/Person.php new file mode 100644 index 0000000..9d875b6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Person.php @@ -0,0 +1,126 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @return string + * @example 'John' + */ + public function firstName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::firstNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstNameFormat)); + } + + public static function firstNameMale() + { + return static::randomElement(static::$firstNameMale); + } + + public static function firstNameFemale() + { + return static::randomElement(static::$firstNameFemale); + } + + /** + * @example 'Doe' + * @return string + */ + public function lastName() + { + return static::randomElement(static::$lastName); + } + + /** + * @example 'Mrs.' + * @param string|null $gender 'male', 'female' or null for any + * @return string + */ + public function title($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::titleMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::titleFemale(); + } + + return $this->generator->parse(static::randomElement(static::$titleFormat)); + } + + /** + * @example 'Mr.' + */ + public static function titleMale() + { + return static::randomElement(static::$titleMale); + } + + /** + * @example 'Mrs.' + */ + public static function titleFemale() + { + return static::randomElement(static::$titleFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php new file mode 100644 index 0000000..d9d1f6b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php @@ -0,0 +1,43 @@ +generator->parse(static::randomElement(static::$formats))); + } + + /** + * @example +27113456789 + * @return string + */ + public function e164PhoneNumber() + { + $formats = array('+%############'); + return static::numerify($this->generator->parse(static::randomElement($formats))); + } + + /** + * International Mobile Equipment Identity (IMEI) + * + * @link http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity + * @link http://imei-number.com/imei-validation-check/ + * @example '720084494799532' + * @return int $imei + */ + public function imei() + { + $imei = (string) static::numerify('##############'); + $imei .= Luhn::computeCheckDigit($imei); + return $imei; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/Text.php new file mode 100644 index 0000000..db8c800 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Text.php @@ -0,0 +1,141 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = array(); + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = static::explode($next); + $currentWords[] = $word; + array_shift($currentWords); + $next = static::implode($currentWords); + + // ensure text starts with an uppercase letter + if ($resultLength == 0 && !static::validStart($word)) { + continue; + } + + // append the element + $result[] = $word; + $resultLength += static::strlen($word) + static::$separatorLen; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = static::implode($result); + + return static::appendEnd($result); + } + + protected function getConsecutiveWords($indexSize) + { + if (!isset($this->consecutiveWords[$indexSize])) { + $parts = $this->getExplodedText(); + $words = array(); + $index = array(); + for ($i = 0; $i < $indexSize; $i++) { + $index[] = array_shift($parts); + } + + for ($i = 0, $count = count($parts); $i < $count; $i++) { + $stringIndex = static::implode($index); + if (!isset($words[$stringIndex])) { + $words[$stringIndex] = array(); + } + $word = $parts[$i]; + $words[$stringIndex][] = $word; + array_shift($index); + $index[] = $word; + } + // cache look up words for performance + $this->consecutiveWords[$indexSize] = $words; + } + + return $this->consecutiveWords[$indexSize]; + } + + protected function getExplodedText() + { + if ($this->explodedText === null) { + $this->explodedText = static::explode(preg_replace('/\s+/u', ' ', static::$baseText)); + } + + return $this->explodedText; + } + + protected static function explode($text) + { + return explode(static::$separator, $text); + } + + protected static function implode($words) + { + return implode(static::$separator, $words); + } + + protected static function strlen($text) + { + return function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text); + } + + protected static function validStart($word) + { + $isValid = true; + if (static::$textStartsWithUppercase) { + $isValid = preg_match('/^\p{Lu}/u', $word); + } + return $isValid; + } + + protected static function appendEnd($text) + { + return preg_replace("/([ ,-:;\x{2013}\x{2014}]+$)/us", '', $text).'.'; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php b/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php new file mode 100644 index 0000000..d659f4b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php @@ -0,0 +1,165 @@ +> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + $uuid = sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15] + ); + + return $uuid; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php new file mode 100644 index 0000000..6f4f258 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php @@ -0,0 +1,152 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php new file mode 100644 index 0000000..7fcadb3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php @@ -0,0 +1,108 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php new file mode 100644 index 0000000..d69b5d6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php @@ -0,0 +1,19 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php new file mode 100644 index 0000000..e5ec042 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->parse($format)); + } + + /** + * Generates valid czech IČO + * + * @see http://phpfashion.com/jak-overit-platne-ic-a-rodne-cislo + * @return string + */ + public function ico() + { + $ico = static::numerify('#######'); + $split = str_split($ico); + $prod = 0; + foreach (array(8, 7, 6, 5, 4, 3, 2) as $i => $p) { + $prod += $p * $split[$i]; + } + $mod = $prod % 11; + if ($mod === 0 || $mod === 10) { + return "{$ico}1"; + } elseif ($mod === 1) { + return "{$ico}0"; + } + + return $ico . (11 - $mod); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php new file mode 100644 index 0000000..4bd1508 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php @@ -0,0 +1,61 @@ +format('w')]; + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('j'); + } + + /** + * Full date with inflected month + * @return string + * @example '16. listopadu 2003' + */ + public function formattedDate() + { + $format = static::randomElement(static::$formattedDateFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php new file mode 100644 index 0000000..d0d993d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php @@ -0,0 +1,9 @@ +generator->boolean() ? static::GENDER_MALE : static::GENDER_FEMALE; + } + + $startTimestamp = strtotime("-${maxAge} year"); + $endTimestamp = strtotime("-${minAge} year"); + $randTimestamp = static::numberBetween($startTimestamp, $endTimestamp); + + $year = intval(date('Y', $randTimestamp)); + $month = intval(date('n', $randTimestamp)); + $day = intval(date('j', $randTimestamp)); + $suffix = static::numberBetween(0, 999); + + // women has +50 to month + if ($gender == static::GENDER_FEMALE) { + $month += 50; + } + // from year 2004 everyone has +20 to month when birth numbers in one day are exhausted + if ($year >= 2004 && $this->generator->boolean(10)) { + $month += 20; + } + + $birthNumber = sprintf('%02d%02d%02d%03d', $year % 100, $month, $day, $suffix); + + // from year 1954 birth number includes CRC + if ($year >= 1954) { + $crc = intval($birthNumber, 10) % 11; + if ($crc == 10) { + $crc = 0; + } + $birthNumber .= sprintf('%d', $crc); + } + + // add slash + if ($this->generator->boolean($slashProbability)) { + $birthNumber = substr($birthNumber, 0, 6) . '/' . substr($birthNumber, 6); + } + + return $birthNumber; + } + + public static function birthNumberMale() + { + return static::birthNumber(static::GENDER_MALE); + } + + public static function birthNumberFemale() + { + return static::birthNumber(static::GENDER_FEMALE); + } + + public function title($gender = null) + { + return static::titleMale(); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleFemale() + { + return static::titleMale(); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @example 'Albrecht' + */ + public function lastName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::lastNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::lastNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php new file mode 100644 index 0000000..49ab429 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php @@ -0,0 +1,14 @@ + + */ +class Address extends \Faker\Provider\Address +{ + /** + * @var array Danish city suffixes. + */ + protected static $citySuffix = array( + 'sted', 'bjerg', 'borg', 'rød', 'lund', 'by', + ); + + /** + * @var array Danish street suffixes. + */ + protected static $streetSuffix = array( + 'vej', 'gade', 'skov', 'shaven', + ); + + /** + * @var array Danish street word suffixes. + */ + protected static $streetSuffixWord = array( + 'Vej', 'Gade', 'Allé', 'Boulevard', 'Plads', 'Have', + ); + + /** + * @var array Danish building numbers. + */ + protected static $buildingNumber = array( + '%##', '%#', '%#', '%', '%', '%', '%?', '% ?', + ); + + /** + * @var array Danish building level. + */ + protected static $buildingLevel = array( + 'st.', '%.', '%. sal.', + ); + + /** + * @var array Danish building sides. + */ + protected static $buildingSide = array( + 'tv.', 'th.', + ); + + /** + * @var array Danish zip code. + */ + protected static $postcode = array( + '%###' + ); + + /** + * @var array Danish cities. + */ + protected static $cityNames = array( + 'Aabenraa', 'Aabybro', 'Aakirkeby', 'Aalborg', 'Aalestrup', 'Aars', 'Aarup', 'Agedrup', 'Agerbæk', 'Agerskov', + 'Albertslund', 'Allerød', 'Allinge', 'Allingåbro', 'Almind', 'Anholt', 'Ansager', 'Arden', 'Asaa', 'Askeby', + 'Asnæs', 'Asperup', 'Assens', 'Augustenborg', 'Aulum', 'Auning', 'Bagenkop', 'Bagsværd', 'Balle', 'Ballerup', + 'Bandholm', 'Barrit', 'Beder', 'Bedsted', 'Bevtoft', 'Billum', 'Billund', 'Bindslev', 'Birkerød', 'Bjerringbro', + 'Bjert', 'Bjæverskov', 'Blokhus', 'Blommenslyst', 'Blåvand', 'Boeslunde', 'Bogense', 'Bogø', 'Bolderslev', 'Bording', + 'Borre', 'Borup', 'Brøndby', 'Brabrand', 'Bramming', 'Brande', 'Branderup', 'Bredebro', 'Bredsten', 'Brenderup', + 'Broager', 'Broby', 'Brovst', 'Bryrup', 'Brædstrup', 'Strand', 'Brønderslev', 'Brønshøj', 'Brørup', 'Bække', + 'Bækmarksbro', 'Bælum', 'Børkop', 'Bøvlingbjerg', 'Charlottenlund', 'Christiansfeld', 'Dalby', 'Dalmose', + 'Dannemare', 'Daugård', 'Dianalund', 'Dragør', 'Dronninglund', 'Dronningmølle', 'Dybvad', 'Dyssegård', 'Ebberup', + 'Ebeltoft', 'Egernsund', 'Egtved', 'Egå', 'Ejby', 'Ejstrupholm', 'Engesvang', 'Errindlev', 'Erslev', 'Esbjerg', + 'Eskebjerg', 'Eskilstrup', 'Espergærde', 'Faaborg', 'Fanø', 'Farsø', 'Farum', 'Faxe', 'Ladeplads', 'Fejø', + 'Ferritslev', 'Fjenneslev', 'Fjerritslev', 'Flemming', 'Fredensborg', 'Fredericia', 'Frederiksberg', + 'Frederikshavn', 'Frederikssund', 'Frederiksværk', 'Frørup', 'Frøstrup', 'Fuglebjerg', 'Føllenslev', 'Føvling', + 'Fårevejle', 'Fårup', 'Fårvang', 'Gadbjerg', 'Gadstrup', 'Galten', 'Gandrup', 'Gedser', 'Gedsted', 'Gedved', 'Gelsted', + 'Gentofte', 'Gesten', 'Gilleleje', 'Gislev', 'Gislinge', 'Gistrup', 'Give', 'Gjerlev', 'Gjern', 'Glamsbjerg', + 'Glejbjerg', 'Glesborg', 'Glostrup', 'Glumsø', 'Gram', 'Gredstedbro', 'Grenaa', 'Greve', 'Grevinge', 'Grindsted', + 'Græsted', 'Gråsten', 'Gudbjerg', 'Sydfyn', 'Gudhjem', 'Gudme', 'Guldborg', 'Gørding', 'Gørlev', 'Gørløse', + 'Haderslev', 'Haderup', 'Hadsten', 'Hadsund', 'Hals', 'Hammel', 'Hampen', 'Hanstholm', 'Harboøre', 'Harlev', 'Harndrup', + 'Harpelunde', 'Hasle', 'Haslev', 'Hasselager', 'Havdrup', 'Havndal', 'Hedehusene', 'Hedensted', 'Hejls', 'Hejnsvig', + 'Hellebæk', 'Hellerup', 'Helsinge', 'Helsingør', 'Hemmet', 'Henne', 'Herfølge', 'Herlev', 'Herlufmagle', 'Herning', + 'Hesselager', 'Hillerød', 'Hinnerup', 'Hirtshals', 'Hjallerup', 'Hjerm', 'Hjortshøj', 'Hjørring', 'Hobro', 'Holbæk', + 'Holeby', 'Holmegaard', 'Holstebro', 'Holsted', 'Holte', 'Horbelev', 'Hornbæk', 'Hornslet', 'Hornsyld', 'Horsens', + 'Horslunde', 'Hovborg', 'Hovedgård', 'Humble', 'Humlebæk', 'Hundested', 'Hundslund', 'Hurup', 'Hvalsø', 'Hvide', + 'Sande', 'Hvidovre', 'Højbjerg', 'Højby', 'Højer', 'Højslev', 'Høng', 'Hørning', 'Hørsholm', 'Hørve', 'Hårlev', + 'Idestrup', 'Ikast', 'Ishøj', 'Janderup', 'Vestj', 'Jelling', 'Jerslev', 'Sjælland', 'Jerup', 'Jordrup', 'Juelsminde', + 'Jyderup', 'Jyllinge', 'Jystrup', 'Midtsj', 'Jægerspris', 'Kalundborg', 'Kalvehave', 'Karby', 'Karise', 'Karlslunde', + 'Karrebæksminde', 'Karup', 'Kastrup', 'Kerteminde', 'Kettinge', 'Kibæk', 'Kirke', 'Hyllinge', 'Såby', 'Kjellerup', + 'Klampenborg', 'Klarup', 'Klemensker', 'Klippinge', 'Klovborg', 'Knebel', 'Kokkedal', 'Kolding', 'Kolind', 'Kongens', + 'Lyngby', 'Kongerslev', 'Korsør', 'Kruså', 'Kvistgård', 'Kværndrup', 'København', 'Køge', 'Langebæk', 'Langeskov', + 'Langå', 'Lejre', 'Lemming', 'Lemvig', 'Lille', 'Skensved', 'Lintrup', 'Liseleje', 'Lundby', 'Lunderskov', 'Lynge', + 'Lystrup', 'Læsø', 'Løgstrup', 'Løgstør', 'Løgumkloster', 'Løkken', 'Løsning', 'Låsby', 'Malling', 'Mariager', + 'Maribo', 'Marslev', 'Marstal', 'Martofte', 'Melby', 'Mern', 'Mesinge', 'Middelfart', 'Millinge', 'Morud', 'Munke', + 'Bjergby', 'Munkebo', 'Møldrup', 'Mørke', 'Mørkøv', 'Måløv', 'Mårslet', 'Nakskov', 'Nexø', 'Nibe', 'Nimtofte', + 'Nordborg', 'Nyborg', 'Nykøbing', 'Nyrup', 'Nysted', 'Nærum', 'Næstved', 'Nørager', 'Nørre', 'Aaby', 'Alslev', + 'Asmindrup', 'Nebel', 'Snede', 'Nørreballe', 'Nørresundby', 'Odder', 'Odense', 'Oksbøl', 'Otterup', 'Oure', 'Outrup', + 'Padborg', 'Pandrup', 'Præstø', 'Randbøl', 'Randers', 'Ranum', 'Rask', 'Mølle', 'Redsted', 'Regstrup', 'Ribe', 'Ringe', + 'Ringkøbing', 'Ringsted', 'Risskov', 'Roskilde', 'Roslev', 'Rude', 'Rudkøbing', 'Ruds', 'Vedby', 'Rungsted', 'Kyst', + 'Rynkeby', 'Ryomgård', 'Ryslinge', 'Rødby', 'Rødding', 'Rødekro', 'Rødkærsbro', 'Rødovre', 'Rødvig', 'Stevns', + 'Rønde', 'Rønne', 'Rønnede', 'Rørvig', 'Sabro', 'Sakskøbing', 'Saltum', 'Samsø', 'Sandved', 'Sejerø', 'Silkeborg', + 'Sindal', 'Sjællands', 'Odde', 'Sjølund', 'Skagen', 'Skals', 'Skamby', 'Skanderborg', 'Skibby', 'Skive', 'Skjern', + 'Skodsborg', 'Skovlunde', 'Skælskør', 'Skærbæk', 'Skævinge', 'Skødstrup', 'Skørping', 'Skårup', 'Slagelse', + 'Slangerup', 'Smørum', 'Snedsted', 'Snekkersten', 'Snertinge', 'Solbjerg', 'Solrød', 'Sommersted', 'Sorring', 'Sorø', + 'Spentrup', 'Spjald', 'Sporup', 'Spøttrup', 'Stakroge', 'Stege', 'Stenderup', 'Stenlille', 'Stenløse', 'Stenstrup', + 'Stensved', 'Stoholm', 'Jyll', 'Stokkemarke', 'Store', 'Fuglede', 'Heddinge', 'Merløse', 'Storvorde', 'Stouby', + 'Strandby', 'Struer', 'Strøby', 'Stubbekøbing', 'Støvring', 'Suldrup', 'Sulsted', 'Sunds', 'Svaneke', 'Svebølle', + 'Svendborg', 'Svenstrup', 'Svinninge', 'Sydals', 'Sæby', 'Søborg', 'Søby', 'Ærø', 'Søllested', 'Sønder', 'Felding', + 'Sønderborg', 'Søndersø', 'Sørvad', 'Taastrup', 'Tappernøje', 'Tarm', 'Terndrup', 'Them', 'Thisted', 'Thorsø', + 'Thyborøn', 'Thyholm', 'Tikøb', 'Tilst', 'Tinglev', 'Tistrup', 'Tisvildeleje', 'Tjele', 'Tjæreborg', 'Toftlund', + 'Tommerup', 'Toreby', 'Torrig', 'Tranbjerg', 'Tranekær', 'Trige', 'Trustrup', 'Tune', 'Tureby', 'Tylstrup', 'Tølløse', + 'Tønder', 'Tørring', 'Tårs', 'Ugerløse', 'Uldum', 'Ulfborg', 'Ullerslev', 'Ulstrup', 'Vadum', 'Valby', 'Vallensbæk', + 'Vamdrup', 'Vandel', 'Vanløse', 'Varde', 'Vedbæk', 'Veflinge', 'Vejby', 'Vejen', 'Vejers', 'Vejle', 'Vejstrup', + 'Veksø', 'Vemb', 'Vemmelev', 'Vesløs', 'Vestbjerg', 'Vester', 'Skerninge', 'Vesterborg', 'Vestervig', 'Viborg', 'Viby', + 'Videbæk', 'Vildbjerg', 'Vils', 'Vinderup', 'Vipperød', 'Virum', 'Vissenbjerg', 'Viuf', 'Vodskov', 'Vojens', 'Vonge', + 'Vorbasse', 'Vordingborg', 'Væggerløse', 'Værløse', 'Ærøskøbing', 'Ølgod', 'Ølsted', 'Ølstykke', 'Ørbæk', + 'Ørnhøj', 'Ørsted', 'Djurs', 'Østbirk', 'Øster', 'Assels', 'Ulslev', 'Østermarie', 'Østervrå', 'Åbyhøj', + 'Ålbæk', 'Ålsgårde', 'Århus', 'Årre', 'Årslev', 'Haarby', 'Nivå', 'Rømø', 'Omme', 'Vrå', 'Ørum', + ); + + /** + * @var array Danish municipalities, called 'kommuner' in danish. + */ + protected static $kommuneNames = array( + 'København', 'Frederiksberg', 'Ballerup', 'Brøndby', 'Dragør', 'Gentofte', 'Gladsaxe', 'Glostrup', 'Herlev', + 'Albertslund', 'Hvidovre', 'Høje Taastrup', 'Lyngby-Taarbæk', 'Rødovre', 'Ishøj', 'Tårnby', 'Vallensbæk', + 'Allerød', 'Fredensborg', 'Helsingør', 'Hillerød', 'Hørsholm', 'Rudersdal', 'Egedal', 'Frederikssund', 'Greve', + 'Halsnæs', 'Roskilde', 'Solrød', 'Gribskov', 'Odsherred', 'Holbæk', 'Faxe', 'Kalundborg', 'Ringsted', 'Slagelse', + 'Stevns', 'Sorø', 'Lejre', 'Lolland', 'Næstved', 'Guldborgsund', 'Vordingborg', 'Bornholm', 'Middelfart', + 'Christiansø', 'Assens', 'Faaborg-Midtfyn', 'Kerteminde', 'Nyborg', 'Odense', 'Svendborg', 'Nordfyns', 'Langeland', + 'Ærø', 'Haderslev', 'Billund', 'Sønderborg', 'Tønder', 'Esbjerg', 'Fanø', 'Varde', 'Vejen', 'Aabenraa', + 'Fredericia', 'Horsens', 'Kolding', 'Vejle', 'Herning', 'Holstebro', 'Lemvig', 'Struer', 'Syddjurs', 'Furesø', + 'Norddjurs', 'Favrskov', 'Odder', 'Randers', 'Silkeborg', 'Samsø', 'Skanderborg', 'Aarhus', 'Ikast-Brande', + 'Ringkøbing-Skjern', 'Hedensted', 'Morsø', 'Skive', 'Thisted', 'Viborg', 'Brønderslev', 'Frederikshavn', + 'Vesthimmerlands', 'Læsø', 'Rebild', 'Mariagerfjord', 'Jammerbugt', 'Aalborg', 'Hjørring', 'Køge', + ); + + /** + * @var array Danish regions. + */ + protected static $regionNames = array( + 'Region Nordjylland', 'Region Midtjylland', 'Region Syddanmark', 'Region Hovedstaden', 'Region Sjælland', + ); + + /** + * @link https://github.com/umpirsky/country-list/blob/master/country/cldr/da_DK/country.php + * + * @var array Some countries in danish. + */ + protected static $country = array( + 'Andorra', 'Forenede Arabiske Emirater', 'Afghanistan', 'Antigua og Barbuda', 'Anguilla', 'Albanien', 'Armenien', + 'Hollandske Antiller', 'Angola', 'Antarktis', 'Argentina', 'Amerikansk Samoa', 'Østrig', 'Australien', 'Aruba', + 'Åland', 'Aserbajdsjan', 'Bosnien-Hercegovina', 'Barbados', 'Bangladesh', 'Belgien', 'Burkina Faso', 'Bulgarien', + 'Bahrain', 'Burundi', 'Benin', 'Saint Barthélemy', 'Bermuda', 'Brunei Darussalam', 'Bolivia', 'Brasilien', 'Bahamas', + 'Bhutan', 'Bouvetø', 'Botswana', 'Hviderusland', 'Belize', 'Canada', 'Cocosøerne', 'Congo-Kinshasa', + 'Centralafrikanske Republik', 'Congo', 'Schweiz', 'Elfenbenskysten', 'Cook-øerne', 'Chile', 'Cameroun', 'Kina', + 'Colombia', 'Costa Rica', 'Serbien og Montenegro', 'Cuba', 'Kap Verde', 'Juleøen', 'Cypern', 'Tjekkiet', 'Tyskland', + 'Djibouti', 'Danmark', 'Dominica', 'Den Dominikanske Republik', 'Algeriet', 'Ecuador', 'Estland', 'Egypten', + 'Vestsahara', 'Eritrea', 'Spanien', 'Etiopien', 'Finland', 'Fiji-øerne', 'Falklandsøerne', + 'Mikronesiens Forenede Stater', 'Færøerne', 'Frankrig', 'Gabon', 'Storbritannien', 'Grenada', 'Georgien', + 'Fransk Guyana', 'Guernsey', 'Ghana', 'Gibraltar', 'Grønland', 'Gambia', 'Guinea', 'Guadeloupe', 'Ækvatorialguinea', + 'Grækenland', 'South Georgia og De Sydlige Sandwichøer', 'Guatemala', 'Guam', 'Guinea-Bissau', 'Guyana', + 'SAR Hongkong', 'Heard- og McDonald-øerne', 'Honduras', 'Kroatien', 'Haiti', 'Ungarn', 'Indonesien', 'Irland', + 'Israel', 'Isle of Man', 'Indien', 'Det Britiske Territorium i Det Indiske Ocean', 'Irak', 'Iran', 'Island', + 'Italien', 'Jersey', 'Jamaica', 'Jordan', 'Japan', 'Kenya', 'Kirgisistan', 'Cambodja', 'Kiribati', 'Comorerne', + 'Saint Kitts og Nevis', 'Nordkorea', 'Sydkorea', 'Kuwait', 'Caymanøerne', 'Kasakhstan', 'Laos', 'Libanon', + 'Saint Lucia', 'Liechtenstein', 'Sri Lanka', 'Liberia', 'Lesotho', 'Litauen', 'Luxembourg', 'Letland', 'Libyen', + 'Marokko', 'Monaco', 'Republikken Moldova', 'Montenegro', 'Saint Martin', 'Madagaskar', 'Marshalløerne', + 'Republikken Makedonien', 'Mali', 'Myanmar', 'Mongoliet', 'SAR Macao', 'Nordmarianerne', 'Martinique', + 'Mauretanien', 'Montserrat', 'Malta', 'Mauritius', 'Maldiverne', 'Malawi', 'Mexico', 'Malaysia', 'Mozambique', + 'Namibia', 'Ny Caledonien', 'Niger', 'Norfolk Island', 'Nigeria', 'Nicaragua', 'Holland', 'Norge', 'Nepal', 'Nauru', + 'Niue', 'New Zealand', 'Oman', 'Panama', 'Peru', 'Fransk Polynesien', 'Papua Ny Guinea', 'Filippinerne', 'Pakistan', + 'Polen', 'Saint Pierre og Miquelon', 'Pitcairn', 'Puerto Rico', 'De palæstinensiske områder', 'Portugal', 'Palau', + 'Paraguay', 'Qatar', 'Reunion', 'Rumænien', 'Serbien', 'Rusland', 'Rwanda', 'Saudi-Arabien', 'Salomonøerne', + 'Seychellerne', 'Sudan', 'Sverige', 'Singapore', 'St. Helena', 'Slovenien', 'Svalbard og Jan Mayen', 'Slovakiet', + 'Sierra Leone', 'San Marino', 'Senegal', 'Somalia', 'Surinam', 'Sao Tome og Principe', 'El Salvador', 'Syrien', + 'Swaziland', 'Turks- og Caicosøerne', 'Tchad', 'Franske Besiddelser i Det Sydlige Indiske Ocean', 'Togo', + 'Thailand', 'Tadsjikistan', 'Tokelau', 'Timor-Leste', 'Turkmenistan', 'Tunesien', 'Tonga', 'Tyrkiet', + 'Trinidad og Tobago', 'Tuvalu', 'Taiwan', 'Tanzania', 'Ukraine', 'Uganda', 'De Mindre Amerikanske Oversøiske Øer', + 'USA', 'Uruguay', 'Usbekistan', 'Vatikanstaten', 'St. Vincent og Grenadinerne', 'Venezuela', + 'De britiske jomfruøer', 'De amerikanske jomfruøer', 'Vietnam', 'Vanuatu', 'Wallis og Futunaøerne', 'Samoa', + 'Yemen', 'Mayotte', 'Sydafrika', 'Zambia', 'Zimbabwe', + ); + + /** + * @var array Danish city format. + */ + protected static $cityFormats = array( + '{{cityName}}', + ); + + /** + * @var array Danish street's name formats. + */ + protected static $streetNameFormats = array( + '{{lastName}}{{streetSuffix}}', + '{{middleName}}{{streetSuffix}}', + '{{lastName}} {{streetSuffixWord}}', + '{{middleName}} {{streetSuffixWord}}', + ); + + /** + * @var array Danish street's address formats. + */ + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + '{{streetName}} {{buildingNumber}}, {{buildingLevel}}', + '{{streetName}} {{buildingNumber}}, {{buildingLevel}} {{buildingSide}}', + ); + + /** + * @var array Danish address format. + */ + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Randomly return a real city name. + * + * @return string + */ + public static function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Randomly return a suffix word. + * + * @return string + */ + public static function streetSuffixWord() + { + return static::randomElement(static::$streetSuffixWord); + } + + /** + * Randomly return a building number. + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::bothify(static::randomElement(static::$buildingNumber))); + } + + /** + * Randomly return a building level. + * + * @return string + */ + public static function buildingLevel() + { + return static::numerify(static::randomElement(static::$buildingLevel)); + } + + /** + * Randomly return a side of the building. + * + * @return string + */ + public static function buildingSide() + { + return static::randomElement(static::$buildingSide); + } + + /** + * Randomly return a real municipality name, called 'kommune' in danish. + * + * @return string + */ + public static function kommune() + { + return static::randomElement(static::$kommuneNames); + } + + /** + * Randomly return a real region name. + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regionNames); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php new file mode 100644 index 0000000..b9f289c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php @@ -0,0 +1,70 @@ + + */ +class Company extends \Faker\Provider\Company +{ + /** + * @var array Danish company name formats. + */ + protected static $formats = array( + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{firstname}} {{lastName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{firstname}} {{middleName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{middleName}} & {{middleName}} {{companySuffix}}', + '{{middleName}} og {{middleName}} {{companySuffix}}', + '{{middleName}} & {{lastName}}', + '{{middleName}} og {{lastName}}', + ); + + /** + * @var array Company suffixes. + */ + protected static $companySuffix = array('ApS', 'A/S', 'I/S', 'K/S'); + + /** + * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60 + * + * @var string CVR number format. + */ + protected static $cvrFormat = '%#######'; + + /** + * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60 + * + * @var string P number (production number) format. + */ + protected static $pFormat = '%#########'; + + /** + * Generates a CVR number (8 digits). + * + * @return string + */ + public static function cvr() + { + return static::numerify(static::$cvrFormat); + } + + /** + * Generates a P entity number (10 digits). + * + * @return string + */ + public static function p() + { + return static::numerify(static::$pFormat); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php new file mode 100644 index 0000000..1f778de --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php @@ -0,0 +1,30 @@ + + */ +class Internet extends \Faker\Provider\Internet +{ + /** + * @var array Some safe email TLD. + */ + protected static $safeEmailTld = array( + 'org', 'com', 'net', 'dk', 'dk', 'dk', + ); + + /** + * @var array Some email domains in Denmark. + */ + protected static $freeEmailDomain = array( + 'gmail.com', 'yahoo.com', 'yahoo.dk', 'hotmail.com', 'hotmail.dk', 'mail.dk', 'live.dk' + ); + + /** + * @var array Some TLD. + */ + protected static $tld = array( + 'com', 'com', 'com', 'biz', 'info', 'net', 'org', 'dk', 'dk', 'dk', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php new file mode 100644 index 0000000..6a5b6a8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php @@ -0,0 +1,19 @@ + + */ +class Person extends \Faker\Provider\Person +{ + /** + * @var array Danish person name formats. + */ + protected static $maleNameFormats = array( + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}}-{{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{middleName}}-{{lastName}}', + ); + + protected static $femaleNameFormats = array( + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}}-{{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{middleName}}-{{lastName}}', + ); + + /** + * @var array Danish first names. + */ + protected static $firstNameMale = array( + 'Aage', 'Adam', 'Adolf', 'Ahmad', 'Ahmed', 'Aksel', 'Albert', 'Alex', 'Alexander', 'Alf', 'Alfred', 'Ali', 'Allan', + 'Anders', 'Andreas', 'Anker', 'Anton', 'Arne', 'Arnold', 'Arthur', 'Asbjørn', 'Asger', 'August', 'Axel', 'Benjamin', + 'Benny', 'Bent', 'Bernhard', 'Birger', 'Bjarne', 'Bjørn', 'Bo', 'Brian', 'Bruno', 'Børge', 'Carl', 'Carlo', + 'Carsten', 'Casper', 'Charles', 'Chris', 'Christian', 'Christoffer', 'Christopher', 'Claus', 'Dan', 'Daniel', 'David', 'Dennis', + 'Ebbe', 'Edmund', 'Edvard', 'Egon', 'Einar', 'Ejvind', 'Elias', 'Emanuel', 'Emil', 'Erik', 'Erland', 'Erling', + 'Ernst', 'Esben', 'Ferdinand', 'Finn', 'Flemming', 'Frank', 'Freddy', 'Frederik', 'Frits', 'Fritz', 'Frode', 'Georg', + 'Gerhard', 'Gert', 'Gunnar', 'Gustav', 'Hans', 'Harald', 'Harry', 'Hassan', 'Heine', 'Heinrich', 'Helge', 'Helmer', + 'Helmuth', 'Henning', 'Henrik', 'Henry', 'Herman', 'Hermann', 'Holger', 'Hugo', 'Ib', 'Ibrahim', 'Ivan', 'Jack', + 'Jacob', 'Jakob', 'Jan', 'Janne', 'Jens', 'Jeppe', 'Jesper', 'Jimmi', 'Jimmy', 'Joachim', 'Johan', 'Johannes', + 'John', 'Johnny', 'Jon', 'Jonas', 'Jonathan', 'Josef', 'Jul', 'Julius', 'Jørgen', 'Jørn', 'Kai', 'Kaj', + 'Karl', 'Karlo', 'Karsten', 'Kasper', 'Kenneth', 'Kent', 'Kevin', 'Kjeld', 'Klaus', 'Knud', 'Kristian', 'Kristoffer', + 'Kurt', 'Lars', 'Lasse', 'Leif', 'Lennart', 'Leo', 'Leon', 'Louis', 'Lucas', 'Lukas', 'Mads', 'Magnus', + 'Malthe', 'Marc', 'Marcus', 'Marinus', 'Marius', 'Mark', 'Markus', 'Martin', 'Martinus', 'Mathias', 'Max', 'Michael', + 'Mikael', 'Mike', 'Mikkel', 'Mogens', 'Mohamad', 'Mohamed', 'Mohammad', 'Morten', 'Nick', 'Nicklas', 'Nicolai', 'Nicolaj', + 'Niels', 'Niklas', 'Nikolaj', 'Nils', 'Olaf', 'Olav', 'Ole', 'Oliver', 'Oscar', 'Oskar', 'Otto', 'Ove', + 'Palle', 'Patrick', 'Paul', 'Peder', 'Per', 'Peter', 'Philip', 'Poul', 'Preben', 'Rasmus', 'Rene', 'René', + 'Richard', 'Robert', 'Rolf', 'Rudolf', 'Rune', 'Sebastian', 'Sigurd', 'Simon', 'Simone', 'Steen', 'Stefan', 'Steffen', + 'Sten', 'Stig', 'Sune', 'Sven', 'Svend', 'Søren', 'Tage', 'Theodor', 'Thomas', 'Thor', 'Thorvald', 'Tim', + 'Tobias', 'Tom', 'Tommy', 'Tonny', 'Torben', 'Troels', 'Uffe', 'Ulrik', 'Vagn', 'Vagner', 'Valdemar', 'Vang', + 'Verner', 'Victor', 'Viktor', 'Villy', 'Walther', 'Werner', 'Wilhelm', 'William', 'Willy', 'Åge', 'Bendt', 'Bjarke', + 'Chr', 'Eigil', 'Ejgil', 'Ejler', 'Ejnar', 'Ejner', 'Evald', 'Folmer', 'Gunner', 'Gurli', 'Hartvig', 'Herluf', 'Hjalmar', + 'Ingemann', 'Ingolf', 'Ingvard', 'Keld', 'Kresten', 'Laurids', 'Laurits', 'Lauritz', 'Ludvig', 'Lynge', 'Oluf', 'Osvald', + 'Povl', 'Richardt', 'Sigfred', 'Sofus', 'Thorkild', 'Viggo', 'Vilhelm', 'Villiam', + ); + + protected static $firstNameFemale = array( + 'Aase', 'Agathe', 'Agnes', 'Alberte', 'Alexandra', 'Alice', 'Alma', 'Amalie', 'Amanda', 'Andrea', 'Ane', 'Anette', 'Anita', + 'Anja', 'Ann', 'Anna', 'Annalise', 'Anne', 'Anne-Lise', 'Anne-Marie', 'Anne-Mette', 'Annelise', 'Annette', 'Anni', 'Annie', + 'Annika', 'Anny', 'Asta', 'Astrid', 'Augusta', 'Benedikte', 'Bente', 'Berit', 'Bertha', 'Betina', 'Bettina', 'Betty', + 'Birgit', 'Birgitte', 'Birte', 'Birthe', 'Bitten', 'Bodil', 'Britt', 'Britta', 'Camilla', 'Carina', 'Carla', 'Caroline', + 'Cathrine', 'Cecilie', 'Charlotte', 'Christa', 'Christen', 'Christiane', 'Christina', 'Christine', 'Clara', 'Conni', 'Connie', 'Conny', + 'Dagmar', 'Dagny', 'Diana', 'Ditte', 'Dora', 'Doris', 'Dorte', 'Dorthe', 'Ebba', 'Edel', 'Edith', 'Eleonora', + 'Eli', 'Elin', 'Eline', 'Elinor', 'Elisa', 'Elisabeth', 'Elise', 'Ella', 'Ellen', 'Ellinor', 'Elly', 'Elna', + 'Elsa', 'Else', 'Elsebeth', 'Elvira', 'Emilie', 'Emma', 'Emmy', 'Erna', 'Ester', 'Esther', 'Eva', 'Evelyn', + 'Frede', 'Frederikke', 'Freja', 'Frida', 'Gerda', 'Gertrud', 'Gitte', 'Grete', 'Grethe', 'Gudrun', 'Hanna', 'Hanne', + 'Hardy', 'Harriet', 'Hedvig', 'Heidi', 'Helen', 'Helena', 'Helene', 'Helga', 'Helle', 'Henny', 'Henriette', 'Herdis', + 'Hilda', 'Iben', 'Ida', 'Ilse', 'Ina', 'Inga', 'Inge', 'Ingeborg', 'Ingelise', 'Inger', 'Ingrid', 'Irene', + 'Iris', 'Irma', 'Isabella', 'Jane', 'Janni', 'Jannie', 'Jeanette', 'Jeanne', 'Jenny', 'Jes', 'Jette', 'Joan', + 'Johanna', 'Johanne', 'Jonna', 'Josefine', 'Josephine', 'Juliane', 'Julie', 'Jytte', 'Kaja', 'Kamilla', 'Karen', 'Karin', + 'Karina', 'Karla', 'Karoline', 'Kate', 'Kathrine', 'Katja', 'Katrine', 'Ketty', 'Kim', 'Kirsten', 'Kirstine', 'Klara', + 'Krista', 'Kristen', 'Kristina', 'Kristine', 'Laila', 'Laura', 'Laurine', 'Lea', 'Lena', 'Lene', 'Lilian', 'Lilli', + 'Lillian', 'Lilly', 'Linda', 'Line', 'Lis', 'Lisa', 'Lisbet', 'Lisbeth', 'Lise', 'Liselotte', 'Lissi', 'Lissy', + 'Liv', 'Lizzie', 'Lone', 'Lotte', 'Louise', 'Lydia', 'Lykke', 'Lærke', 'Magda', 'Magdalene', 'Mai', 'Maiken', + 'Maj', 'Maja', 'Majbritt', 'Malene', 'Maren', 'Margit', 'Margrethe', 'Maria', 'Mariane', 'Marianne', 'Marie', 'Marlene', + 'Martha', 'Martine', 'Mary', 'Mathilde', 'Matilde', 'Merete', 'Merethe', 'Meta', 'Mette', 'Mia', 'Michelle', 'Mie', + 'Mille', 'Minna', 'Mona', 'Monica', 'Nadia', 'Nancy', 'Nanna', 'Nicoline', 'Nikoline', 'Nina', 'Ninna', 'Oda', + 'Olga', 'Olivia', 'Orla', 'Paula', 'Pauline', 'Pernille', 'Petra', 'Pia', 'Poula', 'Ragnhild', 'Randi', 'Rasmine', + 'Rebecca', 'Rebekka', 'Rigmor', 'Rikke', 'Rita', 'Rosa', 'Rose', 'Ruth', 'Sabrina', 'Sandra', 'Sanne', 'Sara', + 'Sarah', 'Selma', 'Severin', 'Sidsel', 'Signe', 'Sigrid', 'Sine', 'Sofia', 'Sofie', 'Solveig', 'Solvejg', 'Sonja', + 'Sophie', 'Stephanie', 'Stine', 'Susan', 'Susanne', 'Tanja', 'Thea', 'Theodora', 'Therese', 'Thi', 'Thyra', 'Tina', + 'Tine', 'Tove', 'Trine', 'Ulla', 'Vera', 'Vibeke', 'Victoria', 'Viktoria', 'Viola', 'Vita', 'Vivi', 'Vivian', + 'Winnie', 'Yrsa', 'Yvonne', 'Agnete', 'Agnethe', 'Alfrida', 'Alvilda', 'Anine', 'Bolette', 'Dorthea', 'Gunhild', + 'Hansine', 'Inge-Lise', 'Jensine', 'Juel', 'Jørgine', 'Kamma', 'Kristiane', 'Maj-Britt', 'Margrete', 'Metha', 'Nielsine', + 'Oline', 'Petrea', 'Petrine', 'Pouline', 'Ragna', 'Sørine', 'Thora', 'Valborg', 'Vilhelmine', + ); + + /** + * @var array Danish middle names. + */ + protected static $middleName = array( + 'Møller', 'Lund', 'Holm', 'Jensen', 'Juul', 'Nielsen', 'Kjær', 'Hansen', 'Skov', 'Østergaard', 'Vestergaard', + 'Nørgaard', 'Dahl', 'Bach', 'Friis', 'Søndergaard', 'Andersen', 'Bech', 'Pedersen', 'Bruun', 'Nygaard', 'Winther', + 'Bang', 'Krogh', 'Schmidt', 'Christensen', 'Hedegaard', 'Toft', 'Damgaard', 'Holst', 'Sørensen', 'Juhl', 'Munk', + 'Skovgaard', 'Søgaard', 'Aagaard', 'Berg', 'Dam', 'Petersen', 'Lind', 'Overgaard', 'Brandt', 'Larsen', 'Bak', 'Schou', + 'Vinther', 'Bjerregaard', 'Riis', 'Bundgaard', 'Kruse', 'Mølgaard', 'Hjorth', 'Ravn', 'Madsen', 'Rasmussen', + 'Jørgensen', 'Kristensen', 'Bonde', 'Bay', 'Hougaard', 'Dalsgaard', 'Kjærgaard', 'Haugaard', 'Munch', 'Bjerre', 'Due', + 'Sloth', 'Leth', 'Kofoed', 'Thomsen', 'Kragh', 'Højgaard', 'Dalgaard', 'Hjort', 'Kirkegaard', 'Bøgh', 'Beck', 'Nissen', + 'Rask', 'Høj', 'Brix', 'Storm', 'Buch', 'Bisgaard', 'Birch', 'Gade', 'Kjærsgaard', 'Hald', 'Lindberg', 'Høgh', 'Falk', + 'Koch', 'Thorup', 'Borup', 'Knudsen', 'Vedel', 'Poulsen', 'Bøgelund', 'Juel', 'Frost', 'Hvid', 'Bjerg', 'Bæk', 'Elkjær', + 'Hartmann', 'Kirk', 'Sand', 'Sommer', 'Skou', 'Nedergaard', 'Meldgaard', 'Brink', 'Lindegaard', 'Fischer', 'Rye', + 'Hoffmann', 'Daugaard', 'Gram', 'Johansen', 'Meyer', 'Schultz', 'Fogh', 'Bloch', 'Lundgaard', 'Brøndum', 'Jessen', + 'Busk', 'Holmgaard', 'Lindholm', 'Krog', 'Egelund', 'Engelbrecht', 'Buus', 'Korsgaard', 'Ellegaard', 'Tang', 'Steen', + 'Kvist', 'Olsen', 'Nørregaard', 'Fuglsang', 'Wulff', 'Damsgaard', 'Hauge', 'Sonne', 'Skytte', 'Brun', 'Kronborg', + 'Abildgaard', 'Fabricius', 'Bille', 'Skaarup', 'Rahbek', 'Borg', 'Torp', 'Klitgaard', 'Nørskov', 'Greve', 'Hviid', + 'Mørch', 'Buhl', 'Rohde', 'Mørk', 'Vendelbo', 'Bjørn', 'Laursen', 'Egede', 'Rytter', 'Lehmann', 'Guldberg', 'Rosendahl', + 'Krarup', 'Krogsgaard', 'Westergaard', 'Rosendal', 'Fisker', 'Højer', 'Rosenberg', 'Svane', 'Storgaard', 'Pihl', + 'Mohamed', 'Bülow', 'Birk', 'Hammer', 'Bro', 'Kaas', 'Clausen', 'Nymann', 'Egholm', 'Ingemann', 'Haahr', 'Olesen', + 'Nøhr', 'Brinch', 'Bjerring', 'Christiansen', 'Schrøder', 'Guldager', 'Skjødt', 'Højlund', 'Ørum', 'Weber', + 'Bødker', 'Bruhn', 'Stampe', 'Astrup', 'Schack', 'Mikkelsen', 'Høyer', 'Husted', 'Skriver', 'Lindgaard', 'Yde', + 'Sylvest', 'Lykkegaard', 'Ploug', 'Gammelgaard', 'Pilgaard', 'Brogaard', 'Degn', 'Kaae', 'Kofod', 'Grønbæk', + 'Lundsgaard', 'Bagge', 'Lyng', 'Rømer', 'Kjeldgaard', 'Hovgaard', 'Groth', 'Hyldgaard', 'Ladefoged', 'Jacobsen', + 'Linde', 'Lange', 'Stokholm', 'Bredahl', 'Hein', 'Mose', 'Bækgaard', 'Sandberg', 'Klarskov', 'Kamp', 'Green', + 'Iversen', 'Riber', 'Smedegaard', 'Nyholm', 'Vad', 'Balle', 'Kjeldsen', 'Strøm', 'Borch', 'Lerche', 'Grønlund', + 'Vestergård', 'Østergård', 'Nyborg', 'Qvist', 'Damkjær', 'Kold', 'Sønderskov', 'Bank', + ); + + /** + * @var array Danish last names. + */ + protected static $lastName = array( + 'Jensen', 'Nielsen', 'Hansen', 'Pedersen', 'Andersen', 'Christensen', 'Larsen', 'Sørensen', 'Rasmussen', 'Petersen', + 'Jørgensen', 'Madsen', 'Kristensen', 'Olsen', 'Christiansen', 'Thomsen', 'Poulsen', 'Johansen', 'Knudsen', 'Mortensen', + 'Møller', 'Jacobsen', 'Jakobsen', 'Olesen', 'Frederiksen', 'Mikkelsen', 'Henriksen', 'Laursen', 'Lund', 'Schmidt', + 'Eriksen', 'Holm', 'Kristiansen', 'Clausen', 'Simonsen', 'Svendsen', 'Andreasen', 'Iversen', 'Jeppesen', 'Mogensen', + 'Jespersen', 'Nissen', 'Lauridsen', 'Frandsen', 'Østergaard', 'Jepsen', 'Kjær', 'Carlsen', 'Vestergaard', 'Jessen', + 'Nørgaard', 'Dahl', 'Christoffersen', 'Skov', 'Søndergaard', 'Bertelsen', 'Bruun', 'Lassen', 'Bach', 'Gregersen', + 'Friis', 'Johnsen', 'Steffensen', 'Kjeldsen', 'Bech', 'Krogh', 'Lauritsen', 'Danielsen', 'Mathiesen', 'Andresen', + 'Brandt', 'Winther', 'Toft', 'Ravn', 'Mathiasen', 'Dam', 'Holst', 'Nilsson', 'Lind', 'Berg', 'Schou', 'Overgaard', + 'Kristoffersen', 'Schultz', 'Klausen', 'Karlsen', 'Paulsen', 'Hermansen', 'Thorsen', 'Koch', 'Thygesen', 'Bak', 'Kruse', + 'Bang', 'Juhl', 'Davidsen', 'Berthelsen', 'Nygaard', 'Lorentzen', 'Villadsen', 'Lorenzen', 'Damgaard', 'Bjerregaard', + 'Lange', 'Hedegaard', 'Bendtsen', 'Lauritzen', 'Svensson', 'Justesen', 'Juul', 'Hald', 'Beck', 'Kofoed', 'Søgaard', + 'Meyer', 'Kjærgaard', 'Riis', 'Johannsen', 'Carstensen', 'Bonde', 'Ibsen', 'Fischer', 'Andersson', 'Bundgaard', + 'Johannesen', 'Eskildsen', 'Hemmingsen', 'Andreassen', 'Thomassen', 'Schrøder', 'Persson', 'Hjorth', 'Enevoldsen', + 'Nguyen', 'Henningsen', 'Jønsson', 'Olsson', 'Asmussen', 'Michelsen', 'Vinther', 'Markussen', 'Kragh', 'Thøgersen', + 'Johansson', 'Dalsgaard', 'Gade', 'Bjerre', 'Ali', 'Laustsen', 'Buch', 'Ludvigsen', 'Hougaard', 'Kirkegaard', 'Marcussen', + 'Mølgaard', 'Ipsen', 'Sommer', 'Ottosen', 'Müller', 'Krog', 'Hoffmann', 'Clemmensen', 'Nikolajsen', 'Brodersen', + 'Therkildsen', 'Leth', 'Michaelsen', 'Graversen', 'Frost', 'Dalgaard', 'Albertsen', 'Laugesen', 'Due', 'Ebbesen', + 'Munch', 'Svenningsen', 'Ottesen', 'Fisker', 'Albrechtsen', 'Axelsen', 'Erichsen', 'Sloth', 'Bentsen', 'Westergaard', + 'Bisgaard', 'Nicolaisen', 'Magnussen', 'Thuesen', 'Povlsen', 'Thorup', 'Høj', 'Bentzen', 'Johannessen', 'Vilhelmsen', + 'Isaksen', 'Bendixen', 'Ovesen', 'Villumsen', 'Lindberg', 'Thomasen', 'Kjærsgaard', 'Buhl', 'Kofod', 'Ahmed', 'Smith', + 'Storm', 'Christophersen', 'Bruhn', 'Matthiesen', 'Wagner', 'Bjerg', 'Gram', 'Nedergaard', 'Dinesen', 'Mouritsen', + 'Boesen', 'Borup', 'Abrahamsen', 'Wulff', 'Gravesen', 'Rask', 'Pallesen', 'Greve', 'Korsgaard', 'Haugaard', 'Josefsen', + 'Bæk', 'Espersen', 'Thrane', 'Mørch', 'Frank', 'Lynge', 'Rohde', 'Larsson', 'Hammer', 'Torp', 'Sonne', 'Boysen', 'Bay', + 'Pihl', 'Fabricius', 'Høyer', 'Birch', 'Skou', 'Kirk', 'Antonsen', 'Høgh', 'Damsgaard', 'Dall', 'Truelsen', 'Daugaard', + 'Fuglsang', 'Martinsen', 'Therkelsen', 'Jansen', 'Karlsson', 'Caspersen', 'Steen', 'Callesen', 'Balle', 'Bloch', 'Smidt', + 'Rahbek', 'Hjort', 'Bjørn', 'Skaarup', 'Sand', 'Storgaard', 'Willumsen', 'Busk', 'Hartmann', 'Ladefoged', 'Skovgaard', + 'Philipsen', 'Damm', 'Haagensen', 'Hviid', 'Duus', 'Kvist', 'Adamsen', 'Mathiassen', 'Degn', 'Borg', 'Brix', 'Troelsen', + 'Ditlevsen', 'Brøndum', 'Svane', 'Mohamed', 'Birk', 'Brink', 'Hassan', 'Vester', 'Elkjær', 'Lykke', 'Nørregaard', + 'Meldgaard', 'Mørk', 'Hvid', 'Abildgaard', 'Nicolajsen', 'Bengtsson', 'Stokholm', 'Ahmad', 'Wind', 'Rømer', 'Gundersen', + 'Carlsson', 'Grøn', 'Khan', 'Skytte', 'Bagger', 'Hendriksen', 'Rosenberg', 'Jonassen', 'Severinsen', 'Jürgensen', + 'Boisen', 'Groth', 'Bager', 'Fogh', 'Hussain', 'Samuelsen', 'Pilgaard', 'Bødker', 'Dideriksen', 'Brogaard', 'Lundberg', + 'Hansson', 'Schwartz', 'Tran', 'Skriver', 'Klitgaard', 'Hauge', 'Højgaard', 'Qvist', 'Voss', 'Strøm', 'Wolff', 'Krarup', + 'Green', 'Odgaard', 'Tønnesen', 'Blom', 'Gammelgaard', 'Jæger', 'Kramer', 'Astrup', 'Würtz', 'Lehmann', 'Koefoed', + 'Skøtt', 'Lundsgaard', 'Bøgh', 'Vang', 'Martinussen', 'Sandberg', 'Weber', 'Holmgaard', 'Bidstrup', 'Meier', 'Drejer', + 'Schneider', 'Joensen', 'Dupont', 'Lorentsen', 'Bro', 'Bagge', 'Terkelsen', 'Kaspersen', 'Keller', 'Eliasen', 'Lyberth', + 'Husted', 'Mouritzen', 'Krag', 'Kragelund', 'Nørskov', 'Vad', 'Jochumsen', 'Hein', 'Krogsgaard', 'Kaas', 'Tolstrup', + 'Ernst', 'Hermann', 'Børgesen', 'Skjødt', 'Holt', 'Buus', 'Gotfredsen', 'Kjeldgaard', 'Broberg', 'Roed', 'Sivertsen', + 'Bergmann', 'Bjerrum', 'Petersson', 'Smed', 'Jeremiassen', 'Nyborg', 'Borch', 'Foged', 'Terp', 'Mark', 'Busch', + 'Lundgaard', 'Boye', 'Yde', 'Hinrichsen', 'Matzen', 'Esbensen', 'Hertz', 'Westh', 'Holmberg', 'Geertsen', 'Raun', + 'Aagaard', 'Kock', 'Falk', 'Munk', + ); + + /** + * Randomly return a danish name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Randomly return a danish CPR number (Personnal identification number) format. + * + * @link http://cpr.dk/cpr/site.aspx?p=16 + * @link http://en.wikipedia.org/wiki/Personal_identification_number_%28Denmark%29 + * + * @return string + */ + public static function cpr() + { + $birthdate = new \DateTime('@' . mt_rand(0, time())); + + return sprintf('%s-%s', $birthdate->format('dmy'), static::numerify('%###')); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php new file mode 100644 index 0000000..af96d3f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php @@ -0,0 +1,21 @@ + + */ +class PhoneNumber extends \Faker\Provider\PhoneNumber +{ + /** + * @var array Danish phonenumber formats. + */ + protected static $formats = array( + '+45 ## ## ## ##', + '+45 #### ####', + '+45########', + '## ## ## ##', + '#### ####', + '########', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php new file mode 100644 index 0000000..861f6fc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php @@ -0,0 +1,116 @@ + 'Aargau'), + array('AI' => 'Appenzell Innerrhoden'), + array('AR' => 'Appenzell Ausserrhoden'), + array('BE' => 'Bern'), + array('BL' => 'Basel-Landschaft'), + array('BS' => 'Basel-Stadt'), + array('FR' => 'Freiburg'), + array('GE' => 'Genf'), + array('GL' => 'Glarus'), + array('GR' => 'Graubünden'), + array('JU' => 'Jura',), + array('LU' => 'Luzern'), + array('NE' => 'Neuenburg'), + array('NW' => 'Nidwalden'), + array('OW' => 'Obwalden'), + array('SG' => 'St. Gallen'), + array('SH' => 'Schaffhausen'), + array('SO' => 'Solothurn'), + array('SZ' => 'Schwyz'), + array('TG' => 'Thurgau'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Waadt'), + array('VS' => 'Wallis'), + array('ZG' => 'Zug'), + array('ZH' => 'Zürich') + ); + + protected static $country = array( + 'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien', + 'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi', + 'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire', + 'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark', + 'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union', + 'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer', + 'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard- und McDonald-Inseln', 'Honduras', + 'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien', + 'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien', + 'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait', + 'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg', + 'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen', + 'Oman', 'Osttimor', 'Österreich', + 'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico', + 'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion', + 'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln', + 'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei', + 'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan', + 'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam', + 'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara', + 'Zentralafrikanische Republik', 'Zypern', + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{lastName}}{{streetSuffixShort}}', + '{{cityName}}{{streetSuffixShort}}', + '{{firstName}}-{{lastName}}-{{streetSuffixLong}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a random street suffix. + * @example str. + * @return string + */ + public function streetSuffixShort() + { + return static::randomElement(static::$streetSuffixShort); + } + + /** + * Returns a random street suffix. + * @example Strasse + * @return string + */ + public function streetSuffixLong() + { + return static::randomElement(static::$streetSuffixLong); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } + + public static function buildingNumber() + { + return static::regexify(self::numerify(static::randomElement(static::$buildingNumber))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php new file mode 100644 index 0000000..604ec5a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * @example 'Θεωδωρόπουλος' + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * @example 'Κοκκίνου' + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php new file mode 100644 index 0000000..f8cf8b3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php @@ -0,0 +1,85 @@ +generator->parse(static::randomElement(static::$towns)); + } + + public function syllable() + { + return static::randomElement(static::$syllables); + } + + public function direction() + { + return static::randomElement(static::$directions); + } + + public function englishStreetName() + { + return static::randomElement(static::$englishStreetNames); + } + + public function villageSuffix() + { + return static::randomElement(static::$villageSuffixes); + } + + public function estateSuffix() + { + return static::randomElement(static::$estateSuffixes); + } + + public function village() + { + return $this->generator->parse(static::randomElement(static::$villageNameFormats)); + } + + public function estate() + { + return $this->generator->parse(static::randomElement(static::$estateNameFormats)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php new file mode 100644 index 0000000..4d82d93 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$societyNameFormat)); + } + /** + * @example Mumbai + */ + public function city() + { + return static::randomElement(static::$city); + } + /** + * @example Vaishali Nagar + */ + public function locality() + { + return $this->generator->parse(static::randomElement(static::$localityFormats)); + } + /* + * @example Kharadi + */ + public function localityName() + { + return $this->generator->parse(static::randomElement(static::$localityName)); + } + /** + * @example Nagar + */ + public function areaSuffix() + { + return static::randomElement(static::$areaSuffix); + } + + /** + * @example 'Delhi' + */ + public static function state() + { + return static::randomElement(static::$state); + } + + /** + * @example 'DL' + */ + public static function stateAbbr() + { + return static::randomElement(static::$stateAbbr); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php new file mode 100644 index 0000000..6ec1671 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php @@ -0,0 +1,9 @@ +generator->parse($format)); + } + + public function fixedLineNumber() + { + $format = static::randomElement(static::$fixedLineNumberFormats); + + return static::numerify($this->generator->parse($format)); + } + + public function voipNumber() + { + $format = static::randomElement(static::$voipNumber); + + return $this->generator->parse($format); + } + + public function internationalCodePrefix() + { + $format = static::randomElement(static::$internationalCodePrefix); + + return $this->generator->parse($format); + } + + public function zeroToEight() + { + return static::randomElement(static::$zeroToEight); + } + + public function oneToNine() + { + return static::randomElement(static::$oneToNine); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php new file mode 100644 index 0000000..eb817e3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php @@ -0,0 +1,101 @@ +generator->parse($format)); + } + + /** + * NPA-format area code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function areaCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + $digits[] = self::randomDigitNot($digits[1]); + + return join('', $digits); + } + + /** + * NXX-format central office exchange code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function exchangeCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + + if ($digits[1] === 1) { + $digits[] = self::randomDigitNot(1); + } else { + $digits[] = self::randomDigit(); + } + + return join('', $digits); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php new file mode 100644 index 0000000..b3c5258 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php @@ -0,0 +1,3720 @@ +format('Y'), + static::randomNumber(6, true), + static::randomElement(static::$legalEntities) + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php new file mode 100644 index 0000000..0c5c5f4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php @@ -0,0 +1,18 @@ +generator->dateTimeThisCentury(); + } + $birthDateString = $birthdate->format('ymd'); + switch (strtolower($gender)) { + case static::GENDER_FEMALE: + $genderDigit = self::numberBetween(0, 4); + break; + case static::GENDER_MALE: + $genderDigit = self::numberBetween(5, 9); + break; + default: + $genderDigit = self::numberBetween(0, 9); + } + $sequenceDigits = str_pad(self::randomNumber(3), 3, 0, STR_PAD_BOTH); + $citizenDigit = ($citizen === true) ? '0' : '1'; + $raceDigit = self::numberBetween(8, 9); + + $partialIdNumber = $birthDateString . $genderDigit . $sequenceDigits . $citizenDigit . $raceDigit; + + return $partialIdNumber . Luhn::computeCheckDigit($partialIdNumber); + } + + /** + * @see https://en.wikipedia.org/wiki/Driving_licence_in_South_Africa + * + * @return string + */ + public function licenceCode() + { + return static::randomElement(static::$licenceCodes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php new file mode 100644 index 0000000..02a364d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php @@ -0,0 +1,100 @@ +generator->parse($format)); + } + + public function tollFreeNumber() + { + $format = static::randomElement(static::$specialFormats); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php new file mode 100644 index 0000000..70f503f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php @@ -0,0 +1,68 @@ +numberBetween(10000, 100000000); + } + + return $id . $separator . $this->numberBetween(80000000, 100000000); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php new file mode 100644 index 0000000..74caecc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php @@ -0,0 +1,29 @@ +generator->parse($format); + } + + /** + * @example 'کد پستی' + */ + public static function postcodePrefix() + { + return static::randomElement(static::$postcodePrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php new file mode 100644 index 0000000..0de47b3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php @@ -0,0 +1,57 @@ +generator->parse($format)); + } + + /** + * @example 'ahmad.ir' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php new file mode 100644 index 0000000..055b863 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php @@ -0,0 +1,137 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = array(); + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = explode(' ', $next); + + $currentWords[] = $word; + array_shift($currentWords); + $next = implode(' ', $currentWords); + + if ($resultLength == 0 && !preg_match('/^[\x{0600}-\x{06FF}]/u', $word)) { + continue; + } + // append the element + $result[] = $word; + $resultLength += strlen($word) + 1; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = implode(' ', $result); + + return $result.'.'; + } + + /** + * License: Creative Commons Attribution-ShareAlike License + * + * Title: مدیر مدرسه + * Author: جلال آل‌احمد + * Language: Persian + * + * @see http://fa.wikisource.org/wiki/%D9%85%D8%AF%DB%8C%D8%B1_%D9%85%D8%AF%D8%B1%D8%B3%D9%87 + * @var string + */ + protected static $baseText = <<<'EOT' +از در که وارد شدم سیگارم دستم بود. زورم آمد سلام کنم. همین طوری دنگم گرفته بود قد باشم. رئیس فرهنگ که اجازه‌ی نشستن داد، نگاهش لحظه‌ای روی دستم مکث کرد و بعد چیزی را که می‌نوشت، تمام کرد و می‌خواست متوجه من بشود که رونویس حکم را روی میزش گذاشته بودم. حرفی نزدیم. رونویس را با کاغذهای ضمیمه‌اش زیر و رو کرد و بعد غبغب انداخت و آرام و مثلاً خالی از عصبانیت گفت: + +- جا نداریم آقا. این که نمی‌شه! هر روز یه حکم می‌دند دست یکی می‌فرستنش سراغ من... دیروز به آقای مدیر کل... + +حوصله‌ی این اباطیل را نداشتم. حرفش را بریدم که: + +- ممکنه خواهش کنم زیر همین ورقه مرقوم بفرمایید؟ + +و سیگارم را توی زیرسیگاری براق روی میزش تکاندم. روی میز، پاک و مرتب بود. درست مثل اتاق همان مهمان‌خانه‌ی تازه‌عروس‌ها. هر چیز به جای خود و نه یک ذره گرد. فقط خاکستر سیگار من زیادی بود. مثل تفی در صورت تازه تراشیده‌ای.... قلم را برداشت و زیر حکم چیزی نوشت و امضا کرد و من از در آمده بودم بیرون. خلاص. تحمل این یکی را نداشتم. با اداهایش. پیدا بود که تازه رئیس شده. زورکی غبغب می‌انداخت و حرفش را آهسته توی چشم آدم می‌زد. انگار برای شنیدنش گوش لازم نیست. صد و پنجاه تومان در کارگزینی کل مایه گذاشته بودم تا این حکم را به امضا رسانده بودم. توصیه هم برده بودم و تازه دو ماه هم دویده بودم. مو، لای درزش نمی‌رفت. می‌دانستم که چه او بپذیرد، چه نپذیرد، کار تمام است. خودش هم می‌دانست. حتماً هم دستگیرش شد که با این نک و نالی که می‌کرد، خودش را کنف کرده. ولی کاری بود و شده بود. در کارگزینی کل، سفارش کرده بودند که برای خالی نبودن عریضه رونویس را به رؤیت رئیس فرهنگ هم برسانم تازه این طور شد. و گر نه بالی حکم کارگزینی کل چه کسی می‌توانست حرفی بزند؟ یک وزارت خانه بود و یک کارگزینی! شوخی که نبود. ته دلم قرص‌تر از این‌ها بود که محتاج به این استدلال‌ها باشم. اما به نظرم همه‌ی این تقصیرها از این سیگار لعنتی بود که به خیال خودم خواسته بودم خرجش را از محل اضافه حقوق شغل جدیدم در بیاورم. البته از معلمی، هم اُقم نشسته بود. ده سال «الف.ب.» درس دادن و قیافه‌های بهت‌زده‌ی بچه‌های مردم برای مزخرف‌ترین چرندی که می‌گویی... و استغناء با غین و استقراء با قاف و خراسانی و هندی و قدیمی‌ترین شعر دری و صنعت ارسال مثل و ردالعجز... و از این مزخرفات! دیدم دارم خر می‌شوم. گفتم مدیر بشوم. مدیر دبستان! دیگر نه درس خواهم داد و نه مجبور خواهم بود برای فرار از اتلاف وقت، در امتحان تجدیدی به هر احمق بی‌شعوری هفت بدهم تا ایام آخر تابستانم را که لذیذترین تکه‌ی تعطیلات است، نجات داده باشم. این بود که راه افتادم. رفتم و از اهلش پرسیدم. از یک کار چاق کن. دستم را توی دست کارگزینی گذاشت و قول و قرار و طرفین خوش و خرم و یک روز هم نشانی مدرسه را دستم دادند که بروم وارسی، که باب میلم هست یا نه. + +و رفتم. مدرسه دو طبقه بود و نوساز بود و در دامنه‌ی کوه تنها افتاده بود و آفتاب‌رو بود. یک فرهنگ‌دوست خرپول، عمارتش را وسط زمین خودش ساخته بود و بیست و پنج سال هم در اختیار فرهنگ گذاشته بود که مدرسه‌اش کنند و رفت و آمد بشود و جاده‌ها کوبیده بشود و این قدر ازین بشودها بشود، تا دل ننه باباها بسوزد و برای این‌که راه بچه‌هاشان را کوتاه بکنند، بیایند همان اطراف مدرسه را بخرند و خانه بسازند و زمین یارو از متری یک عباسی بشود صد تومان. یارو اسمش را هم روی دیوار مدرسه کاشی‌کاری کرده بود. هنوز در و همسایه پیدا نکرده بودند که حرف‌شان بشود و لنگ و پاچه‌ی سعدی و باباطاهر را بکشند میان و یک ورق دیگر از تاریخ‌الشعرا را بکوبند روی نبش دیوار کوچه‌شان. تابلوی مدرسه هم حسابی و بزرگ و خوانا. از صد متری داد می‌زد که توانا بود هر.... هر چه دلتان بخواهد! با شیر و خورشیدش که آن بالا سر، سه پا ایستاده بود و زورکی تعادل خودش را حفظ می‌کرد و خورشید خانم روی کولش با ابروهای پیوسته و قمچیلی که به دست داشت و تا سه تیر پرتاب، اطراف مدرسه بیابان بود. درندشت و بی آب و آبادانی و آن ته رو به شمال، ردیف کاج‌های درهم فرو رفته‌ای که از سر دیوار گلی یک باغ پیدا بود روی آسمان لکه‌ی دراز و تیره‌ای زده بود. حتماً تا بیست و پنج سال دیگر همه‌ی این اطراف پر می‌شد و بوق ماشین و ونگ ونگ بچه‌ها و فریاد لبویی و زنگ روزنامه‌فروشی و عربده‌ی گل به سر دارم خیار! نان یارو توی روغن بود. + +- راستی شاید متری ده دوازده شاهی بیشتر نخریده باشد؟ شاید هم زمین‌ها را همین جوری به ثبت داده باشد؟ هان؟ + +- احمق به توچه؟!... + +بله این فکرها را همان روزی کردم که ناشناس به مدرسه سر زدم و آخر سر هم به این نتیجه رسیدم که مردم حق دارند جایی بخوابند که آب زیرشان نرود. + +- تو اگر مردی، عرضه داشته باش مدیر همین مدرسه هم بشو. + +و رفته بودم و دنبال کار را گرفته بودم تا رسیده بودم به این‌جا. همان روز وارسی فهمیده بودم که مدیر قبلی مدرسه زندانی است. لابد کله‌اش بوی قرمه‌سبزی می‌داده و باز لابد حالا دارد کفاره‌ی گناهانی را می‌دهد که یا خودش نکرده یا آهنگری در بلخ کرده. جزو پر قیچی‌های رئیس فرهنگ هم کسی نبود که با مدیرشان، اضافه حقوقی نصیبش بشود و ناچار سر و دستی برای این کار بشکند. خارج از مرکز هم نداشت. این معلومات را توی کارگزینی به دست آورده بودم. هنوز «گه خوردم نامه‌نویسی» هم مد نشده بود که بگویم یارو به این زودی‌ها از سولدونی در خواهد آمد. فکر نمی‌کردم که دیگری هم برای این وسط بیابان دلش لک زده باشد با زمستان سختش و با رفت و آمد دشوارش. + +این بود که خیالم راحت بود. از همه‌ی این‌ها گذشته کارگزینی کل موافقت کرده بود! دست است که پیش از بلند شدن بوی اسکناس، آن جا هم دو سه تا عیب شرعی و عرفی گرفته بودند و مثلاً گفته بودن لابد کاسه‌ای زیر نیم کاسه است که فلانی یعنی من، با ده سال سابقه‌ی تدریس، می‌خواهد مدیر دبستان بشود! غرض‌شان این بود که لابد خل شدم که از شغل مهم و محترم دبیری دست می‌شویم. ماهی صد و پنجاه تومان حق مقام در آن روزها پولی نبود که بتوانم نادیده بگیرم. و تازه اگر ندیده می‌گرفتم چه؟ باز باید بر می‌گشتم به این کلاس‌ها و این جور حماقت‌ها. این بود که پیش رئیس فرهنگ، صاف برگشتم به کارگزینی کل، سراغ آن که بفهمی نفهمی، دلال کارم بود. و رونویس حکم را گذاشتم و گفتم که چه طور شد و آمدم بیرون. + +دو روز بعد رفتم سراغش. معلوم شد که حدسم درست بوده است و رئیس فرهنگ گفته بوده: «من از این لیسانسه‌های پر افاده نمی‌خواهم که سیگار به دست توی هر اتاقی سر می‌کنند.» + +و یارو برایش گفته بود که اصلاً وابدا..! فلانی همچین و همچون است و مثقالی هفت صنار با دیگران فرق دارد و این هندوانه‌ها و خیال من راحت باشد و پنج‌شنبه یک هفته‌ی دیگر خودم بروم پهلوی او... و این کار را کردم. این بار رئیس فرهنگ جلوی پایم بلند شد که: «ای آقا... چرا اول نفرمودید؟!...» و از کارمندهایش گله کرد و به قول خودش، مرا «در جریان موقعیت محل» گذاشت و بعد با ماشین خودش مرا به مدرسه رساند و گفت زنگ را زودتر از موعد زدند و در حضور معلم‌ها و ناظم، نطق غرایی در خصائل مدیر جدید – که من باشم – کرد و بعد هم مرا گذاشت و رفت با یک مدرسه‌ی شش کلاسه‌ی «نوبنیاد» و یک ناظم و هفت تا معلم و دویست و سی و پنج تا شاگرد. دیگر حسابی مدیر مدرسه شده بودم! + +ناظم، جوان رشیدی بود که بلند حرف می‌زد و به راحتی امر و نهی می‌کرد و بیا و برویی داشت و با شاگردهای درشت، روی هم ریخته بود که خودشان ترتیب کارها را می‌دادند و پیدا بود که به سر خر احتیاجی ندارد و بی‌مدیر هم می‌تواند گلیم مدرسه را از آب بکشد. معلم کلاس چهار خیلی گنده بود. دو تای یک آدم حسابی. توی دفتر، اولین چیزی که به چشم می‌آمد. از آن‌هایی که اگر توی کوچه ببینی، خیال می‌کنی مدیر کل است. لفظ قلم حرف می‌زد و شاید به همین دلیل بود که وقتی رئیس فرهنگ رفت و تشریفات را با خودش برد، از طرف همکارانش تبریک ورود گفت و اشاره کرد به اینکه «ان‌شاءالله زیر سایه‌ی سرکار، سال دیگر کلاس‌های دبیرستان را هم خواهیم داشت.» پیدا بود که این هیکل کم‌کم دارد از سر دبستان زیادی می‌کند! وقتی حرف می‌زد همه‌اش درین فکر بودم که با نان آقا معلمی چه طور می‌شد چنین هیکلی به هم زد و چنین سر و تیپی داشت؟ و راستش تصمیم گرفتم که از فردا صبح به صبح ریشم را بتراشم و یخه‌ام تمیز باشد و اتوی شلوارم تیز. + +معلم کلاس اول باریکه‌ای بود، سیاه سوخته. با ته ریشی و سر ماشین کرده‌ای و یخه‌ی بسته. بی‌کراوات. شبیه میرزابنویس‌های دم پست‌خانه. حتی نوکر باب می‌نمود. و من آن روز نتوانستم بفهمم وقتی حرف می‌زند کجا را نگاه می‌کند. با هر جیغ کوتاهی که می‌زد هرهر می‌خندید. با این قضیه نمی‌شد کاری کرد. معلم کلاس سه، یک جوان ترکه‌ای بود؛ بلند و با صورت استخوانی و ریش از ته تراشیده و یخه‌ی بلند آهاردار. مثل فرفره می‌جنبید. چشم‌هایش برق عجیبی می‌زد که فقط از هوش نبود، چیزی از ناسلامتی در برق چشم‌هایش بود که مرا واداشت از ناظم بپرسم مبادا مسلول باشد. البته مسلول نبود، تنها بود و در دانشگاه درس می‌خواند. کلاس‌های پنجم و ششم را دو نفر با هم اداره می‌کردند. یکی فارسی و شرعیات و تاریخ، جغرافی و کاردستی و این جور سرگرمی‌ها را می‌گفت، که جوانکی بود بریانتین زده، با شلوار پاچه تنگ و پوشت و کراوات زرد و پهنی که نعش یک لنگر بزرگ آن را روی سینه‌اش نگه داشته بود و دائماً دستش حمایل موهای سرش بود و دم به دم توی شیشه‌ها نگاه می‌کرد. و آن دیگری که حساب و مرابحه و چیزهای دیگر می‌گفت، جوانی بود موقر و سنگین مازندرانی به نظر می‌آمد و به خودش اطمینان داشت. غیر از این‌ها، یک معلم ورزش هم داشتیم که دو هفته بعد دیدمش و اصفهانی بود و از آن قاچاق‌ها. + +رئیس فرهنگ که رفت، گرم و نرم از همه‌شان حال و احوال پرسیدم. بعد به همه سیگار تعارف کردم. سراپا همکاری و همدردی بود. از کار و بار هر کدامشان پرسیدم. فقط همان معلم کلاس سه، دانشگاه می‌رفت. آن که لنگر به سینه انداخته بود، شب‌ها انگلیسی می‌خواند که برود آمریکا. چای و بساطی در کار نبود و ربع ساعت‌های تفریح، فقط توی دفتر جمع می‌شدند و دوباره از نو. و این نمی‌شد. باید همه‌ی سنن را رعایت کرد. دست کردم و یک پنج تومانی روی میز گذاشتم و قرار شد قبل و منقلی تهیه کنند و خودشان چای را راه بیندازند. + +بعد از زنگ قرار شد من سر صف نطقی بکنم. ناظم قضیه را در دو سه کلمه برای بچه‌ها گفت که من رسیدم و همه دست زدند. چیزی نداشتم برایشان بگویم. فقط یادم است اشاره‌ای به این کردم که مدیر خیلی دلش می‌خواست یکی از شما را به جای فرزند داشته باشد و حالا نمی‌داند با این همه فرزند چه بکند؟! که بی‌صدا خندیدند و در میان صف‌های عقب یکی پکی زد به خنده. واهمه برم داشت که «نه بابا. کار ساده‌ای هم نیست!» قبلاً فکر کرده بودم که می‌روم و فارغ از دردسر اداره‌ی کلاس، در اتاق را روی خودم می‌بندم و کار خودم را می‌کنم. اما حالا می‌دیدم به این سادگی‌ها هم نیست. اگر فردا یکی‌شان زد سر اون یکی را شکست، اگر یکی زیر ماشین رفت؛ اگر یکی از ایوان افتاد؛ چه خاکی به سرم خواهم ریخت؟ + +حالا من مانده بودم و ناظم که چیزی از لای در آهسته خزید تو. کسی بود؛ فراش مدرسه با قیافه‌ای دهاتی و ریش نتراشیده و قدی کوتاه و گشاد گشاد راه می‌رفت و دست‌هایش را دور از بدن نگه می‌داشت. آمد و همان کنار در ایستاد. صاف توی چشمم نگاه می‌کرد. حال او را هم پرسیدم. هر چه بود او هم می‌توانست یک گوشه‌ی این بار را بگیرد. در یک دقیقه همه‌ی درد دل‌هایش را کرد و التماس دعاهایش که تمام شد، فرستادمش برایم چای درست کند و بیاورد. بعد از آن من به ناظم پرداختم. سال پیش، از دانشسرای مقدماتی در آمده بود. یک سال گرمسار و کرج کار کرده بود و امسال آمده بود این‌جا. پدرش دو تا زن داشته. از اولی دو تا پسر که هر دو تا چاقوکش از آب در آمده‌اند و از دومی فقط او مانده بود که درس‌خوان شده و سرشناس و نان مادرش را می‌دهد که مریض است و از پدر سال‌هاست که خبری نیست و... یک اتاق گرفته‌اند به پنجاه تومان و صد و پنجاه تومان حقوق به جایی نمی‌رسد و تازه زور که بزند سه سال دیگر می‌تواند از حق فنی نظامت مدرسه استفاده کند + +... بعد بلند شدیم که به کلاس‌ها سرکشی کنیم. بعد با ناظم به تک تک کلاس‌ها سر زدیم در این میان من به یاد دوران دبستان خودم افتادم. در کلاس ششم را باز کردیم «... ت بی پدرو مادر» جوانک بریانتین زده خورد توی صورت‌مان. یکی از بچه‌ها صورتش مثل چغندر قرمز بود. لابد بزک فحش هنوز باقی بود. قرائت فارسی داشتند. معلم دستهایش توی جیبش بود و سینه‌اش را پیش داده بود و زبان به شکایت باز کرد: + +- آقای مدیر! اصلاً دوستی سرشون نمی‌شه. تو سَری می‌خوان. ملاحظه کنید بنده با چه صمیمیتی... + +حرفش را در تشدید «ایت» بریدم که: + +- صحیح می‌فرمایید. این بار به من ببخشید. + +و از در آمدیم بیرون. بعد از آن به اطاقی که در آینده مال من بود سر زدیم. بهتر از این نمی‌شد. بی سر و صدا، آفتاب‌رو، دور افتاده. + +وسط حیاط، یک حوض بزرگ بود و کم‌عمق. تنها قسمت ساختمان بود که رعایت حال بچه‌های قد و نیم قد در آن شده بود. دور حیاط دیوار بلندی بود درست مثل دیوار چین. سد مرتفعی در مقابل فرار احتمالی فرهنگ و ته حیاط مستراح و اتاق فراش بغلش و انبار زغال و بعد هم یک کلاس. به مستراح هم سر کشیدیم. همه بی در و سقف و تیغه‌ای میان آن‌ها. نگاهی به ناظم کردم که پا به پایم می‌آمد. گفت: + +- دردسر عجیبی شده آقا. تا حالا صد تا کاغذ به ادارفردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند.ه‌ی ساختمان نوشتیم آقا. می‌گند نمی‌شه پول دولت رو تو ملک دیگرون خرج کرد. + +- گفتم راست می‌گند. + +دیگه کافی بود. آمدیم بیرون. همان توی حیاط تا نفسی تازه کنیم وضع مالی و بودجه و ازین حرف‌های مدرسه را پرسیدم. هر اتاق ماهی پانزده ریال حق نظافت داشت. لوازم‌التحریر و دفترها را هم اداره‌ی فرهنگ می‌داد. ماهی بیست و پنج تومان هم برای آب خوردن داشتند که هنوز وصول نشده بود. برای نصب هر بخاری سالی سه تومان. ماهی سی تومان هم تنخواه‌گردان مدرسه بود که مثل پول آب سوخت شده بود و حالا هم ماه دوم سال بود. اواخر آبان. حالیش کردم که حوصله‌ی این کارها را ندارم و غرضم را از مدیر شدن برایش خلاصه کردم و گفتم حاضرم همه‌ی اختیارات را به او بدهم. «اصلاً انگار که هنوز مدیر نیامده.» مهر مدرسه هم پهلوی خودش باشد. البته او را هنوز نمی‌شناختم. شنیده بودم که مدیرها قبلاً ناظم خودشان را انتخاب می‌کنند، اما من نه کسی را سراغ داشتم و نه حوصله‌اش را. حکم خودم را هم به زور گرفته بودم. سنگ‌هامان را وا کندیم و به دفتر رفتیم و چایی را که فراش از بساط خانه‌اش درست کرده بود، خوردیم تا زنگ را زدند و باز هم زدند و من نگاهی به پرونده‌های شاگردها کردم که هر کدام عبارت بود از دو برگ کاغذ. از همین دو سه برگ کاغذ دانستم که اولیای بچه‌ها اغلب زارع و باغبان و اویارند و قبل از این‌که زنگ آخر را بزنند و مدرسه تعطیل بشود بیرون آمدم. برای روز اول خیلی زیاد بود. + +فردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند. + +روز سوم باز اول وقت مدرسه بودم. هنوز از پشت دیوار نپیچیده بودم که صدای سوز و بریز بچه‌ها به پیشبازم آمد. تند کردم. پنج تا از بچه‌ها توی ایوان به خودشان می‌پیچیدند و ناظم ترکه‌ای به دست داشت و به نوبت به کف دست‌شان می‌زد. بچه‌ها التماس می‌کردند؛ گریه می‌کردند؛ اما دستشان را هم دراز می‌کردند. نزدیک بود داد بزنم یا با لگد بزنم و ناظم را پرت کنم آن طرف. پشتش به من بود و من را نمی‌دید. ناگهان زمزمه‌ای توی صف‌ها افتاد که یک مرتبه مرا به صرافت انداخت که در مقام مدیریت مدرسه، به سختی می‌شود ناظم را کتک زد. این بود که خشمم را فرو خوردم و آرام از پله‌ها رفتم بالا. ناظم، تازه متوجه من شده بود در همین حین دخالتم را کردم و خواهش کردم این بار همه‌شان را به من ببخشند. + +نمی‌دانم چه کار خطایی از آنها سر زده بود که ناظم را تا این حد عصبانی کرده بود. بچه‌ها سکسکه‌کنان رفتند توی صف‌ها و بعد زنگ را زدند و صف‌ها رفتند به کلاس‌ها و دنبالشان هم معلم‌ها که همه سر وقت حاضر بودند. نگاهی به ناظم انداختم که تازه حالش سر جا آمده بود و گفتم در آن حالی که داشت، ممکن بود گردن یک کدامشان را بشکند. که مرتبه براق شد: + +- اگه یک روز جلوشونو نگیرید سوارتون می‌شند آقا. نمی‌دونید چه قاطرهای چموشی شده‌اند آقا. + +مثل بچه مدرسه‌ای‌ها آقا آقا می‌کرد. موضوع را برگرداندم و احوال مادرش را پرسیدم. خنده، صورتش را از هم باز کرد و صدا زد فراش برایش آب بیاورد. یادم هست آن روز نیم ساعتی برای آقای ناظم صحبت کردم. پیرانه. و او جوان بود و زود می‌شد رامش کرد. بعد ازش خواستم که ترکه‌ها را بشکند و آن وقت من رفتم سراغ اتاق خودم. + +در همان هفته‌ی اول به کارها وارد شدم. فردای زمستان و نه تا بخاری زغال سنگی و روزی چهار بار آب آوردن و آب و جاروی اتاق‌ها با یک فراش جور در نمی‌آید. یک فراش دیگر از اداره ی فرهنگ خواستم که هر روز منتظر ورودش بودیم. بعد از ظهرها را نمی‌رفتم. روزهای اول با دست و دل لرزان، ولی سه چهار روزه جرأت پیدا کردم. احساس می‌کردم که مدرسه زیاد هم محض خاطر من نمی‌گردد. کلاس اول هم یکسره بود و به خاطر بچه‌های جغله دلهره‌ای نداشتم. در بیابان‌های اطراف مدرسه هم ماشینی آمد و رفت نداشت و گرچه پست و بلند بود اما به هر صورت از حیاط مدرسه که بزرگ‌تر بود. معلم ها هم، هر بعد از ظهری دو تاشان به نوبت می‌رفتند یک جوری باهم کنار آمده بودند. و ترسی هم از این نبود که بچه‌ها از علم و فرهنگ ثقل سرد بکنند. یک روز هم بازرس آمد و نیم ساعتی پیزر لای پالان هم گذاشتیم و چای و احترامات متقابل! و در دفتر بازرسی تصدیق کرد که مدرسه «با وجود عدم وسایل» بسیار خوب اداره می‌شود. + +بچه‌ها مدام در مدرسه زمین می‌خوردند، بازی می‌کردند، زمین می‌خوردند. مثل اینکه تاتوله خورده بودند. ساده‌ترین شکل بازی‌هایشان در ربع ساعت‌های تفریح، دعوا بود. فکر می‌کردم علت این همه زمین خوردن شاید این باشد که بیش‌ترشان کفش حسابی ندارند. آن‌ها هم که داشتند، بچه‌ننه بودند و بلد نبودند بدوند و حتی راه بروند. این بود که روزی دو سه بار، دست و پایی خراش بر می‌داشت. پرونده‌ی برق و تلفن مدرسه را از بایگانی بسیار محقر مدرسه بیرون کشیده بودم و خوانده بودم. اگر یک خرده می‌دویدی تا دو سه سال دیگر هم برق مدرسه درست می‌شد و هم تلفنش. دوباره سری به اداره ساختمان زدم و موضوع را تازه کردم و به رفقایی که دورادور در اداره‌ی برق و تلفن داشتم، یکی دو بار رو انداختم که اول خیال می‌کردند کار خودم را می‌خواهم به اسم مدرسه راه بیندازم و ناچار رها کردم. این قدر بود که ادای وظیفه‌ای می‌کرد. مدرسه آب نداشت. نه آب خوراکی و نه آب جاری. با هرزاب بهاره، آب انبار زیر حوض را می‌انباشتند که تلمبه‌ای سرش بود و حوض را با همان پر می‌کردند و خود بچه‌ها. اما برای آب خوردن دو تا منبع صد لیتری داشتیم از آهن سفید که مثل امامزاده‌ای یا سقاخانه‌ای دو قلو، روی چهار پایه کنار حیاط بود و روزی دو بار پر و خالی می‌شد. این آب را از همان باغی می‌آوردیم که ردیف کاج‌هایش روی آسمان، لکه‌ی دراز سیاه انداخته بود. البته فراش می‌آورد. با یک سطل بزرگ و یک آب‌پاش که سوراخ بود و تا به مدرسه می‌رسید، نصف شده بود. هر دو را از جیب خودم دادم تعمیر کردند. + +یک روز هم مالک مدرسه آمد. پیرمردی موقر و سنگین که خیال می‌کرد برای سرکشی به خانه‌ی مستأجرنشینش آمده. از در وارد نشده فریادش بلند شد و فحش را کشید به فراش و به فرهنگ که چرا بچه‌ها دیوار مدرسه را با زغال سیاه کرده‌اند واز همین توپ و تشرش شناختمش. کلی با او صحبت کردیم البته او دو برابر سن من را داشت. برایش چای هم آوردیم و با معلم‌ها آشنا شد و قول‌ها داد و رفت. کنه‌ای بود. درست یک پیرمرد. یک ساعت و نیم درست نشست. ماهی یک بار هم این برنامه را داشتند که بایست پیه‌اش را به تن می‌مالیدم. + +اما معلم‌ها. هر کدام یک ابلاغ بیست و چهار ساعته در دست داشتند، ولی در برنامه به هر کدام‌شان بیست ساعت درس بیشتر نرسیده بود. کم کم قرار شد که یک معلم از فرهنگ بخواهیم و به هر کدام‌شان هجده ساعت درس بدهیم، به شرط آن‌که هیچ بعد از ظهری مدرسه تعطیل نباشد. حتی آن که دانشگاه می‌رفت می‌توانست با هفته‌ای هجده ساعت درس بسازد. و دشوارترین کار همین بود که با کدخدامنشی حل شد و من یک معلم دیگر از فرهنگ خواستم. + +اواخر هفته‌ی دوم، فراش جدید آمد. مرد پنجاه ساله‌ای باریک و زبر و زرنگ که شب‌کلاه می‌گذاشت و لباس آبی می‌پوشید و تسبیح می‌گرداند و از هر کاری سر رشته داشت. آب خوردن را نوبتی می‌آوردند. مدرسه تر و تمیز شد و رونقی گرفت. فراش جدید سرش توی حساب بود. هر دو مستخدم با هم تمام بخاری‌ها را راه انداختند و یک کارگر هم برای کمک به آن‌ها آمد. فراش قدیمی را چهار روز پشت سر هم، سر ظهر می‌فرستادیم اداره‌ی فرهنگ و هر آن منتظر زغال بودیم. هنوز یک هفته از آمدن فراش جدید نگذشته بود که صدای همه‌ی معلم‌ها در آمده بود. نه به هیچ کدامشان سلام می‌کرد و نه به دنبال خرده فرمایش‌هایشان می‌رفت. درست است که به من سلام می‌کرد، اما معلم‌ها هم، لابد هر کدام در حدود من صاحب فضایل و عنوان و معلومات بودند که از یک فراش مدرسه توقع سلام داشته باشند. اما انگار نه انگار. + +بدتر از همه این که سر خر معلم‌ها بود. من که از همان اول، خرجم را سوا کرده بودم و آن‌ها را آزاد گذاشته بودم که در مواقع بیکاری در دفتر را روی خودشان ببندند و هر چه می‌خواهند بگویند و هر کاری می‌خواهند بکنند. اما او در فاصله‌ی ساعات درس، همچه که معلم‌ها می‌آمدند، می‌آمد توی دفتر و همین طوری گوشه‌ی اتاق می‌ایستاد و معلم‌ها کلافه می‌شدند. نه می‌توانستند شلکلک‌های معلمی‌شان را در حضور او کنار بگذارند و نه جرأت می‌کردند به او چیزی بگویند. بدزبان بود و از عهده‌ی همه‌شان بر می‌آمد. یکی دوبار دنبال نخود سیاه فرستاده بودندش. اما زرنگ بود و فوری کار را انجام می‌داد و بر می‌گشت. حسابی موی دماغ شده بود. ده سال تجربه این حداقل را به من آموخته بود که اگر معلم‌ها در ربع ساعت‌های تفریح نتوانند بخندند، سر کلاس، بچه‌های مردم را کتک خواهند زد. این بود که دخالت کردم. یک روز فراش جدید را صدا زدم. اول حال و احوالپرسی و بعد چند سال سابقه دارد و چند تا بچه و چه قدر می‌گیرد... که قضیه حل شد. سی صد و خرده‌ای حقوق می‌گرفت. با بیست و پنج سال سابقه. کار از همین جا خراب بود. پیدا بود که معلم‌ها حق دارند او را غریبه بدانند. نه دیپلمی، نه کاغذپاره‌ای، هر چه باشد یک فراش که بیشتر نبود! و تازه قلدر هم بود و حق هم داشت. اول به اشاره و کنایه و بعد با صراحت بهش فهماندم که گر چه معلم جماعت اجر دنیایی ندارد، اما از او که آدم متدین و فهمیده‌ای است بعید است و از این حرف‌ها... که یک مرتبه پرید توی حرفم که: + +- ای آقا! چه می‌فرمایید؟ شما نه خودتون این کاره‌اید و نه اینارو می‌شناسید. امروز می‌خواند سیگار براشون بخرم، فردا می‌فرستنم سراغ عرق. من این‌ها رو می‌شناسم. + +راست می‌گفت. زودتر از همه، او دندان‌های مرا شمرده بود. فهمیده بود که در مدرسه هیچ‌کاره‌ام. می‌خواستم کوتاه بیایم، ولی مدیر مدرسه بودن و در مقابل یک فراش پررو ساکت ماندن!... که خر خر کامیون زغال به دادم رسید. ترمز که کرد و صدا خوابید گفتم: + +- این حرف‌ها قباحت داره. معلم جماعت کجا پولش به عرق می‌رسه؟ حالا بدو زغال آورده‌اند. + +و همین طور که داشت بیرون می‌رفت، افزودم: + +- دو روز دیگه که محتاجت شدند و ازت قرض خواستند با هم رفیق می‌شید. + +و آمدم توی ایوان. در بزرگ آهنی مدرسه را باز کرده بودند و کامیون آمده بود تو و داشتند بارش را جلوی انبار ته حیاط خالی می‌کردند و راننده، کاغذی به دست ناظم داد که نگاهی به آن انداخت و مرا نشان داد که در ایوان بالا ایستاده بودم و فرستادش بالا. کاغذش را با سلام به دستم داد. بیجک زغال بود. رسید رسمی اداره‌ی فرهنگ بود در سه نسخه و روی آن ورقه‌ی ماشین شده‌ی «باسکول» که می‌گفت کامیون و محتویاتش جمعاً دوازده خروار است. اما رسیدهای رسمی اداری فرهنگ ساکت بودند. جای مقدار زغالی که تحویل مدرسه داده شده بود، در هر سه نسخه خالی بود. پیدا بود که تحویل گیرنده باید پرشان کند. همین کار را کردم. اوراق را بردم توی اتاق و با خودنویسم عدد را روی هر سه ورق نوشتم و امضا کردم و به دست راننده دادم که راه افتاد و از همان بالا به ناظم گفتم: + +- اگر مهر هم بایست زد، خودت بزن بابا. + +و رفتم سراغ کارم که ناگهان در باز شد و ناظم آمد تو؛ بیجک زغال دستش بود و: + +- مگه نفهمیدین آقا؟ مخصوصاً جاش رو خالی گذاشته بودند آقا... + +نفهمیده بودم. اما اگر هم فهمیده بودم، فرقی نمی‌کرد و به هر صورت از چنین کودنی نا به هنگام از جا در رفتم و به شدت گفتم: + +- خوب؟ + +- هیچ چی آقا.... رسم‌شون همینه آقا. اگه باهاشون کنار نیایید کارمونو لنگ می‌گذارند آقا... + +که از جا در رفتم. به چنین صراحتی مرا که مدیر مدرسه بودم در معامله شرکت می‌داد. و فریاد زدم: + +- عجب! حالا سرکار برای من تکلیف هم معین می‌کنید؟... خاک بر سر این فرهنگ با مدیرش که من باشم! برو ورقه رو بده دست‌شون، گورشون رو گم کنند. پدر سوخته‌ها... + +چنان فریاد زده بودم که هیچ کس در مدرسه انتظار نداشت. مدیر سر به زیر و پا به راهی بودم که از همه خواهش می‌کردم و حالا ناظم مدرسه، داشت به من یاد می‌داد که به جای نه خروار زغال مثلا هجده خروار تحویل بگیرم و بعد با اداره‌ی فرهنگ کنار بیایم. هی هی!.... تا ظهر هیچ کاری نتوانستم بکنم، جز این‌که چند بار متن استعفانامه‌ام را بنویسم و پاره کنم... قدم اول را این جور جلوی پای آدم می‌گذارند. + +بارندگی که شروع شد دستور دادم بخاری‌ها را از هفت صبح بسوزانند. بچه‌ها همیشه زود می‌آمدند. حتی روزهای بارانی. مثل این‌که اول آفتاب از خانه بیرون‌شان می‌کنند. یا ناهارنخورده. خیلی سعی کردم یک روز زودتر از بچه‌ها مدرسه باشم. اما عاقبت نشد که مدرسه را خالی از نفسِ به علم‌آلوده‌ی بچه‌ها استنشاق کنم. از راه که می‌رسیدند دور بخاری جمع می‌شدند و گیوه‌هاشان را خشک می‌کردند. و خیلی زود فهمیدم که ظهر در مدرسه ماندن هم مسأله کفش بود. هر که داشت نمی‌ماند.این قاعده در مورد معلم‌ها هم صدق می‌کرد اقلاً یک پول واکس جلو بودند. وقتی که باران می‌بارید تمام کوهپایه و بدتر از آن تمام حیاط مدرسه گل می‌شد. بازی و دویدن متوقف شده بود. مدرسه سوت و کور بود. این جا هم مسأله کفش بود. چشم اغلبشان هم قرمز بود. پیدا بود باز آن روز صبح یک فصل گریه کرده‌اند و در خانه‌شان علم صراطی بوده است. + +مدرسه داشت تخته می‌شد. عده‌ی غایب‌های صبح ده برابر شده بود و ساعت اول هیچ معلمی نمی‌توانست درس بدهد. دست‌های ورم‌کرده و سرمازده کار نمی‌کرد. حتی معلم کلاس اولمان هم می‌دانست که فرهنگ و معلومات مدارس ما صرفاً تابع تمرین است. مشق و تمرین. ده بار بیست بار. دست یخ‌کرده بیل و رنده را هم نمی‌تواند به کار بگیرد که خیلی هم زمخت‌اند و دست پر کن. این بود که به فکر افتادیم. فراش جدید واردتر از همه‌ی ما بود. یک روز در اتاق دفتر، شورامانندی داشتیم که البته او هم بود. خودش را کم‌کم تحمیل کرده بود. گفت حاضر است یکی از دُم‌کلفت‌های همسایه‌ی مدرسه را وادارد که شن برایمان بفرستد به شرط آن که ما هم برویم و از انجمن محلی برای بچه‌ها کفش و لباس بخواهیم. قرار شد خودش قضیه را دنبال کند که هفته‌ی آینده جلسه‌شان کجاست و حتی بخواهد که دعوت‌مانندی از ما بکنند. دو روز بعد سه تا کامیون شن آمد. دوتایش را توی حیاط مدرسه، خالی کردیم و سومی را دم در مدرسه، و خود بچه‌ها نیم ساعته پهنش کردند. با پا و بیل و هر چه که به دست می‌رسید. + +عصر همان روز ما را به انجمن دعوت کردند. خود من و ناظم باید می‌رفتیم. معلم کلاس چهارم را هم با خودمان بردیم. خانه‌ای که محل جلسه‌ی آن شب انجمن بود، درست مثل مدرسه، دور افتاده و تنها بود. قالی‌ها و کناره‌ها را به فرهنگ می‌آلودیم و می‌رفتیم. مثل این‌که سه تا سه تا روی هم انداخته بودند. اولی که کثیف شد دومی. به بالا که رسیدیم یک حاجی آقا در حال نماز خواندن بود. و صاحب‌خانه با لهجه‌ی غلیظ یزدی به استقبال‌مان آمد. همراهانم را معرفی کردم و لابد خودش فهمید مدیر کیست. برای ما چای آوردند. سیگارم را چاق کردم و با صاحب‌خانه از قالی‌هایش حرف زدیم. ناظم به بچه‌هایی می‌ماند که در مجلس بزرگترها خوابشان می‌گیرد و دل‌شان هم نمی‌خواست دست به سر شوند. سر اعضای انجمن باز شده بود. حاجی آقا صندوقدار بود. من و ناظم عین دو طفلان مسلم بودیم و معلم کلاس چهارم عین خولی وسطمان نشسته. اغلب اعضای انجمن به زبان محلی صحبت می‌کردند و رفتار ناشی داشتند. حتی یک کدامشان نمی‌دانستند که دست و پاهای خود را چه جور ضبط و ربط کنند. بلند بلند حرف می‌زدند. درست مثل این‌که وزارتخانه‌ی دواب سه تا حیوان تازه برای باغ وحش محله‌شان وارد کرده. جلسه که رسمی شد، صاحبخانه معرفی‌مان کرد و شروع کردند. مدام از خودشان صحبت می‌کردند از این‌که دزد دیشب فلان جا را گرفته و باید درخواست پاسبان شبانه کنیم و... + +همین طور یک ساعت حرف زدند و به مهام امور رسیدگی کردند و من و معلم کلاس چهارم سیگار کشیدیم. انگار نه انگار که ما هم بودیم. نوکرشان که آمد استکان‌ها را جمع کند، چیزی روی جلد اشنو نوشتم و برای صاحبخانه فرستادم که یک مرتبه به صرافت ما افتاد و اجازه خواست و: + +- آقایان عرضی دارند. بهتر است کارهای خودمان را بگذاریم برای بعد. + +مثلاً می‌خواست بفهماند که نباید همه‌ی حرف‌ها را در حضور ما زده باشند. و اجازه دادند معلم کلاس چهار شروع کرد به نطق و او هم شروع کرد که هر چه باشد ما زیر سایه‌ی آقایانیم و خوش‌آیند نیست که بچه‌هایی باشند که نه لباس داشته باشند و نه کفش درست و حسابی و از این حرف‌ها و مدام حرف می‌زد. ناظم هم از چُرت در آمد چیزهایی را که از حفظ کرده بود گفت و التماس دعا و کار را خراب کرد.تشری به ناظم زدم که گدابازی را بگذارد کنار و حالی‌شان کردم که صحبت از تقاضا نیست و گدایی. بلکه مدرسه دور افتاده است و مستراح بی در و پیکر و از این اباطیل... چه خوب شد که عصبانی نشدم. و قرار شد که پنج نفرشان فردا عصر بیایند که مدرسه را وارسی کنند و تشکر و اظهار خوشحالی و در آمدیم. + +در تاریکی بیابان هفت تا سواری پشت در خانه ردیف بودند و راننده‌ها توی یکی از آن‌ها جمع شده بودند و اسرار ارباب‌هاشان را به هم می‌گفتند. در این حین من مدام به خودم می‌گفتم من چرا رفتم؟ به من چه؟ مگر من در بی کفش و کلاهی‌شان مقصر بودم؟ می‌بینی احمق؟ مدیر مدرسه هم که باشی باید شخصیت و غرورت را لای زرورق بپیچی و طاق کلاهت بگذاری که اقلاً نپوسد. حتی اگر بخواهی یک معلم کوفتی باشی، نه چرا دور می‌زنی؟ حتی اگر یک فراش ماهی نود تومانی باشی، باید تا خرخره توی لجن فرو بروی.در همین حین که من در فکر بودم ناظم گفت: + +- دیدید آقا چه طور باهامون رفتار کردند؟ با یکی از قالی‌هاشون آقا تمام مدرسه رو می‌خرید. + +گفتم: + +- تا سر و کارت با الف.ب است به‌پا قیاس نکنی. خودخوری می‌آره. + +و معلم کلاس چهار گفت: + +- اگه فحشمون هم می‌دادند من باز هم راضی بودم، باید واقع‌بین بود. خدا کنه پشیمون نشند. + +بعد هم مدتی درد دل کردیم و تا اتوبوس برسد و سوار بشیم، معلوم شد که معلم کلاس چهار با زنش متارکه کرده و مادر ناظم را سرطانی تشخیص دادند. و بعد هم شب بخیر... + +دو روز تمام مدرسه نرفتم. خجالت می‌کشیدم توی صورت یک کدام‌شان نگاه کنم. و در همین دو روز حاجی آقا با دو نفر آمده بودند، مدرسه را وارسی و صورت‌برداری و ناظم می‌گفت که حتی بچه‌هایی هم که کفش و کلاهی داشتند پاره و پوره آمده بودند. و برای بچه‌ها کفش و لباس خریدند. روزهای بعد احساس کردم زن‌هایی که سر راهم لب جوی آب ظرف می‌شستند، سلام می‌کنند و یک بار هم دعای خیر یکی‌شان را از عقب سر شنیدم.اما چنان از خودم بدم آمده بود که رغبتم نمی‌شد به کفش و لباس‌هاشان نگاه کنم. قربان همان گیوه‌های پاره! بله، نان گدایی فرهنگ را نو نوار کرده بود. + +تازه از دردسرهای اول کار مدرسه فارغ شده بودم که شنیدم که یک روز صبح، یکی از اولیای اطفال آمد. بعد از سلام و احوالپرسی دست کرد توی جیبش و شش تا عکس در آورد، گذاشت روی میزم. شش تا عکس زن لخت. لخت لخت و هر کدام به یک حالت. یعنی چه؟ نگاه تندی به او کردم. آدم مرتبی بود. اداری مانند. کسر شأن خودم می‌دانستم که این گوشه‌ی از زندگی را طبق دستور عکاس‌باشی فلان جنده‌خانه‌ی بندری ببینم. اما حالا یک مرد اتو کشیده‌ی مرتب آمده بود و شش تا از همین عکس‌ها را روی میزم پهن کرده بود و به انتظار آن که وقاحت عکس‌ها چشم‌هایم را پر کند داشت سیگار چاق می‌کرد. + +حسابی غافلگیر شده بودم... حتماً تا هر شش تای عکس‌ها را ببینم، بیش از یک دقیقه طول کشید. همه از یک نفر بود. به این فکر گریختم که الان هزار ها یا میلیون ها نسخه‌ی آن، توی جیب چه جور آدم‌هایی است و در کجاها و چه قدر خوب بود که همه‌ی این آدم‌ها را می‌شناختم یا می‌دیدم. بیش ازین نمی‌شد گریخت. یارو به تمام وزنه وقاحتش، جلوی رویم نشسته بود. سیگاری آتش زدم و چشم به او دوختم. کلافه بود و پیدا بود برای کتک‌کاری هم آماده باشد. سرخ شده بود و داشت در دود سیگارش تکیه‌گاهی برای جسارتی که می‌خواست به خرج بدهد می‌جست. عکس‌ها را با یک ورقه از اباطیلی که همان روز سیاه کرده بودم، پوشاندم و بعد با لحنی که دعوا را با آن شروع می‌کنند؛ پرسیدم: + +- خوب، غرض؟ + +و صدایم توی اتاق پیچید. حرکتی از روی بیچارگی به خودش داد و همه‌ی جسارت‌ها را با دستش توی جیبش کرد و آرام‌تر از آن چیزی که با خودش تو آورده بود، گفت: + +- چه عرض کنم؟... از معلم کلاس پنج تون بپرسید. + +که راحت شدم و او شروع کرد به این که «این چه فرهنگی است؟ خراب بشود. پس بچه‌های مردم با چه اطمینانی به مدرسه بیایند؟ + +و از این حرف‌ها... + +خلاصه این آقا معلم کاردستی کلاس پنجم، این عکس‌ها را داده به پسر آقا تا آن‌ها را روی تخته سه لایی بچسباند و دورش را سمباده بکشد و بیاورد. به هر صورت معلم کلاس پنج بی‌گدار به آب زده. و حالا من چه بکنم؟ به او چه جوابی بدهم؟ بگویم معلم را اخراج می‌کنم؟ که نه می‌توانم و نه لزومی دارد. او چه بکند؟ حتماً در این شهر کسی را ندارد که به این عکس‌ها دلخوش کرده. ولی آخر چرا این جور؟ یعنی این قدر احمق است که حتی شاگردهایش را نمی‌شناسد؟... پاشدم ناظم را صدا بزنم که خودش آمده بود بالا، توی ایوان منتظر ایستاده بود. من آخرین کسی بودم که از هر اتفاقی در مدرسه خبردار می‌شدم. حضور این ولی طفل گیجم کرده بود که چنین عکس‌هایی را از توی جیب پسرش، و لابد به همین وقاحتی که آن‌ها را روی میز من ریخت، در آورده بوده. وقتی فهمید هر دو در مانده‌ایم سوار بر اسب شد که اله می‌کنم و بله می‌کنم، در مدرسه را می‌بندم، و از این جفنگیات.... + +حتماً نمی‌دانست که اگر در هر مدرسه بسته بشود، در یک اداره بسته شده است. اما من تا او بود نمی‌توانستم فکرم را جمع کنم. می‌خواست پسرش را بخواهیم تا شهادت بدهد و چه جانی کندیم تا حالیش کنیم که پسرش هر چه خفت کشیده، بس است و وعده‌ها دادیم که معلمش را دم خورشید کباب کنیم و از نان خوردن بیندازیم. یعنی اول ناظم شروع کرد که از دست او دل پری داشت و من هم دنبالش را گرفتم. برای دک کردن او چاره‌ای جز این نبود. و بعد رفت، ما دو نفری ماندیم با شش تا عکس زن لخت. حواسم که جمع شد به ناظم سپردم صدایش را در نیاورد و یک هفته‌ی تمام مطلب را با عکس‌ها، توی کشوی میزم قفل کردم و بعد پسرک را صدا زدم. نه عزیزدُردانه می‌نمود و نه هیچ جور دیگر. داد می‌زد که از خانواده‌ی عیال‌واری است. کم‌خونی و فقر. دیدم معلمش زیاد هم بد تشخیص نداده. یعنی زیاد بی‌گدار به آب نزده. گفتم: + +- خواهر برادر هم داری؟ + +- آ... آ...آقا داریم آقا. + +- چند تا؟ + +- آ... آقا چهار تا آقا. + +- عکس‌ها رو خودت به بابات نشون دادی؟ + +- نه به خدا آقا... به خدا قسم... + +- پس چه طور شد؟ + +و دیدم از ترس دارد قالب تهی می‌کند. گرچه چوب‌های ناظم شکسته بود، اما ترس او از من که مدیر باشم و از ناظم و از مدرسه و از تنبیه سالم مانده بود. + +- نترس بابا. کاریت نداریم. تقصیر آقا معلمه که عکس‌ها رو داده... تو کار بدی نکردی بابا جان. فهمیدی؟ اما می‌خواهم ببینم چه طور شد که عکس‌ها دست بابات افتاد. + +- آ.. آ... آخه آقا... آخه... + +می‌دانستم که باید کمکش کنم تا به حرف بیاید. + +گفتم: + +- می‌دونی بابا؟ عکس‌هام چیز بدی نبود. تو خودت فهمیدی چی بود؟ + +- آخه آقا...نه آقا.... خواهرم آقا... خواهرم می‌گفت... + +- خواهرت؟ از تو کوچک‌تره؟ + +- نه آقا. بزرگ‌تره. می‌گفتش که آقا... می‌گفتش که آقا... هیچ چی سر عکس‌ها دعوامون شد. + +دیگر تمام بود. عکس‌ها را به خواهرش نشان داده بود که لای دفترچه پر بوده از عکس آرتیست‌ها. به او پز داده بوده. اما حاضر نبوده، حتی یکی از آن‌ها را به خواهرش بدهد. آدم مورد اعتماد معلم باشد و چنین خبطی بکند؟ و تازه جواب معلم را چه بدهد؟ ناچار خواهر او را لو داده بوده. بعد از او معلم را احضار کردم. علت احضار را می‌دانست. و داد می‌زد که چیزی ندارد بگوید. پس از یک هفته مهلت، هنوز از وقاحتی که من پیدا کرده بودم، تا از آدم خلع سلاح‌شده‌ای مثل او، دست بر ندارم، در تعجب بود. به او سیگار تعارف کردم و این قصه را برایش تعریف کردم که در اوایل تأسیس وزارت معارف، یک روز به وزیر خبر می‌دهند که فلان معلم با فلان بچه روابطی دارد. وزیر فوراً او را می‌خواهد و حال و احوال او را می‌پرسد و این‌که چرا تا به حال زن نگرفته و ناچار تقصیر گردن بی‌پولی می‌افتد و دستور که فلان قدر به او کمک کنند تا عروسی راه بیندازد و خود او هم دعوت بشود و قضیه به همین سادگی تمام می‌شود. و بعد گفتم که خیلی جوان‌ها هستند که نمی‌توانند زن بگیرند و وزرای فرهنگ هم این روزها گرفتار مصاحبه‌های روزنامه‌ای و رادیویی هستند. اما در نجیب‌خانه‌ها که باز است و ازین مزخرفات... و هم‌دردی و نگذاشتم یک کلمه حرف بزند. بعد هم عکس را که توی پاکت گذاشته بودم، به دستش دادم و وقاحت را با این جمله به حد اعلا رساندم که: + +- اگر به تخته نچسبونید، ضررشون کم‌تره. + +تا حقوقم به لیست اداره‌ی فرهنگ برسه، سه ماه طول کشید. فرهنگی‌های گداگشنه و خزانه‌ی خالی و دست‌های از پا درازتر! اما خوبیش این بود که در مدرسه‌ی ما فراش جدیدمان پولدار بود و به همه‌شان قرض داد. کم کم بانک مدرسه شده بود. از سیصد و خرده‌ای تومان که می‌گرفت، پنجاه تومان را هم خرج نمی‌کرد. نه سیگار می‌کشید و نه اهل سینما بود و نه برج دیگری داشت. از این گذشته، باغبان یکی از دم‌کلفت‌های همان اطراف بود و باغی و دستگاهی و سور و ساتی و لابد آشپزخانه‌ی مرتبی. خیلی زود معلم‌ها فهمیدند که یک فراش پولدار خیلی بیش‌تر به درد می‌خورد تا یک مدیر بی‌بو و خاصیت. + +این از معلم‌ها. حقوق مرا هم هنوز از مرکز می‌دادند. با حقوق ماه بعد هم اسم مرا هم به لیست اداره منتقل کردند. درین مدت خودم برای خودم ورقه انجام کار می‌نوشتم و امضا می‌کردم و می‌رفتم از مدرسه‌ای که قبلاً در آن درس می‌دادم، حقوقم را می‌گرفتم. سر و صدای حقوق که بلند می‌شد معلم‌ها مرتب می‌شدند و کلاس ماهی سه چهار روز کاملاً دایر بود. تا ورقه‌ی انجام کار به دستشان بدهم. غیر از همان یک بار - در اوایل کار- که برای معلم حساب پنج و شش قرمز توی دفتر گذاشتیم، دیگر با مداد قرمز کاری نداشتیم و خیال همه‌شان راحت بود. وقتی برای گرفتن حقوقم به اداره رفتم، چنان شلوغی بود که به خودم گفتم کاش اصلاً حقوقم را منتقل نکرده بودم. نه می‌توانستم سر صف بایستم و نه می‌توانستم از حقوقم بگذرم. تازه مگر مواجب‌بگیر دولت چیزی جز یک انبان گشاده‌ی پای صندوق است؟..... و اگر هم می‌ماندی با آن شلوغی باید تا دو بعداز ظهر سر پا بایستی. همه‌ی جیره‌خوارهای اداره بو برده بودند که مدیرم. و لابد آن‌قدر ساده لوح بودند که فکر کنند روزی گذارشان به مدرسه‌ی ما بیفتد. دنبال سفته‌ها می‌گشتند، به حسابدار قبلی فحش می‌دادند، التماس می‌کردند که این ماه را ندیده بگیرید و همه‌ی حق و حساب‌دان شده بودند و یکی که زودتر از نوبت پولش را می‌گرفت صدای همه در می‌آمد. در لیست مدرسه، بزرگ‌ترین رقم مال من بود. درست مثل بزرگ‌ترین گناه در نامه‌ی عمل. دو برابر فراش جدیدمان حقوق می‌گرفتم. از دیدن رقم‌های مردنی حقوق دیگران چنان خجالت کشیدم که انگار مال آن‌ها را دزدیده‌ام. و تازه خلوت که شد و ده پانزده تا امضا که کردم، صندوق‌دار چشمش به من افتاد و با یک معذرت، شش صد تومان پول دزدی را گذاشت کف دستم... مرده شور! + +هنوز برف اول نباریده بود که یک روز عصر، معلم کلاس چهار رفت زیر ماشین. زیر یک سواری. مثل همه‌ی عصرها من مدرسه نبودم. دم غروب بود که فراش قدیمی مدرسه دم در خونه‌مون، خبرش را آورد. که دویدم به طرف لباسم و تا حاضر بشوم، می‌شنیدم که دارد قضیه را برای زنم تعریف می‌کند. ماشین برای یکی از آمریکایی‌ها بوده. باقیش را از خانه که در آمدیم برایم تعریف کرد. گویا یارو خودش پشت فرمون بوده و بعد هم هول شده و در رفته. بچه‌ها خبر را به مدرسه برگردانده‌اند و تا فراش و زنش برسند، جمعیت و پاسبان‌ها سوارش کرده بودند و فرستاده بوده‌اند مریض‌خانه. به اتوبوس که رسیدم، دیدم لاک پشت است. فراش را مرخص کردم و پریدم توی تاکسی. اول رفتم سراغ پاسگاه جدید کلانتری. تعاریف تکه و پاره‌ای از پرونده مطلع بود. اما پرونده تصریحی نداشت که راننده که بوده. اما هیچ کس نمی‌دانست عاقبت چه بلایی بر سر معلم کلاس چهار ما آمده است. کشیک پاسگاه همین قدر مطلع بود که درین جور موارد «طبق جریان اداری» اول می‌روند سرکلانتری، بعد دایره‌ی تصادفات و بعد بیمارستان. اگر آشنا در نمی‌آمدیم، کشیک پاسگاه مسلماً نمی‌گذاشت به پرونده نگاه چپ بکنم. احساس کردم میان اهل محل کم‌کم دارم سرشناس می‌شوم. و از این احساس خنده‌ام گرفت. + +ساعت ۸ دم در بیمارستان بودم، اگر سالم هم بود حتماً یه چیزیش شده بود. همان طور که من یه چیزیم می‌شد. روی در بیمارستان نوشته شده بود: «از ساعت ۷ به بعد ورود ممنوع». در زدم. از پشت در کسی همین آیه را صادر کرد. دیدم فایده ندارد و باید از یک چیزی کمک بگیرم. از قدرتی، از مقامی، از هیکلی، از یک چیزی. صدایم را کلفت کردم و گفتم:« من...» می‌خواستم بگویم من مدیر مدرسه‌ام. ولی فوراً پشیمان شدم. یارو لابد می‌گفت مدیر مدرسه کدام سگی است؟ این بود با کمی مکث و طمطراق فراوان جمله‌ام را این طور تمام کردم: + +- ...بازرس وزارت فرهنگم. + +که کلون صدایی کرد و لای در باز شد. یارو با چشم‌هایش سلام کرد. رفتم تو و با همان صدا پرسیدم: + +- این معلمه مدرسه که تصادف کرده... + +تا آخرش را خواند. یکی را صدا زد و دنبالم فرستاد که طبقه‌ی فلان، اتاق فلان. از حیاط به راهرو و باز به حیاط دیگر که نصفش را برف پوشانده بود و من چنان می‌دویدم که یارو از عقب سرم هن هن می‌کرد. طبقه‌ی اول و دوم و چهارم. چهار تا پله یکی. راهرو تاریک بود و پر از بوهای مخصوص بود. هن هن کنان دری را نشان داد که هل دادم و رفتم تو. بو تندتر بود و تاریکی بیشتر. تالاری بود پر از تخت و جیرجیر کفش و خرخر یک نفر. دور یک تخت چهار نفر ایستاده بودند. حتماً خودش بود. پای تخت که رسیدم، احساس کردم همه‌ی آنچه از خشونت و تظاهر و ابهت به کمک خواسته بودم آب شد و بر سر و صورتم راه افتاد. و این معلم کلاس چهارم مدرسه‌ام بود. سنگین و با شکم بر آمده دراز کشیده بود. خیلی کوتاه‌تر از زمانی که سر پا بود به نظرم آمد. صورت و سینه‌اش از روپوش چرک‌مُرد بیرون بود. صورتش را که شسته بودند کبود کبود بود، درست به رنگ جای سیلی روی صورت بچه‌ها. مرا که دید، لبخند و چه لبخندی! شاید می‌خواست بگوید مدرسه‌ای که مدیرش عصرها سر کار نباشد، باید همین جورها هم باشد. خنده توی صورت او همین طور لرزید و لرزید تا یخ زد. + +«آخر چرا تصادف کردی؟...» + +مثل این که سوال را ازو کردم. اما وقتی که دیدم نمی‌تواند حرف بزند و به جای هر جوابی همان خنده‌ی یخ‌بسته را روی صورت دارد، خودم را به عنوان او دم چک گرفتم. «آخه چرا؟ چرا این هیکل مدیر کلی را با خودت این قد این ور و آن ور می‌بری تا بزنندت؟ تا زیرت کنند؟ مگر نمی‌دانستی که معلم حق ندارد این قدر خوش‌هیکل باشد؟ آخر چرا تصادف کردی؟» به چنان عتاب و خطابی این‌ها را می‌گفتم که هیچ مطمئن نیستم بلند بلند به خودش نگفته باشم. و یک مرتبه به کله‌ام زد که «مبادا خودت چشمش زده باشی؟» و بعد: «احمق خاک بر سر! بعد از سی و چند سال عمر، تازه خرافاتی شدی!» و چنان از خودم بیزاریم گرفت که می‌خواستم به یکی فحش بدهم، کسی را بزنم. که چشمم به دکتر کشیک افتاد. + +- مرده شور این مملکتو ببره. ساعت چهار تا حالا از تن این مرد خون می‌ره. حیفتون نیومد؟... + +دستی روی شانه‌ام نشست و فریادم را خواباند. برگشتم پدرش بود. او هم می‌خندید. دو نفر دیگر هم با او بودند. همه دهاتی‌وار؛ همه خوش قد و قواره. حظ کردم! آن دو تا پسرهایش بودند یا برادرزاده‌هایش یا کسان دیگرش. تازه داشت گل از گلم می‌شکفت که شنیدم: + +- آقا کی باشند؟ + +این راهم دکتر کشیک گفت که من باز سوار شدم: + +- مرا می‌گید آقا؟ من هیشکی. یک آقا مدیر کوفتی. این هم معلمم. + +که یک مرتبه عقل هی زد و «پسر خفه شو» و خفه شدم. بغض توی گلویم بود. دلم می‌خواست یک کلمه دیگر بگوید. یک کنایه بزند... نسبت به مهارت هیچ دکتری تا کنون نتوانسته‌ام قسم بخورم. دستش را دراز کرد که به اکراه فشار دادم و بعد شیشه‌ی بزرگی را نشانم داد که وارونه بالای تخت آویزان بود و خرفهمم کرد که این جوری غذا به او می‌رسانند و عکس هم گرفته‌اند و تا فردا صبح اگر زخم‌ها چرک نکند، جا خواهند انداخت و گچ خواهند کرد. که یکی دیگر از راه رسید. گوشی به دست و سفید پوش و معطر. با حرکاتی مثل آرتیست سینما. سلامم کرد. صدایش در ته ذهنم چیزی را مختصر تکانی داد. اما احتیاجی به کنجکاوی نبود. یکی از شاگردهای نمی‌دانم چند سال پیشم بود. خودش خودش را معرفی کرد. آقای دکتر...! عجب روزگاری! هر تکه از وجودت را با مزخرفی از انبان مزخرفاتت، مثل ذره‌ای روزی در خاکی ریخته‌ای که حالا سبز کرده. چشم داری احمق. این تویی که روی تخت دراز کشیده‌ای. ده سال آزگار از پلکان ساعات و دقایق عمرت هر لحظه یکی بالا رفته و تو فقط خستگی این بار را هنوز در تن داری. این جوجه‌فکلی و جوجه‌های دیگر که نمی‌شناسی‌شان، همه از تخمی سر در آورده‌اند که روزی حصار جوانی تو بوده و حالا شکسته و خالی مانده. دستش را گرفتم و کشیدمش کناری و در گوشش هر چه بد و بی‌راه می‌دانستم، به او و همکارش و شغلش دادم. مثلاً می‌خواستم سفارش معلم کلاس چهار مدرسه‌ام را کرده باشم. بعد هم سری برای پدر تکان دادم و گریختم. از در که بیرون آمدم، حیاط بود و هوای بارانی. از در بزرگ که بیرون آمدم به این فکر می‌کردم که «اصلا به تو چه؟ اصلاً چرا آمدی؟ می‌خواستی کنجکاوی‌ات را سیرکنی؟» و دست آخر به این نتیجه رسیدم که «طعمه‌ای برای میزنشین‌های شهربانی و دادگستری به دست آمده و تو نه می‌توانی این طعمه را از دستشان بیرون بیاوری و نه هیچ کار دیگری می‌توانی بکنی...» + +و داشتم سوار تاکسی می‌شدم تا برگردم خانه که یک دفعه به صرافت افتادم که اقلاً چرا نپرسیدی چه بلایی به سرش آمده؟» خواستم عقب‌گرد کنم، اما هیکل کبود معلم کلاس چهارم روی تخت بود و دیدم نمی‌توانم. خجالت می‌کشیدم و یا می‌ترسیدم. آن شب تا ساعت دو بیدار بودم و فردا یک گزارش مفصل به امضای مدیر مدرسه و شهادت همه‌ی معلم‌ها برای اداره‌ی فرهنگ و کلانتری محل و بعد هم دوندگی در اداره‌ی بیمه و قرار بر این که روزی نه تومان بودجه برای خرج بیمارستان او بدهند و عصر پس از مدتی رفتم مدرسه و کلاس‌ها را تعطیل کردم و معلم‌ها و بچه‌های ششم را فرستادم عیادتش و دسته گل و ازین بازی‌ها... و یک ساعتی در مدرسه تنها ماندم و فارغ از همه چیز برای خودم خیال بافتم.... و فردا صبح پدرش آمد سلام و احوالپرسی و گفت یک دست و یک پایش شکسته و کمی خونریزی داخل مغز و از طرف یارو آمریکاییه آمده‌اند عیادتش و وعده و وعید که وقتی خوب شد، در اصل چهار استخدامش کنند و با زبان بی‌زبانی حالیم کرد که گزارش را بیخود داده‌ام و حالا هم داده‌ام، دنبالش نکنم و رضایت طرفین و کاسه‌ی از آش داغ‌تر و از این حرف‌ها... خاک بر سر مملکت. + +اوایل امر توجهی به بچه‌ها نداشتم. خیال می‌کردم اختلاف سِنی میان‌مان آن قدر هست که کاری به کار همدیگر نداشته باشیم. همیشه سرم به کار خودم بود. در دفتر را می‌بستم و در گرمای بخاری دولت قلم صد تا یک غاز می‌زدم. اما این کار مرتب سه چهار هفته بیش‌تر دوام نکرد. خسته شدم. ناچار به مدرسه بیشتر می‌رسیدم. یاد روزهای قدیمی با دوستان قدیمی به خیر چه آدم‌های پاک و بی‌آلایشی بودند، چه شخصیت‌های بی‌نام و نشانی و هر کدام با چه زبانی و با چه ادا و اطوارهای مخصوص به خودشان و این جوان‌های چلفته‌ای. چه مقلدهای بی‌دردسری برای فرهنگی‌مابی! نه خبری از دیروزشان داشتند و نه از املاک تازه‌ای که با هفتاد واسطه به دست‌شان داده بودند، چیزی سرشان می‌شد. بدتر از همه بی‌دست و پایی‌شان بود. آرام و مرتب درست مثل واگن شاه عبدالعظیم می‌آمدند و می‌رفتند. فقط بلد بودند روزی ده دقیقه دیرتر بیایند و همین. و از این هم بدتر تنگ‌نظری‌شان بود. + +سه بار شاهد دعواهایی بودم که سر یک گلدان میخک یا شمعدانی بود. بچه‌باغبان‌ها زیاد بودند و هر کدام‌شان حداقل ماهی یک گلدان میخک یا شمعدانی می‌آوردند که در آن برف و سرما نعمتی بود. اول تصمیم گرفتم، مدرسه را با آن‌ها زینت دهم. ولی چه فایده؟ نه کسی آب‌شان می‌داد و نه مواظبتی. و باز بدتر از همه‌ی این‌ها، بی‌شخصیتی معلم‌ها بود که درمانده‌ام کرده بود. دو کلمه نمی‌توانستند حرف بزنند. عجب هیچ‌کاره‌هایی بودند! احساس کردم که روز به روز در کلاس‌ها معلم‌ها به جای دانش‌آموزان جاافتاده‌تر می‌شوند. در نتیجه گفتم بیش‌تر متوجه بچه‌ها باشم. + +آن‌ها که تنها با ناظم سر و کار داشتند و مثل این بود که به من فقط یک سلام نیمه‌جویده بدهکارند. با این همه نومیدکننده نبودند. توی کوچه مواظب‌شان بودم. می‌خواستم حرف و سخن‌ها و درد دل‌ها و افکارشان را از یک فحش نیمه‌کاره یا از یک ادای نیمه‌تمام حدس بزنم، که سلام‌نکرده در می‌رفتند. خیلی کم تنها به مدرسه می‌آمدند. پیدا بود که سر راه همدیگر می‌ایستند یا در خانه‌ی یکدیگر می‌روند. سه چهار نفرشان هم با اسکورت می‌آمدند. از بیست سی نفری که ناهار می‌ماندند، فقط دو نفرشان چلو خورش می‌آوردند؛ فراش اولی مدرسه برایم خبر می‌آورد. بقیه گوشت‌کوبیده، پنیر گردوئی، دم پختکی و از این جور چیزها. دو نفرشان هم بودند که نان سنگک خالی می‌آوردند. برادر بودند. پنجم و سوم. صبح که می‌آمدند، جیب‌هاشان باد کرده بود. سنگک را نصف می‌کردند و توی جیب‌هاشان می‌تپاندند و ظهر می‌شد، مثل آن‌هایی که ناهارشان را در خانه می‌خورند، می‌رفتند بیرون. من فقط بیرون رفتن‌شان را می‌دیدم. اما حتی همین‌ها هر کدام روزی، یکی دو قران از فراش مدرسه خرت و خورت می‌خریدند. از همان فراش قدیمی مدرسه که ماهی پنج تومان سرایداریش را وصول کرده بودم. هر روز که وارد اتاقم می‌شدم پشت سر من می‌آمد بارانی‌ام را بر می‌داشت و شروع می‌کرد به گزارش دادن، که دیروز باز دو نفر از معلم‌ها سر یک گلدان دعوا کرده‌اند یا مأمور فرماندار نظامی آمده یا دفتردار عوض شده و از این اباطیل... پیدا بود که فراش جدید هم در مطالبی که او می‌گفت، سهمی دارد. + +یک روز در حین گزارش دادن، اشاره‌ای کرد به این مطلب که دیروز عصر یکی از بچه‌های کلاس چهار دو تا کله قند به او فروخته است. درست مثل اینکه سر کلاف را به دستم داده باشد پرسیدم: + +- چند؟ + +- دو تومنش دادم آقا. + +- زحمت کشیدی. نگفتی از کجا آورده؟ + +- من که ضامن بهشت و جهنمش نبودم آقا. + +بعد پرسیدم: + +- چرا به آقای ناظم خبر ندادی؟ + +می‌دانستم که هم او و هم فراش جدید، ناظم را هووی خودشان می‌دانند و خیلی چیزهاشان از او مخفی بود. این بود که میان من و ناظم خاصه‌خرجی می‌کردند. در جوابم همین طور مردد مانده بود که در باز شد و فراش جدید آمد تو. که: + +- اگه خبرش می‌کرد آقا بایست سهمش رو می‌داد... + +اخمم را درهم کشیدم و گفتم: + +- تو باز رفتی تو کوک مردم! اونم این جوری سر نزده که نمی‌آیند تو اتاق کسی، پیرمرد! + +و بعد اسم پسرک را ازشان پرسیدم و حالی‌شان کردم که چندان مهم نیست و فرستادمشان برایم چای بیاورند. بعد کارم را زودتر تمام کردم و رفتم به اتاق دفتر احوالی از مادر ناظم پرسیدم و به هوای ورق زدن پرونده‌ها فهمیدم که پسرک شاگرد دوساله است و پدرش تاجر بازار. بعد برگشتم به اتاقم. یادداشتی برای پدر نوشتم که پس فردا صبح، بیاید مدرسه و دادم دست فراش جدید که خودش برساند و رسیدش را بیاورد. + +و پس فردا صبح یارو آمد. باید مدیر مدرسه بود تا دانست که اولیای اطفال چه راحت تن به کوچک‌ترین خرده‌فرمایش‌های مدرسه می‌دهند. حتم دارم که اگر از اجرای ثبت هم دنبال‌شان بفرستی به این زودی‌ها آفتابی نشوند. چهل و پنج ساله مردی بود با یخه‌ی بسته بی‌کراوات و پالتویی که بیش‌تر به قبا می‌ماند. و خجالتی می‌نمود. هنوز ننشسته، پرسیدم: + +- شما دو تا زن دارید آقا؟ + +درباره‌ی پسرش برای خودم پیش‌گویی‌هایی کرده بودم و گفتم این طوری به او رودست می‌زنم. پیدا بود که از سؤالم زیاد یکه نخورده است. گفتم برایش چای آوردند و سیگاری تعارفش کردم که ناشیانه دود کرد از ترس این که مبادا جلویم در بیاید که - به شما چه مربوط است و از این اعتراض‌ها - امانش ندادم و سؤالم را این جور دنبال کردم: + +- البته می‌بخشید. چون لابد به همین علت بچه شما دو سال در یک کلاس مانده. + +شروع کرده بودم برایش یک میتینگ بدهم که پرید وسط حرفم: + +- به سر شما قسم، روزی چهار زار پول تو جیبی داره آقا. پدرسوخته‌ی نمک به حروم...! + +حالیش کردم که علت، پول تو جیبی نیست و خواستم که عصبانی نشود و قول گرفتم که اصلاً به روی پسرش هم نیاورد و آن وقت میتینگم را برایش دادم که لابد پسر در خانه مهر و محبتی نمی‌بیند و غیب‌گویی‌های دیگر... تا عاقبت یارو خجالتش ریخت و سرِ درد دلش باز شد که عفریته زن اولش همچه بوده و همچون بوده و پسرش هم به خودش برده و کی طلاقش داده و از زن دومش چند تا بچه دارد و این نره‌خر حالا باید برای خودش نان‌آور شده باشد و زنش حق دارد که با دو تا بچه‌ی خرده‌پا به او نرسد... من هم کلی برایش صحبت کردم. چایی دومش را هم سر کشید و قول‌هایش را که داد و رفت، من به این فکر افتادم که «نکند علمای تعلیم و تربیت هم، همین جورها تخم دوزرده می‌کنند!» + +یک روز صبح که رسیدم، ناظم هنوز نیامده بود. از این اتفاق‌ها کم می‌افتاد. ده دقیقه‌ای از زنگ می‌گذشت و معلم‌ها در دفتر سرگرم اختلاط بودند. خودم هم وقتی معلم بودم به این مرض دچار بودم. اما وقتی مدیر شدم تازه فهمیدم که معلم‌ها چه لذتی می‌برند. حق هم داشتند. آدم وقتی مجبور باشد شکلکی را به صورت بگذارد که نه دیگران از آن می‌خندند و نه خود آدم لذتی می‌برد، پیداست که رفع تکلیف می‌کند. زنگ را گفتم زدند و بچه‌ها سر کلاس رفتند. دو تا از کلاس‌ها بی‌معلم بود. یکی از ششمی‌ها را فرستادم سر کلاس سوم که برای‌شان دیکته بگوید و خودم رفتم سر کلاس چهار. مدیر هم که باشی، باز باید تمرین کنی که مبادا فوت و فن معلمی از یادت برود. در حال صحبت با بچه‌ها بودم که فراش خبر آورد که خانمی توی دفتر منتظرم است. خیال کردم لابد همان زنکه‌ی بیکاره‌ای است که هفته‌ای یک بار به هوای سرکشی، به وضع درس و مشق بچه‌اش سری می‌زند. زن سفیدرویی بود با چشم‌های درشت محزون و موی بور. بیست و پنج ساله هم نمی‌نمود. اما بچه‌اش کلاس سوم بود. روز اول که دیدمش لباس نارنجی به تن داشت و تن بزک کرده بود. از زیارت من خیلی خوشحال شد و از مراتب فضل و ادبم خبر داشت. + +خیلی ساده آمده بود تا با دو تا مرد حرفی زده باشد. آن طور که ناظم خبر می‌داد، یک سالی طلاق گرفته بود و روی هم رفته آمد و رفتنش به مدرسه باعث دردسر بود. وسط بیابان و مدرسه‌ای پر از معلم‌های عزب و بی‌دست و پا و یک زن زیبا... ناچار جور در نمی‌آمد. این بود که دفعات بعد دست به سرش می‌کردم، اما از رو نمی‌رفت. سراغ ناظم و اتاق دفتر را می‌گرفت و صبر می‌کرد تا زنگ را بزنند و معلم‌ها جمع بشوند و لابد حرف و سخنی و خنده‌ای و بعد از معلم کلاس سوم سراغ کار و بار و بچه‌اش را می‌گرفت و زنگ بعد را که می‌زدند، خداحافظی می‌کرد و می‌رفت. آزاری نداشت. با چشم‌هایش نفس معلم‌ها را می‌برید. و حالا باز هم همان زن بود و آمده بود و من تا از پلکان پایین بروم در ذهنم جملات زننده‌ای ردیف می‌کردم، تا پایش را از مدرسه ببرد که در را باز کردم و سلام... + +عجب! او نبود. دخترک یکی دو ساله‌ای بود با دهان گشاد و موهای زبرش را به زحمت عقب سرش گلوله کرده بود و بفهمی نفهمی دستی توی صورتش برده بود. روی هم رفته زشت نبود. اما داد می‌زد که معلم است. گفتم که مدیر مدرسه‌ام و حکمش را داد دستم که دانشسرا دیده بود و تازه استخدام شده بود. برایمان معلم فرستاده بودند. خواستم بگویم «مگر رئیس فرهنگ نمی‌داند که این جا بیش از حد مرد است» ولی دیدم لزومی ندارد و فکر کردم این هم خودش تنوعی است. + +به هر صورت زنی بود و می‌توانست محیط خشن مدرسه را که به طرز ناشیانه‌ای پسرانه بود، لطافتی بدهد و خوش‌آمد گفتم و چای آوردند که نخورد و بردمش کلاس‌های سوم و چهارم را نشانش دادم که هر کدام را مایل است، قبول کند و صحبت از هجده ساعت درس که در انتظار او بود و برگشتیم به دفتر .پرسید غیر از او هم، معلم زن داریم. گفتم: + +- متأسفانه راه مدرسه‌ی ما را برای پاشنه‌ی کفش خانم‌ها نساخته‌اند. + +که خندید و احساس کردم زورکی می‌خندد. بعد کمی این دست و آن دست کرد و عاقبت: + +- آخه من شنیده بودم شما با معلماتون خیلی خوب تا می‌کنید. + +صدای جذابی داشت. فکر کردم حیف که این صدا را پای تخته سیاه خراب خواهد کرد. و گفتم: + +- اما نه این قدر که مدرسه تعطیل بشود خانم! و لابد به عرض‌تون رسیده که همکارهای شما، خودشون نشسته‌اند و تصمیم گرفته‌اند که هجده ساعت درس بدهند. بنده هیچ‌کاره‌ام. + +- اختیار دارید. + +و نفهمیدم با این «اختیار دارید» چه می‌خواست بگوید. اما پیدا بود که بحث سر ساعات درس نیست. آناً تصمیم گرفتم، امتحانی بکنم: + +- این را هم اطلاع داشته باشید که فقط دو تا از معلم‌های ما متأهل‌اند. + +که قرمز شد و برای این که کار دیگری نکرده باشد، برخاست و حکمش را از روی میز برداشت. پا به پا می‌شد که دیدم باید به دادش برسم. ساعت را از او پرسیدم. وقت زنگ بود. فراش را صدا کردم که زنگ را بزند و بعد به او گفتم، بهتر است مشورت دیگری هم با رئیس فرهنگ بکند و ما به هر صورت خوشحال خواهیم شد که افتخار همکاری با خانمی مثل ایشان را داشته باشیم و خداحافظ شما. از در دفتر که بیرون رفت، صدای زنگ برخاست و معلم‌ها انگار موشان را آتش زده‌اند، به عجله رسیدند و هر کدام از پشت سر، آن قدر او را پاییدند تا از در بزرگ آهنی مدرسه بیرون رفت. + +فردا صبح معلوم شد که ناظم، دنبال کار مادرش بوده است که قرار بود بستری شود، تا جای سرطان گرفته را یک دوره برق بگذارند. کل کار بیمارستان را من به کمک دوستانم انجام دادم و موقع آن رسیده بود که مادرش برود بیمارستان اما وحشتش گرفته بود و حاضر نبود به بیمارستان برود. و ناظم می‌خواست رسماً دخالت کنم و با هم برویم خانه‌شان و با زبان چرب و نرمی که به قول ناظم داشتم مادرش را راضی کنم. چاره‌ای نبود. مدرسه را به معلم‌ها سپردیم و راه افتادیم. بالاخره به خانه‌ی آن‌ها رسیدیم. خانه‌ای بسیار کوچک و اجاره‌ای. مادر با چشم‌های گود نشسته و انگار زغال به صورت مالیده! سیاه نبود اما رنگش چنان تیره بود که وحشتم گرفت. اصلاً صورت نبود. زخم سیاه شده‌ای بود که انگار از جای چشم‌ها و دهان سر باز کرده است. کلی با مادرش صحبت کردم. از پسرش و کلی دروغ و دونگ، و چادرش را روی چارقدش انداختیم و علی... و خلاصه در بیمارستان بستری شدند. + +فردا که به مدرسه آمدم، ناظم سرحال بود و پیدا بود که از شر چیزی خلاص شده است و خبر داد که معلم کلاس سه را گرفته‌اند. یک ماه و خرده‌ای می‌شد که مخفی بود و ما ورقه‌ی انجام کارش را به جانشین غیر رسمی‌اش داده بودیم و حقوقش لنگ نشده بود و تا خبر رسمی بشنود و در روزنامه‌ای بیابد و قضیه به اداره‌ی فرهنگ و لیست حقوق بکشد، باز هم می‌دادیم. اما خبر که رسمی شد، جانشین واجد شرایط هم نمی‌توانست بفرستد و باید طبق مقررات رفتار می‌کردیم و بدیش همین بود. کم کم احساس کردم که مدرسه خلوت شده است و کلاس‌ها اغلب اوقات بی‌کارند. جانشین معلم کلاس چهار هنوز سر و صورتی به کارش نداده بود و حالا یک کلاس دیگر هم بی‌معلم شد. این بود که باز هم به سراغ رئیس فرهنگ رفتم. معلوم شد آن دخترک ترسیده و «نرسیده متلک پیچش کرده‌اید» رئیس فرهنگ این طور می‌گفت. و ترجیح داده بود همان زیر نظر خودش دفترداری کند. و بعد قول و قرار و فردا و پس فردا و عاقبت چهار روز دوندگی تا دو تا معلم گرفتم. یکی جوانکی رشتی که گذاشتیمش کلاس چهار و دیگری باز یکی ازین آقاپسرهای بریانتین‌زده که هر روز کراوات عوض می‌کرد، با نقش‌ها و طرح‌های عجیب. عجب فرهنگ را با قرتی‌ها در آمیخته بودند! باداباد. او را هم گذاشتیم سر کلاس سه. اواخر بهمن، یک روز ناظم آمد اتاقم که بودجه‌ی مدرسه را زنده کرده است. گفتم: + +- مبارکه، چه قدر گرفتی؟ + +- هنوز هیچ چی آقا. قراره فردا سر ظهر بیاند این جا آقا و همین جا قالش رو بکنند. + +و فردا اصلاً مدرسه نرفتم. حتماً می‌خواست من هم باشم و در بده بستان ماهی پانزده قران، حق نظافت هر اتاق نظارت کنم و از مدیریتم مایه بگذارم تا تنخواه‌گردان مدرسه و حق آب و دیگر پول‌های عقب‌افتاده وصول بشود... فردا سه نفری آمده بودند مدرسه. ناهار هم به خرج ناظم خورده بودند. و قرار دیگری برای یک سور حسابی گذاشته بودند و رفته بودند و ناظم با زبان بی‌زبانی حالیم کرد که این بار حتماً باید باشم و آن طور که می‌گفت، جای شکرش باقی بود که مراعات کرده بودند و حق بوقی نخواسته بودند. اولین باری بود که چنین اهمیتی پیدا می‌کردم. این هم یک مزیت دیگر مدیری مدرسه بود! سی صد تومان از بودجه‌ی دولت بسته به این بود که به فلان مجلس بروی یا نروی. تا سه روز دیگر موعد سور بود، اصلاً یادم نیست چه کردم. اما همه‌اش در این فکر بودم که بروم یا نروم؟ یک بار دیگر استعفانامه‌ام را توی جیبم گذاشتم و بی این که صدایش را در بیاورم، روز سور هم نرفتم. + +بعد دیدم این طور که نمی‌شود. گفتم بروم قضایا را برای رئیس فرهنگ بگویم. و رفتم. سلام و احوالپرسی نشستم. اما چه بگویم؟ بگویم چون نمی‌خواستم در خوردن سور شرکت کنم، استعفا می‌دهم؟... دیدم چیزی ندارم که بگویم. و از این گذشته خفت‌آور نبود که به خاطر سیصد تومان جا بزنم و استعفا بدهم؟ و «خداحافظ؛ فقط آمده بودم سلام عرض کنم.» و از این دروغ‌ها و استعفانامه‌ام را توی جوی آب انداختم. اما ناظم؛ یک هفته‌ای مثل سگ بود. عصبانی، پر سر و صدا و شارت و شورت! حتی نرفتم احوال مادرش را بپرسم. یک هفته‌ی تمام می‌رفتم و در اتاقم را می‌بستم و سوراخ‌های گوشم را می‌گرفتم و تا اِز و چِزّ بچه‌ها بخوابد، از این سر تا آن سر اتاق را می‌کوبیدم. ده روز تمام، قلب من و بچه‌ها با هم و به یک اندازه از ترس و وحشت تپید. تا عاقبت پول‌ها وصول شد. منتها به جای سیصد و خرده‌ای، فقط صد و پنجاه تومان. علت هم این بود که در تنظیم صورت حساب‌ها اشتباهاتی رخ داده بود که ناچار اصلاحش کرده بودند! + +غیر از آن زنی که هفته‌ای یک بار به مدرسه سری می‌زد، از اولیای اطفال دو سه نفر دیگر هم بودند که مرتب بودند. یکی همان پاسبانی که با کمربند، پاهای پسرش را بست و فلک کرد. یکی هم کارمند پست و تلگرافی بود که ده روزی یک بار می‌آمد و پدر همان بچه‌ی شیطان. و یک استاد نجار که پسرش کلاس اول بود و خودش سواد داشت و به آن می‌بالید و کارآمد می‌نمود. یک مقنی هم بود درشت استخوان و بلندقد که بچه‌اش کلاس سوم بود و هفته‌ای یک بار می‌آمد و همان توی حیاط، ده پانزده دقیقه‌ای با فراش‌ها اختلاط می‌کرد و بی سر و صدا می‌رفت. نه کاری داشت، نه چیزی از آدم می‌خواست و همان طور که آمده بود چند دقیقه‌ای را با فراش صحبت می‌کرد و بعد می رفت. فقط یک روز نمی‌دانم چرا رفته بود بالای دیوار مدرسه. البته اول فکر کردم مأمور اداره برق است ولی بعد متوجه شدم که همان مرد مقنی است. بچه‌ها جیغ و فریاد می‌کردند و من همه‌اش درین فکر بودم که چه طور به سر دیوار رفته است؟ ماحصل داد و فریادش این بود که چرا اسم پسر او را برای گرفتن کفش و لباس به انجمن ندادیم. وقتی به او رسیدم نگاهی به او انداختم و بعد تشری به ناظم و معلم ها زدم که ولش کردند و بچه‌ها رفتند سر کلاس و بعد بی این که نگاهی به او بکنم، گفتم: + +- خسته نباشی اوستا. + +و همان طور که به طرف دفتر می‌رفتم رو به ناظم و معلم‌ها افزودم: + +- لابد جواب درست و حسابی نشنیده که رفته سر دیوار. + +که پشت سرم گرپ صدایی آمد و از در دفتر که رفتم تو، او و ناظم با هم وارد شدند. گفتم نشست. و به جای این‌که حرفی بزند به گریه افتاد. هرگز گمان نمی‌کردم از چنان قد و قامتی صدای گریه در بیاید. این بود که از اتاق بیرون آمدم و فراش را صدا زدم که آب برایش بیاورد و حالش که جا آمد، بیاوردش پهلوی من. اما دیگر از او خبری نشد که نشد. نه آن روز و نه هیچ روز دیگر. آن روز چند دقیقه‌ای بعد از شیشه‌ی اتاق خودم دیدمش که دمش را لای پایش گذاشته بود از در مدرسه بیرون می‌رفت و فراش جدید آمد که بله می‌گفتند از پسرش پنج تومان خواسته بودند تا اسمش را برای کفش و لباس به انجمن بدهند. پیدا بود باز توی کوک ناظم رفته است. مرخصش کردم و ناظم را خواستم. معلوم شد می‌خواسته ناظم را بزند. همین جوری و بی‌مقدمه. + +اواخر بهمن بود که یکی از روزهای برفی با یکی دیگر از اولیای اطفال آشنا شدم. یارو مرد بسیار کوتاهی بود؛ فرنگ مآب و بزک کرده و اتو کشیده که ننشسته از تحصیلاتش و از سفرهای فرنگش حرف زد. می‌خواست پسرش را آن وقت سال از مدرسه‌ی دیگر به آن جا بیاورد. پسرش از آن بچه‌هایی بود که شیر و مربای صبحانه‌اش را با قربان صدقه توی حلقشان می‌تپانند. کلاس دوم بود و ثلث اول دو تا تجدید آورده بود. می‌گفت در باغ ییلاقی‌اش که نزدیک مدرسه است، باغبانی دارند که پسرش شاگرد ماست و درس‌خوان است و پیدا است که بچه‌ها زیر سایه شما خوب پیشرفت می‌کنند. و از این پیزرها. و حال به خاطر همین بچه، توی این برف و سرما، آمده‌اند ساکن باغ ییلاقی شده‌اند. بلند شدم ناظم را صدا کردم و دست او و بچه‌اش را توی دست ناظم گذاشتم و خداحافظ شما... و نیم ساعت بعد ناظم برگشت که یارو خانه‌ی شهرش را به یک دبیرستان اجاره داده، به ماهی سه هزار و دویست تومان، و التماس دعا داشته، یعنی معلم سرخانه می‌خواسته و حتی بدش نمی‌آمده است که خود مدیر زحمت بکشند و ازین گنده‌گوزی‌ها... احساس کردم که ناظم دهانش آب افتاده است. و من به ناظم حالی کردم خودش برود بهتر است و فقط کاری بکند که نه صدای معلم‌ها در بیاید و نه آخر سال، برای یک معدل ده احتیاجی به من بمیرم و تو بمیری پیدا کند. همان روز عصر ناظم رفته بود و قرار و مدار برای هر روز عصر یک ساعت به ماهی صد و پنجاه تومان. + +دیگر دنیا به کام ناظم بود. حال مادرش هم بهتر بود و از بیمارستان مرخصش کرده بودند و به فکر زن گرفتن افتاده بود. و هر روز هم برای یک نفر نقشه می‌کشید حتی برای من هم. یک روز در آمد که چرا ما خودمان «انجمن خانه و مدرسه» نداشته باشیم؟ نشسته بود و حسابش را کرده بود دیده بود که پنجاه شصت نفری از اولیای مدرسه دستشان به دهان‌شان می‌رسد و از آن هم که به پسرش درس خصوصی می‌داد قول مساعد گرفته بود. حالیش کردم که مواظب حرف و سخن اداره‌ای باشد و هر کار دلش می‌خواهد بکند. کاغذ دعوت را هم برایش نوشتم با آب و تاب و خودش برای اداره‌ی فرهنگ، داد ماشین کردند و به وسیله‌ی خود بچه‌ها فرستاد. و جلسه با حضور بیست و چند نفری از اولیای بچه‌ها رسمی شد. خوبیش این بود که پاسبان کشیک پاسگاه هم آمده بود و دم در برای همه، پاشنه‌هایش را به هم می‌کوبید و معلم‌ها گوش تا گوش نشسته بودند و مجلس ابهتی داشت و ناظم، چای و شیرینی تهیه کرده بود و چراغ زنبوری کرایه کرده بود و باران هم گذاشت پشتش و سالون برای اولین بار در عمرش به نوایی رسید. + +یک سرهنگ بود که رئیسش کردیم و آن زن را که هفته‌ای یک بار می‌آمد نایب رئیس. آن که ناظم به پسرش درس خصوصی می‌داد نیامده بود. اما پاکت سربسته‌ای به اسم مدیر فرستاده بود که فی‌المجلس بازش کردیم. عذرخواهی از این‌که نتوانسته بود بیاید و وجه ناقابلی جوف پاکت. صد و پنجاه تومان. و پول را روی میز صندوق‌دار گذاشتیم که ضبط و ربط کند. نائب رئیس بزک کرده و معطر شیرینی تعارف می‌کرد و معلم‌ها با هر بار که شیرینی بر می‌داشتند، یک بار تا بناگوش سرخ می‌شدند و فراش‌ها دست به دست چای می‌آوردند. + +در فکر بودم که یک مرتبه احساس کردم، سیصد چهارصد تومان پول نقد، روی میز است و هشت صد تومان هم تعهد کرده بودند. پیرزن صندوقدار که کیف پولش را همراهش نیاورده بود ناچار حضار تصویب کردند که پول‌ها فعلاً پیش ناظم باشد. و صورت مجلس مرتب شد و امضاها ردیف پای آن و فردا فهمیدم که ناظم همان شب روی خشت نشسته بوده و به معلم‌ها سور داده بوده است. اولین کاری که کردم رونوشت مجلس آن شب را برای اداره‌ی فرهنگ فرستادم. و بعد همان استاد نجار را صدا کردم و دستور دادم برای مستراح‌ها دو روزه در بسازد که ناظم خیلی به سختی پولش را داد. و بعد در کوچه‌ی مدرسه درخت کاشتیم. تور والیبال را تعویض و تعدادی توپ در اختیار بچه‌ها گذاشتیم برای تمرین در بعد از ظهرها و آمادگی برای مسابقه با دیگر مدارس و در همین حین سر و کله‌ی بازرس تربیت بدنی هم پیدا شد و هر روز سرکشی و بیا و برو. تا یک روز که به مدرسه رسیدم شنیدم که از سالون سر و صدا می‌آید. صدای هالتر بود. ناظم سر خود رفته بود و سرخود دویست سیصد تومان داده بود و هالتر خریده بود و بچه‌های لاغر زیر بار آن گردن خود را خرد می‌کردند. من در این میان حرفی نزدم. می‌توانستم حرفی بزنم؟ من چیکاره بودم؟ اصلاً به من چه ربطی داشت؟ هر کار که دلشان می‌خواهد بکنند. مهم این بود که سالون مدرسه رونقی گرفته بود. ناظم هم راضی بود و معلم‌ها هم. چون نه خبر از حسادتی بود و نه حرف و سخنی پیش آمد. فقط می‌بایست به ناظم سفارش می کردم که فکر فراش‌ها هم باشد. + +کم کم خودمان را برای امتحان‌های ثلث دوم آماده می‌کردیم. این بود که اوایل اسفند، یک روز معلم‌ها را صدا زدم و در شورا مانندی که کردیم بی‌مقدمه برایشان داستان یکی از همکاران سابقم را گفتم که هر وقت بیست می‌داد تا دو روز تب داشت. البته معلم‌ها خندیدند. ناچار تشویق شدم و داستان آخوندی را گفتم که در بچگی معلم شرعیاتمان بود و زیر عبایش نمره می‌داد و دستش چنان می‌لرزید که عبا تکان می‌خورد و درست ده دقیقه طول می‌کشید. و تازه چند؟ بهترین شاگردها دوازده. و البته باز هم خندیدند. که این بار کلافه‌ام کرد. و بعد حالیشان کردم که بد نیست در طرح سؤال‌ها مشورت کنیم و از این حرف‌ها... + +و از شنبه‌ی بعد، امتحانات شروع شد. درست از نیمه‌ی دوم اسفند. سؤال‌ها را سه نفری می‌دیدیم. خودم با معلم هر کلاس و ناظم. در سالون میزها را چیده بودیم البته از وقتی هالتردار شده بود خیلی زیباتر شده بود. در سالون کاردستی‌های بچه‌ها در همه جا به چشم می‌خورد. هر کسی هر چیزی را به عنوان کاردستی درست کرده بودند و آورده بودند. که برای این کاردستی‌ها چه پول‌ها که خرج نشده بود و چه دست‌ها که نبریده بود و چه دعواها که نشده بود و چه عرق‌ها که ریخته نشده بود. پیش از هر امتحان که می‌شد، خودم یک میتینگ برای بچه‌ها می‌دادم که ترس از معلم و امتحان بی‌جا است و باید اعتماد به نفس داشت و ازین مزخرفات....ولی مگر حرف به گوش کسی می‌رفت؟ از در که وارد می‌شدند، چنان هجومی می‌بردند که نگو! به جاهای دور از نظر. یک بار چنان بود که احساس کردم مثل این‌که از ترس، لذت می‌برند. اگر معلم نبودی یا مدیر، به راحتی می‌توانستی حدس بزنی که کی‌ها با هم قرار و مداری دارند و کدام یک پهلو دست کدام یک خواهد نشست. یکی دو بار کوشیدم بالای دست یکی‌شان بایستم و ببینم چه می‌نویسد. ولی چنان مضطرب می‌شدند و دستشان به لرزه می‌افتاد که از نوشتن باز می‌ماندند. می‌دیدم که این مردان آینده، درین کلاس‌ها و امتحان‌ها آن قدر خواهند ترسید که وقتی دیپلمه بشوند یا لیسانسه، اصلاً آدم نوع جدیدی خواهند شد. آدمی انباشته از وحشت، انبانی از ترس و دلهره. به این ترتیب یک روز بیشتر دوام نیاوردم. چون دیدم نمی‌توانم قلب بچگانه‌ای داشته باشم تا با آن ترس و وحشت بچه‌ها را درک کنم و هم‌دردی نشان بدهم.این جور بود که می‌دیدم که معلم مدرسه هم نمی‌توانم باشم. + +دو روز قبل از عید کارنامه‌ها آماده بود و منتظر امضای مدیر. دویست و سی و شش تا امضا اقلاً تا ظهر طول می‌کشید. پیش از آن هم تا می‌توانستم از امضای دفترهای حضور و غیاب می‌گریختم. خیلی از جیره‌خورهای دولت در ادارات دیگر یا در میان همکارانم دیده بودم که در مواقع بیکاری تمرین امضا می‌کنند. پیش از آن نمی‌توانستم بفهمم چه طور از مدیری یک مدرسه یا کارمندی ساده یک اداره می‌شود به وزارت رسید. یا اصلاً آرزویش را داشت. نیم‌قراضه امضای آماده و هر کدام معرف یک شخصیت، بعد نیم‌ذرع زبان چرب و نرم که با آن، مار را از سوراخ بیرون بکشی، یا همه جا را بلیسی و یک دست هم قیافه. نه یک جور. دوازده جور. + +در این فکرها بودم که ناگهان در میان کارنامه‌ها چشمم به یک اسم آشنا افتاد. به اسم پسران جناب سرهنگ که رئیس انجمن بود. رفتم توی نخ نمراتش. همه متوسط بود و جای ایرادی نبود. و یک مرتبه به صرافت افتادم که از اول سال تا به حال بچه‌های مدرسه را فقط به اعتبار وضع مالی پدرشان قضاوت کرده‌ام. درست مثل این پسر سرهنگ که به اعتبار کیابیای پدرش درس نمی‌خواند. دیدم هر کدام که پدرشان فقیرتر است به نظر من باهوش‌تر می‌آمده‌اند. البته ناظم با این حرف‌ها کاری نداشت. مر قانونی را عمل می‌کرد. از یکی چشم می‌پوشید به دیگری سخت می‌گرفت. + +اما من مثل این که قضاوتم را درباره‌ی بچه‌ها از پیش کرده باشم و چه خوب بود که نمره‌ها در اختیار من نبود و آن یکی هم «انظباط» مال آخر سال بود. مسخره‌ترین کارها آن است که کسی به اصلاح وضعی دست بزند، اما در قلمروی که تا سر دماغش بیشتر نیست. و تازه مدرسه‌ی من، این قلمروی فعالیت من، تا سر دماغم هم نبود. به همان توی ذهنم ختم می‌شد. وضعی را که دیگران ترتیب داده بودند. به این ترتیب بعد از پنج شش ماه، می‌فهمیدم که حسابم یک حساب عقلایی نبوده است. احساساتی بوده است. ضعف‌های احساساتی مرا خشونت‌های عملی ناظم جبران می‌کرد و این بود که جمعاً نمی‌توانستم ازو بگذرم. مرد عمل بود. کار را می‌برید و پیش می‌رفت. در زندگی و در هر کاری، هر قدمی بر می‌داشت، برایش هدف بود. و چشم از وجوه دیگر قضیه می‌پوشید. این بود که برش داشت. و من نمی‌توانستم. چرا که اصلاً مدیر نبودم. خلاص... + +و کارنامه‌ی پسر سرهنگ را که زیر دستم عرق کرده بود، به دقت و احتیاج خشک کردم و امضایی زیر آن گذاشتم به قدری بد خط و مسخره بود که به یاد امضای فراش جدیدمان افتادم. حتماً جناب سرهنگ کلافه می‌شد که چرا چنین آدم بی‌سوادی را با این خط و ربط امضا مدیر مدرسه کرده‌اند. آخر یک جناب سرهنگ هم می‌داند که امضای آدم معرف شخصیت آدم است. + +اواخر تعطیلات نوروز رفتم به ملاقات معلم ترکه‌ای کلاس سوم. ناظم که با او میانه‌ی خوشی نداشت. ناچار با معلم حساب کلاس پنج و شش قرار و مداری گذاشته بودم که مختصری علاقه‌ای هم به آن حرف و سخن‌ها داشت. هم به وسیله‌ی او بود که می‌دانستم نشانی‌اش کجا است و توی کدام زندان است. در راه قبل از هر چیز خبر داد که رئیس فرهنگ عوض شده و این طور که شایع است یکی از هم دوره‌ای‌های من، جایش آمده. گفتم: + +- عجب! چرا؟ مگه رئیس قبلی چپش کم بود؟ + +- چه عرض کنم. می‌گند پا تو کفش یکی از نماینده‌ها کرده. شما خبر ندارید؟ + +- چه طور؟ از کجا خبر داشته باشم؟ + +- هیچ چی... می گند دو تا از کارچاق‌کن‌های انتخاباتی یارو از صندوق فرهنگ حقوق می‌گرفته‌اند؛ شب عیدی رئیس فرهنگ حقوق‌شون رو زده. + +- عجب! پس اونم می‌خواسته اصلاحات کنه! بیچاره. + +و بعد از این حرف زدیم که الحمدالله مدرسه مرتب است و آرام و معلم‌ها همکاری می‌کنند و ناظم بیش از اندازه همه‌کاره شده است. و من فهمیدم که باز لابد مشتری خصوصی تازه‌ای پیدا شده است که سر و صدای همه همکارها بلند شده. دم در زندان شلوغ بود. کلاه مخملی‌ها، عم‌قزی گل‌بته‌ها، خاله خانباجی‌ها و... اسم نوشتیم و نوبت گرفتیم و به جای پاها، دست‌هامان زیر بار کوچکی که داشتیم، خسته شد و خواب رفت تا نوبتمان شد. از این اتاق به آن اتاق و عاقبت نرده‌های آهنی و پشت آن معلم کلاس سه و... عجب چاق شده بود!درست مثل یک آدم حسابی شده بود. خوشحال شدیم و احوالپرسی و تشکر؛ و دیگر چه بگویم؟ بگویم چرا خودت را به دردسر انداختی؟ پیدا بود از مدرسه و کلاس به او خوش‌تر می‌گذرد. ایمانی بود و او آن را داشت و خوشبخت بود و دردسری نمی‌دید و زندان حداقل برایش کلاس درس بود. عاقبت پرسیدم: + +- پرونده‌ای هم برات درست کردند یا هنوز بلاتکلیفی؟ + +- امتحانمو دادم آقا مدیر، بد از آب در نیومد. + +- یعنی چه؟ + +- یعنی بی‌تکلیف نیستم. چون اسمم تو لیست جیره‌ی زندون رفته. خیالم راحته. چون سختی‌هاش گذشته. + +دیگر چه بگویم. دیدم چیزی ندارم خداحافظی کردم و او را با معلم حساب تنها گذاشتم و آمدم بیرون و تا مدت ملاقات تمام بشود، دم در زندان قدم زدم و به زندانی فکر کردم که برای خودم ساخته بودم. یعنی آن خرپول فرهنگ‌دوست ساخته بود. و من به میل و رغبت خودم را در آن زندانی کرده بودم. این یکی را به ضرب دگنک این جا آورده بودند. ناچار حق داشت که خیالش راحت باشد. اما من به میل و رغبت رفته بودم و چه بکنم؟ ناظم چه طور؟ راستی اگر رئیس فرهنگ از هم دوره‌ای‌های خودم باشد؛ چه طور است بروم و ازو بخواهم که ناظم را جای من بگذارد، یا همین معلم حساب را؟... که معلم حساب در آمد و راه افتادیم. با او هم دیگر حرفی نداشتم. سر پیچ خداحافظ شما و تاکسی گرفتم و یک سر به اداره‌ی فرهنگ زدم. گرچه دهم عید بود، اما هنوز رفت و آمد سال نو تمام نشده بود. برو و بیا و شیرینی و چای دو جانبه. رفتم تو. سلام و تبریک و همین تعارفات را پراندم. + +بله خودش بود. یکی از پخمه‌های کلاس. که آخر سال سوم کشتیارش شدم دو بیت شعر را حفظ کند، نتوانست که نتوانست. و حالا او رئیس بود و من آقا مدیر. راستی حیف از من، که حتی وزیر چنین رئیس فرهنگ‌هایی باشم! میز همان طور پاک بود و رفته. اما زیرسیگاری انباشته از خاکستر و ته سیگار. بلند شد و چلپ و چولوپ روبوسی کردیم و پهلوی خودش جا باز کرد و گوش تا گوش جیره‌خورهای فرهنگ تبریکات صمیمانه و بدگویی از ماسبق و هندوانه و پیزرها! و دو نفر که قد و قواره‌شان به درد گود زورخانه می‌خورد یا پای صندوق انتخابات شیرینی به مردم می‌دادند. نزدیک بود شیرینی را توی ظرفش بیندازم که دیدم بسیار احمقانه است. سیگارم که تمام شد قضیه‌ی رئیس فرهنگ قبلی و آن دو نفر را در گوشی ازش پرسیدم، حرفی نزد. فقط نگاهی می‌کرد که شبیه التماس بود و من فرصت جستم تا وضع معلم کلاس سوم را برایش روشن کنم و از او بخواهم تا آن جا که می‌تواند جلوی حقوقش را نگیرد. و از در که آمدم بیرون، تازه یادم آمد که برای کار دیگری پیش رئیس فرهنگ بودم. + +باز دیروز افتضاحی به پا شد. معقول یک ماهه‌ی فروردین راحت بودیم. اول اردیبهشت ماه جلالی و کوس رسوایی سر دیوار مدرسه. نزدیک آخر وقت یک جفت پدر و مادر، بچه‌شان در میان، وارد اتاق شدند. یکی بر افروخته و دیگری رنگ و رو باخته و بچه‌شان عیناً مثل این عروسک‌های کوکی. سلام و علیک و نشستند. خدایا دیگر چه اتفاقی افتاده است؟ + +- چه خبر شده که با خانوم سرافرازمون کردید؟ + +مرد اشاره‌ای به زنش کرد که بلند شد و دست بچه را گرفت و رفت بیرون و من ماندم و پدر. اما حرف نمی‌زد. به خودش فرصت می‌داد تا عصبانیتش بپزد. سیگارم را در آوردم و تعارفش کردم. مثل این که مگس مزاحمی را از روی دماغش بپراند، سیگار را رد کرد و من که سیگارم را آتش می‌زدم، فکر کردم لابد دردی دارد که چنین دست و پا بسته و چنین متکی به خانواده به مدرسه آمده. باز پرسیدم: + +- خوب، حالا چه فرمایش داشتید؟ + +که یک مرتبه ترکید: + +- اگه من مدیر مدرسه بودم و هم‌چه اتفاقی می‌افتاد، شیکم خودمو پاره می‌کردم. خجالت بکش مرد! برو استعفا بده. تا اهل محل نریختن تیکه تیکه‌ات کنند، دو تا گوشتو وردار و دررو. بچه‌های مردم می‌آن این جا درس بخونن و حسن اخلاق. نمی‌آن که... + +- این مزخرفات کدومه آقا! حرف حساب سرکار چیه؟ + +و حرکتی کردم که او را از در بیندازم بیرون. اما آخر باید می‌فهمیدم چه مرگش است. «ولی آخر با من چه کار دارد؟» + +- آبروی من رفته. آبروی صد ساله‌ی خونواده‌ام رفته. اگه در مدرسه‌ی تو رو تخته نکنم، تخم بابام نیستم. آخه من دیگه با این بچه چی کار کنم؟ تو این مدرسه ناموس مردم در خطره. کلانتری فهمیده؛ پزشک قانونی فهمیده؛ یک پرونده درست شده پنجاه ورق؛ تازه می‌گی حرف حسابم چیه؟ حرف حسابم اینه که صندلی و این مقام از سر تو زیاده. حرف حسابم اینه که می‌دم محاکمه‌ات کنند و از نون خوردن بندازنت... + +او می‌گفت و من گوش می‌کردم و مثل دو تا سگ هار به جان هم افتاده بودیم که در باز شد و ناظم آمد تو. به دادم رسید. در همان حال که من و پدر بچه در حال دعوا بودیم زن و بچه همان آقا رفته بودند و قضایا را برای ناظم تعریف کرده بودند و او فرستاده بوده فاعل را از کلاس کشیده بودند بیرون... و گفت چه طور است زنگ بزنیم و جلوی بچه‌ها ادبش کنیم و کردیم. یعنی این بار خود من رفتم میدان. پسرک نره‌خری بود از پنجمی‌ها با لباس مرتب و صورت سرخ و سفید و سالکی به گونه. جلوی روی بچه‌ها کشیدمش زیر مشت و لگد و بعد سه تا از ترکه‌ها را که فراش جدید فوری از باغ همسایه آورده بود، به سر و صورتش خرد کردم. چنان وحشی شده بودم که اگر ترکه‌ها نمی‌رسید، پسرک را کشته بودم. این هم بود که ناظم به دادش رسید و وساطت کرد و لاشه‌اش را توی دفتر بردند و بچه‌ها را مرخص کردند و من به اتاقم برگشتم و با حالی زار روی صندلی افتادم، نه از پدر خبری بود و نه از مادر و نه از عروسک‌های کوکی‌شان که ناموسش دست کاری شده بود. و تازه احساس کردم که این کتک‌کاری را باید به او می‌زدم. خیس عرق بودم و دهانم تلخ بود. تمام فحش‌هایی که می‌بایست به آن مردکه‌ی دبنگ می‌دادم و نداده بودم، در دهانم رسوب کرده بود و مثل دم مار تلخ شده بود. اصلاً چرا زدمش؟ چرا نگذاشتم مثل همیشه ناظم میدان‌داری کند که هم کارکشته‌تر بود و هم خونسردتر. لابد پسرک با دخترعمه‌اش هم نمی‌تواند بازی کند. لابد توی خانواده‌شان، دخترها سر ده دوازده سالگی باید از پسرهای هم سن رو بگیرند. نکند عیبی کرده باشد؟ و یک مرتبه به صرافت افتادم که بروم ببینم چه بلایی به سرش آورده‌ام. بلند شدم و یکی از فراش‌ها را صدا کردم که فهمیدم روانه‌اش کرده‌اند. آبی آورد که روی دستم می‌ریخت و صورتم را می‌شستم و می‌کوشیدم که لرزش دست‌هایم را نبیند. و در گوشم آهسته گفت که پسر مدیر شرکت اتوبوسرانی است و بدجوری کتک خورده و آن‌ها خیلی سعی کرده‌اند که تر و تمیزش کنند... + +احمق مثلا داشت توی دل مرا خالی می‌کرد. نمی‌دانست که من اول تصمیم را گرفتم، بعد مثل سگ هار شدم. و تازه می‌فهمیدم کسی را زده‌ام که لیاقتش را داشته. حتماً از این اتفاق‌ها جای دیگر هم می‌افتد. آدم بردارد پایین تنه بچه‌ی خودش را، یا به قول خودش ناموسش را بگذارد سر گذر که کلانتر محل و پزشک معاینه کنند! تا پرونده درست کنند؟ با این پدرو مادرها بچه‌ها حق دارند که قرتی و دزد و دروغگو از آب در بیایند. این مدرسه‌ها را اول برای پدر و مادرها باز کنند... + +با این افکار به خانه رسیدم. زنم در را که باز کرد؛ چشم‌هایش گرد شد. همیشه وقتی می‌ترسد این طور می‌شود. برای اینکه خیال نکند آدم کشته‌ام، زود قضایا را برایش گفتم. و دیدم که در ماند. یعنی ساکت ماند. آب سرد، عرق بیدمشک، سیگار پشت سیگار فایده نداشت، لقمه از گلویم پایین نمی‌رفت و دست‌ها هنوز می‌لرزید. هر کدام به اندازه‌ی یک ماه فعالیت کرده بودند. با سیگار چهارم شروع کردم: + +- می‌دانی زن؟ بابای یارو پول‌داره. مسلماً کار به دادگستری و این جور خنس‌ها می‌کشه. مدیریت که الفاتحه. اما خیلی دلم می‌خواد قضیه به دادگاه برسه. یک سال آزگار رو دل کشیده‌ام و دیگه خسته شده‌ام. دلم می‌خواد یکی بپرسه چرا بچه‌ی مردم رو این طوری زدی، چرا تنبیه بدنی کردی! آخه یک مدیر مدرسه هم حرف‌هایی داره که باید یک جایی بزنه... + +که بلند شد و رفت سراغ تلفن. دو سه تا از دوستانم را که در دادگستری کاره‌ای بودند، گرفت و خودم قضیه را برایشان گفتم که مواظب باشند. فردا پسرک فاعل به مدرسه نیامده بود. و ناظم برایم گفت که قضیه ازین قرار بوده است که دوتایی به هوای دیدن مجموعه تمبرهای فاعل با هم به خانه‌ای می‌روند و قضایا همان جا اتفاق می‌افتد و داد و هوار و دخالت پدر و مادرهای طرفین و خط و نشان و شبانه کلانتری؛ و تمام اهل محل خبر دارند. او هم نظرش این بود که کار به دادگستری خواهد کشید. + +و من یک هفته‌ی تمام به انتظار اخطاریه‌ی دادگستری صبح و عصر به مدرسه رفتم و مثل بخت‌النصر پشت پنجره ایستادم. اما در تمام این مدت نه از فاعل خبری شد، نه از مفعول و نه از پدر و مادر ناموس‌پرست و نه از مدیر شرکت اتوبوسرانی. انگار نه انگار که اتفاقی افتاده. بچه‌ها می‌آمدند و می‌رفتند؛ برای آب خوردن عجله می‌کردند؛ به جای بازی کتک‌کاری می‌کردند و همه چیز مثل قبل بود. فقط من ماندم و یک دنیا حرف و انتظار. تا عاقبت رسید.... احضاریه‌ای با تعیین وقت قبلی برای دو روز بعد، در فلان شعبه و پیش فلان بازپرس دادگستری. آخر کسی پیدا شده بود که به حرفم گوش کند. + +تا دو روز بعد که موعد احضار بود، اصلاً از خانه در نیامدم. نشستم و ماحصل حرف‌هایم را روی کاغذ آوردم. حرف‌هایی که با همه‌ی چرندی هر وزیر فرهنگی می‌توانست با آن یک برنامه‌ی هفت ساله برای کارش بریزد. و سر ساعت معین رفتم دادگستری. اتاق معین و بازپرس معین. در را باز کردم و سلام، و تا آمدم خودم را معرفی کنم و احضاریه را در بیاورم، یارو پیش‌دستی کرد و صندلی آورد و چای سفارش داد و «احتیاجی به این حرف‌ها نیست و قضیه‌ی کوچک بود و حل شد و راضی به زحمت شما نبودیم...» + +که عرق سرد بر بدن من نشست. چایی‌ام را که خوردم، روی همان کاغذ نشان‌دار دادگستری استعفانامه‌ام را نوشتم و به نام هم‌کلاسی پخمه‌ام که تازه رئیس شده بود، دم در پست کردم. +EOT; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php new file mode 100644 index 0000000..8e0829e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php @@ -0,0 +1,85 @@ +format('dmy'); + + switch ((int)($birthdate->format('Y')/100)) { + case 18: + $centurySign = '+'; + break; + case 19: + $centurySign = '-'; + break; + case 20: + $centurySign = 'A'; + break; + default: + throw new \InvalidArgumentException('Year must be between 1800 and 2099 inclusive.'); + } + + $randomDigits = self::numberBetween(0, 89); + if ($gender && $gender == static::GENDER_MALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement(array(3,5,7,9)); + } else { + $randomDigits .= static::randomElement(array(1,3,5,7,9)); + } + } elseif ($gender && $gender == static::GENDER_FEMALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement(array(2,4,6,8)); + } else { + $randomDigits .= static::randomElement(array(0,2,4,6,8)); + } + } else { + if ($randomDigits === 0) { + $randomDigits .= self::numberBetween(2, 9); + } else { + $randomDigits .= (string)static::numerify('#'); + } + } + $randomDigits = str_pad($randomDigits, 3, '0', STR_PAD_LEFT); + + $checksum = $checksumCharacters[(int)($datePart . $randomDigits) % strlen($checksumCharacters)]; + + return $datePart . $centurySign . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php new file mode 100644 index 0000000..a323074 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php @@ -0,0 +1,99 @@ + 'Argovie'), + array('AI' => 'Appenzell Rhodes-Intérieures'), + array('AR' => 'Appenzell Rhodes-Extérieures'), + array('BE' => 'Berne'), + array('BL' => 'Bâle-Campagne'), + array('BS' => 'Bâle-Ville'), + array('FR' => 'Fribourg'), + array('GE' => 'Genève'), + array('GL' => 'Glaris'), + array('GR' => 'Grisons'), + array('JU' => 'Jura'), + array('LU' => 'Lucerne'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidwald'), + array('OW' => 'Obwald'), + array('SG' => 'Saint-Gall'), + array('SH' => 'Schaffhouse'), + array('SO' => 'Soleure'), + array('SZ' => 'Schwytz'), + array('TG' => 'Thurgovie'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Valais'), + array('ZG' => 'Zoug'), + array('ZH' => 'Zurich') + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetPrefix}} {{lastName}}', + '{{streetPrefix}} de {{cityName}}', + '{{streetPrefix}} de {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Rue + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php new file mode 100644 index 0000000..a4e91ea --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php @@ -0,0 +1,15 @@ + 'Ain'), array('02' => 'Aisne'), array('03' => 'Allier'), array('04' => 'Alpes-de-Haute-Provence'), array('05' => 'Hautes-Alpes'), + array('06' => 'Alpes-Maritimes'), array('07' => 'Ardèche'), array('08' => 'Ardennes'), array('09' => 'Ariège'), array('10' => 'Aube'), + array('11' => 'Aude'), array('12' => 'Aveyron'), array('13' => 'Bouches-du-Rhône'), array('14' => 'Calvados'), array('15' => 'Cantal'), + array('16' => 'Charente'), array('17' => 'Charente-Maritime'), array('18' => 'Cher'), array('19' => 'Corrèze'), array('2A' => 'Corse-du-Sud'), + array('2B' => 'Haute-Corse'), array('21' => "Côte-d'Or"), array('22' => "Côtes-d'Armor"), array('23' => 'Creuse'), array('24' => 'Dordogne'), + array('25' => 'Doubs'), array('26' => 'Drôme'), array('27' => 'Eure'), array('28' => 'Eure-et-Loir'), array('29' => 'Finistère'), array('30' => 'Gard'), + array('31' => 'Haute-Garonne'), array('32' => 'Gers'), array('33' => 'Gironde'), array('34' => 'Hérault'), array('35' => 'Ille-et-Vilaine'), + array('36' => 'Indre'), array('37' => 'Indre-et-Loire'), array('38' => 'Isère'), array('39' => 'Jura'), array('40' => 'Landes'), array('41' => 'Loir-et-Cher'), + array('42' => 'Loire'), array('43' => 'Haute-Loire'), array('44' => 'Loire-Atlantique'), array('45' => 'Loiret'), array('46' => 'Lot'), + array('47' => 'Lot-et-Garonne'), array('48' => 'Lozère'), array('49' => 'Maine-et-Loire'), array('50' => 'Manche'), array('51' => 'Marne'), + array('52' => 'Haute-Marne'), array('53' => 'Mayenne'), array('54' => 'Meurthe-et-Moselle'), array('55' => 'Meuse'), array('56' => 'Morbihan'), + array('57' => 'Moselle'), array('58' => 'Nièvre'), array('59' => 'Nord'), array('60' => 'Oise'), array('61' => 'Orne'), array('62' => 'Pas-de-Calais'), + array('63' => 'Puy-de-Dôme'), array('64' => 'Pyrénées-Atlantiques'), array('65' => 'Hautes-Pyrénées'), array('66' => 'Pyrénées-Orientales'), + array('67' => 'Bas-Rhin'), array('68' => 'Haut-Rhin'), array('69' => 'Rhône'), array('70' => 'Haute-Saône'), array('71' => 'Saône-et-Loire'), + array('72' => 'Sarthe'), array('73' => 'Savoie'), array('74' => 'Haute-Savoie'), array('75' => 'Paris'), array('76' => 'Seine-Maritime'), + array('77' => 'Seine-et-Marne'), array('78' => 'Yvelines'), array('79' => 'Deux-Sèvres'), array('80' => 'Somme'), array('81' => 'Tarn'), + array('82' => 'Tarn-et-Garonne'), array('83' => 'Var'), array('84' => 'Vaucluse'), array('85' => 'Vendée'), array('86' => 'Vienne'), + array('87' => 'Haute-Vienne'), array('88' => 'Vosges'), array('89' => 'Yonne'), array('90' => 'Territoire de Belfort'), array('91' => 'Essonne'), + array('92' => 'Hauts-de-Seine'), array('93' => 'Seine-Saint-Denis'), array('94' => 'Val-de-Marne'), array('95' => "Val-d'Oise"), + array('971' => 'Guadeloupe'), array('972' => 'Martinique'), array('973' => 'Guyane'), array('974' => 'La Réunion'), array('976' => 'Mayotte') + ); + + protected static $secondaryAddressFormats = array('Apt. ###', 'Suite ###', 'Étage ###', "Bât. ###", "Chambre ###"); + + /** + * @example 'Appt. 350' + */ + public static function secondaryAddress() + { + return static::numerify(static::randomElement(static::$secondaryAddressFormats)); + } + + /** + * @example 'rue' + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly returns a french region. + * + * @example 'Guadeloupe' + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regions); + } + + /** + * Randomly returns a french department ('departmentNumber' => 'departmentName'). + * + * @example array('2B' => 'Haute-Corse') + * + * @return array + */ + public static function department() + { + return static::randomElement(static::$departments); + } + + /** + * Randomly returns a french department name. + * + * @example 'Ardèche' + * + * @return string + */ + public static function departmentName() + { + $randomDepartmentName = array_values(static::department()); + + return $randomDepartmentName[0]; + } + + /** + * Randomly returns a french department number. + * + * @example '59' + * + * @return string + */ + public static function departmentNumber() + { + $randomDepartmentNumber = array_keys(static::department()); + + return $randomDepartmentNumber[0]; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php new file mode 100644 index 0000000..9112802 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php @@ -0,0 +1,476 @@ +generator->parse($format)); + + if ($this->isCatchPhraseValid($catchPhrase)) { + break; + } + } while (true); + + return $catchPhrase; + } + + /** + * Generates a siret number (14 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d'identification_du_r%C3%A9pertoire_des_%C3%A9tablissements + * @return string + */ + public function siret($formatted = true) + { + $siret = self::siren(false); + $nicFormat = static::randomElement(static::$siretNicFormats); + $siret .= $this->numerify($nicFormat); + $siret .= Luhn::computeCheckDigit($siret); + if ($formatted) { + $siret = substr($siret, 0, 3) . ' ' . substr($siret, 3, 3) . ' ' . substr($siret, 6, 3) . ' ' . substr($siret, 9, 5); + } + + return $siret; + } + + /** + * Generates a siren number (9 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises + * @return string + */ + public static function siren($formatted = true) + { + $siren = self::numerify('%#######'); + $siren .= Luhn::computeCheckDigit($siren); + if ($formatted) { + $siren = substr($siren, 0, 3) . ' ' . substr($siren, 3, 3) . ' ' . substr($siren, 6, 3); + } + + return $siren; + } + + /** + * @var array An array containing string which should not appear twice in a catch phrase. + */ + protected static $wordsWhichShouldNotAppearTwice = array('sécurité', 'simpl'); + + /** + * Validates a french catch phrase. + * + * @param string $catchPhrase The catch phrase to validate. + * + * @return boolean (true if valid, false otherwise) + */ + protected static function isCatchPhraseValid($catchPhrase) + { + foreach (static::$wordsWhichShouldNotAppearTwice as $word) { + // Fastest way to check if a piece of word does not appear twice. + $beginPos = strpos($catchPhrase, $word); + $endPos = strrpos($catchPhrase, $word); + + if ($beginPos !== false && $beginPos != $endPos) { + return false; + } + } + + return true; + } + + /** + * @link http://www.pole-emploi.fr/candidat/le-code-rome-et-les-fiches-metiers-@/article.jspz?id=60702 + * @note Randomly took 300 from this list + */ + protected static $jobTitleFormat = array( + 'Agent d\'accueil', + 'Agent d\'enquêtes', + 'Agent d\'entreposage', + 'Agent de curage', + 'Agro-économiste', + 'Aide couvreur', + 'Aide à domicile', + 'Aide-déménageur', + 'Ambassadeur', + 'Analyste télématique', + 'Animateur d\'écomusée', + 'Animateur web', + 'Appareilleur-gazier', + 'Archéologue', + 'Armurier d\'art', + 'Armurier spectacle', + 'Artificier spectacle', + 'Artiste dramatique', + 'Aspigiculteur', + 'Assistant de justice', + 'Assistant des ventes', + 'Assistant logistique', + 'Assistant styliste', + 'Assurance', + 'Auteur-adaptateur', + 'Billettiste voyages', + 'Brigadier', + 'Bruiteur', + 'Bâtonnier d\'art', + 'Bûcheron', + 'Cameraman', + 'Capitaine de pêche', + 'Carrier', + 'Caviste', + 'Chansonnier', + 'Chanteur', + 'Chargé de recherche', + 'Chasseur-bagagiste', + 'Chef de fabrication', + 'Chef de scierie', + 'Chef des ventes', + 'Chef du personnel', + 'Chef géographe', + 'Chef monteur son', + 'Chef porion', + 'Chiropraticien', + 'Choréologue', + 'Chromiste', + 'Cintrier-machiniste', + 'Clerc hors rang', + 'Coach sportif', + 'Coffreur béton armé', + 'Coffreur-ferrailleur', + 'Commandant de police', + 'Commandant marine', + 'Commis de coupe', + 'Comptable unique', + 'Conception et études', + 'Conducteur de jumbo', + 'Conseiller culinaire', + 'Conseiller funéraire', + 'Conseiller relooking', + 'Consultant ergonome', + 'Contrebassiste', + 'Convoyeur garde', + 'Copiste offset', + 'Corniste', + 'Costumier-habilleur', + 'Coutelier d\'art', + 'Cueilleur de cerises', + 'Céramiste concepteur', + 'Danse', + 'Danseur', + 'Data manager', + 'Dee-jay', + 'Designer produit', + 'Diététicien conseil', + 'Diététique', + 'Doreur sur métaux', + 'Décorateur-costumier', + 'Défloqueur d\'amiante', + 'Dégustateur', + 'Délégué vétérinaire', + 'Délégué à la tutelle', + 'Désamianteur', + 'Détective', + 'Développeur web', + 'Ecotoxicologue', + 'Elagueur-botteur', + 'Elagueur-grimpeur', + 'Elastiqueur', + 'Eleveur d\'insectes', + 'Eleveur de chats', + 'Eleveur de volailles', + 'Embouteilleur', + 'Employé d\'accueil', + 'Employé d\'étage', + 'Employé de snack-bar', + 'Endivier', + 'Endocrinologue', + 'Epithésiste', + 'Essayeur-retoucheur', + 'Etainier', + 'Etancheur', + 'Etancheur-bardeur', + 'Etiqueteur', + 'Expert back-office', + 'Exploitant de tennis', + 'Extraction', + 'Facteur', + 'Facteur de clavecins', + 'Facteur de secteur', + 'Fantaisiste', + 'Façadier-bardeur', + 'Façadier-ravaleur', + 'Feutier', + 'Finance', + 'Flaconneur', + 'Foreur pétrole', + 'Formateur d\'italien', + 'Fossoyeur', + 'Fraiseur', + 'Fraiseur mouliste', + 'Frigoriste maritime', + 'Fromager', + 'Galeriste', + 'Gardien de résidence', + 'Garçon de chenil', + 'Garçon de hall', + 'Gendarme mobile', + 'Guitariste', + 'Gynécologue', + 'Géodésien', + 'Géologue prospecteur', + 'Géomètre', + 'Géomètre du cadastre', + 'Gérant d\'hôtel', + 'Gérant de tutelle', + 'Gériatre', + 'Hydrothérapie', + 'Hématologue', + 'Hôte de caisse', + 'Ingénieur bâtiment', + 'Ingénieur du son', + 'Ingénieur géologue', + 'Ingénieur géomètre', + 'Ingénieur halieute', + 'Ingénieur logistique', + 'Instituteur', + 'Jointeur de placage', + 'Juge des enfants', + 'Juriste financier', + 'Kiwiculteur', + 'Lexicographe', + 'Liftier', + 'Litigeur transport', + 'Logistique', + 'Logopède', + 'Magicien', + 'Manager d\'artiste', + 'Mannequin détail', + 'Maquilleur spectacle', + 'Marbrier-poseur', + 'Marin grande pêche', + 'Matelassier', + 'Maçon', + 'Maçon-fumiste', + 'Maçonnerie', + 'Maître de ballet', + 'Maïeuticien', + 'Menuisier', + 'Miroitier', + 'Modéliste industriel', + 'Moellonneur', + 'Moniteur de sport', + 'Monteur audiovisuel', + 'Monteur de fermettes', + 'Monteur de palettes', + 'Monteur en siège', + 'Monteur prototypiste', + 'Monteur-frigoriste', + 'Monteur-truquiste', + 'Mouleur sable', + 'Mouliste drapeur', + 'Mécanicien-armurier', + 'Médecin du sport', + 'Médecin scolaire', + 'Médiateur judiciaire', + 'Médiathécaire', + 'Net surfeur surfeuse', + 'Oenologue', + 'Opérateur de plateau', + 'Opérateur du son', + 'Opérateur géomètre', + 'Opérateur piquage', + 'Opérateur vidéo', + 'Ouvrier d\'abattoir', + 'Ouvrier serriste', + 'Ouvrier sidérurgiste', + 'Palefrenier', + 'Paléontologue', + 'Pareur en abattoir', + 'Parfumeur', + 'Parqueteur', + 'Percepteur', + 'Photographe d\'art', + 'Pilote automobile', + 'Pilote de soutireuse', + 'Pilote fluvial', + 'Piqueur en ganterie', + 'Pisteur secouriste', + 'Pizzaïolo', + 'Plaquiste enduiseur', + 'Plasticien', + 'Plisseur', + 'Poissonnier-traiteur', + 'Pontonnier', + 'Porion', + 'Porteur de hottes', + 'Porteur de journaux', + 'Portier', + 'Poseur de granit', + 'Posticheur spectacle', + 'Potier', + 'Praticien dentaire', + 'Praticiens médicaux', + 'Premier clerc', + 'Preneur de son', + 'Primeuriste', + 'Professeur d\'italien', + 'Projeteur béton armé', + 'Promotion des ventes', + 'Présentateur radio', + 'Pyrotechnicien', + 'Pédicure pour bovin', + 'Pédologue', + 'Pédopsychiatre', + 'Quincaillier', + 'Radio chargeur', + 'Ramasseur d\'asperges', + 'Ramasseur d\'endives', + 'Ravaleur-ragréeur', + 'Recherche', + 'Recuiseur', + 'Relieur-doreur', + 'Responsable de salle', + 'Responsable télécoms', + 'Revenue Manager', + 'Rippeur spectacle', + 'Rogneur', + 'Récupérateur', + 'Rédacteur des débats', + 'Régleur funéraire', + 'Régleur sur tour', + 'Sapeur-pompier', + 'Scannériste', + 'Scripte télévision', + 'Sculpteur sur verre', + 'Scénariste', + 'Second de cuisine', + 'Secrétaire juridique', + 'Semencier', + 'Sertisseur', + 'Services funéraires', + 'Solier-moquettiste', + 'Sommelier', + 'Sophrologue', + 'Staffeur', + 'Story boarder', + 'Stratifieur', + 'Stucateur', + 'Styliste graphiste', + 'Surjeteur-raseur', + 'Séismologue', + 'Technicien agricole', + 'Technicien bovin', + 'Technicien géomètre', + 'Technicien plateau', + 'Technicien énergie', + 'Terminologue', + 'Testeur informatique', + 'Toiliste', + 'Topographe', + 'Toréro', + 'Traducteur d\'édition', + 'Traffic manager', + 'Trieur de métaux', + 'Turbinier', + 'Téléconseiller', + 'Tôlier-traceur', + 'Vendeur carreau', + 'Vendeur en lingerie', + 'Vendeur en meubles', + 'Vendeur en épicerie', + 'Verrier d\'art', + 'Verrier à la calotte', + 'Verrier à la main', + 'Verrier à main levée', + 'Vidéo-jockey', + 'Vitrier', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php new file mode 100644 index 0000000..8e3024b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php @@ -0,0 +1,9 @@ +numberBetween(1, 2); + } + + $nir .= + // Year of birth (aa) + $this->numerify('##') . + // Mont of birth (mm) + sprintf('%02d', $this->numberBetween(1, 12)); + + // Department + $department = key(Address::department()); + $nir .= $department; + + // Town number, depends on department length + if (strlen($department) === 2) { + $nir .= $this->numerify('###'); + } elseif (strlen($department) === 3) { + $nir .= $this->numerify('##'); + } + + // Born number (depending of town and month of birth) + $nir .= $this->numerify('###'); + + /** + * The key for a given NIR is `97 - 97 % NIR` + * NIR has to be an integer, so we have to do a little replacment + * for departments 2A and 2B + */ + if ($department === '2A') { + $nirInteger = str_replace('2A', '19', $nir); + } elseif ($department === '2B') { + $nirInteger = str_replace('2B', '18', $nir); + } else { + $nirInteger = $nir; + } + $nir .= sprintf('%02d', 97 - $nirInteger % 97); + + // Format is x xx xx xx xxx xxx xx + if ($formatted) { + $nir = substr($nir, 0, 1) . ' ' . substr($nir, 1, 2) . ' ' . substr($nir, 3, 2) . ' ' . substr($nir, 5, 2) . ' ' . substr($nir, 7, 3). ' ' . substr($nir, 10, 3). ' ' . substr($nir, 13, 2); + } + + return $nir; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php new file mode 100644 index 0000000..7c0bd9d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php @@ -0,0 +1,141 @@ +phoneNumber07WithSeparator(); + $phoneNumber = str_replace(' ', '', $phoneNumber); + return $phoneNumber; + } + + /** + * Only 073 to 079 are acceptable prefixes with 07 + * + * @see http://www.arcep.fr/index.php?id=8146 + */ + public function phoneNumber07WithSeparator() + { + $phoneNumber = $this->generator->numberBetween(3, 9); + $phoneNumber .= $this->numerify('# ## ## ##'); + return $phoneNumber; + } + + public function phoneNumber08() + { + $phoneNumber = $this->phoneNumber08WithSeparator(); + $phoneNumber = str_replace(' ', '', $phoneNumber); + return $phoneNumber; + } + + /** + * Valid formats for 08: + * + * 0# ## ## ## + * 1# ## ## ## + * 2# ## ## ## + * 91 ## ## ## + * 92 ## ## ## + * 93 ## ## ## + * 97 ## ## ## + * 98 ## ## ## + * 99 ## ## ## + * + * Formats 089(4|6)## ## ## are valid, but will be + * attributed when other 089 resource ranges are exhausted. + * + * @see https://www.arcep.fr/index.php?id=8146#c9625 + * @see https://issuetracker.google.com/u/1/issues/73269839 + */ + public function phoneNumber08WithSeparator() + { + $regex = '([012]{1}\d{1}|(9[1-357-9])( \d{2}){3}'; + return $this->regexify($regex); + } + + /** + * @example '0601020304' + */ + public function mobileNumber() + { + $format = static::randomElement(static::$mobileFormats); + + return static::numerify($this->generator->parse($format)); + } + /** + * @example '0891951357' + */ + public function serviceNumber() + { + $format = static::randomElement(static::$serviceFormats); + + return static::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php new file mode 100644 index 0000000..9403f16 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php @@ -0,0 +1,15531 @@ + static::latitude(46.262740, 47.564721), + 'longitude' => static::longitude(17.077949, 20.604560) + ); + } + + /* ----------- DATA -------------------- */ + + protected static $streetSuffix = array( + 'árok', 'átjáró', 'dűlősor', 'dűlőút', 'erdősor', 'fasor', 'forduló', 'gát', 'határsor', 'határút', 'híd', 'játszótér', 'kert', 'körönd', 'körtér', 'körút', 'köz', 'lakótelep', 'lejáró', 'lejtő', 'lépcső', 'liget', 'mélyút', 'orom', 'országút', 'ösvény', 'park', 'part', 'pincesor', 'rakpart', 'sétány', 'sétaút', 'sor', 'sugárút', 'tér', 'tere', 'turistaút', 'udvar', 'út', 'útja', 'utca', 'üdülőpart' + ); + protected static $postcode = array('####'); + protected static $state = array( + 'Budapest', 'Bács-Kiskun', 'Baranya', 'Békés', 'Borsod-Abaúj-Zemplén', 'Csongrád', 'Fejér', 'Győr-Moson-Sopron', 'Hajdú-Bihar', 'Heves', 'Jász-Nagykun-Szolnok', 'Komárom-Esztergom', 'Nógrád', 'Pest', 'Somogy', 'Szabolcs-Szatmár-Bereg', 'Tolna', 'Vas', 'Veszprém', 'Zala' + ); + protected static $country = array( + 'Afganisztán', 'Albánia', 'Algéria', 'Amerikai Egyesült Államok', 'Andorra', 'Angola', 'Antigua és Barbuda', 'Argentína', 'Ausztria', 'Ausztrália', 'Azerbajdzsán', + 'Bahama-szigetek', 'Bahrein', 'Banglades', 'Barbados', 'Belgium', 'Belize', 'Benin', 'Bhután', 'Bolívia', 'Bosznia-Hercegovina', 'Botswana', 'Brazília', 'Brunei', 'Bulgária', 'Burkina Faso', 'Burma', 'Burundi', + 'Chile', 'Ciprus', 'Costa Rica', 'Csehország', 'Csád', + 'Dominikai Köztársaság', 'Dominikai Közösség', 'Dzsibuti', 'Dánia', 'Dél-Afrika', 'Dél-Korea', 'Dél-Szudán', + 'Ecuador', 'Egyenlítői-Guinea', 'Egyesült Arab Emírségek', 'Egyesült Királyság', 'Egyiptom', 'Elefántcsontpart', 'Eritrea', 'Etiópia', + 'Fehéroroszország', 'Fidzsi-szigetek', 'Finnország', 'Franciaország', 'Fülöp-szigetek', + 'Gabon', 'Gambia', 'Ghána', 'Grenada', 'Grúzia', 'Guatemala', 'Guinea', 'Guyana', 'Görögország', + 'Haiti', 'Hollandia', 'Horvátország', + 'India', 'Indonézia', 'Irak', 'Irán', 'Izland', 'Izrael', + 'Japán', 'Jemen', 'Jordánia', + 'Kambodzsa', 'Kamerun', 'Kanada', 'Katar', 'Kazahsztán', 'Kelet-Timor', 'Kenya', 'Kirgizisztán', 'Kiribati', 'Kolumbia', 'Kongói Demokratikus Köztársaság', 'Kongói Köztársaság', 'Kuba', 'Kuvait', 'Kína', 'Közép-Afrika', + 'Laosz', 'Lengyelország', 'Lesotho', 'Lettország', 'Libanon', 'Libéria', 'Liechtenstein', 'Litvánia', 'Luxemburg', 'Líbia', + 'Macedónia', 'Madagaszkár', 'Magyarország', 'Malawi', 'Maldív-szigetek', 'Mali', 'Malájzia', 'Marokkó', 'Marshall-szigetek', 'Mauritánia', 'Mexikó', 'Mikronézia', 'Moldova', 'Monaco', 'Mongólia', 'Montenegró', 'Mozambik', 'Málta', + 'Namíbia', 'Nauru', 'Nepál', 'Nicaragua', 'Niger', 'Nigéria', 'Norvégia', 'Németország', + 'Olaszország', 'Omán', 'Oroszország', + 'Pakisztán', 'Palau', 'Panama', 'Paraguay', 'Peru', 'Portugália', 'Pápua Új-Guinea', + 'Románia', 'Ruanda', + 'Saint Kitts és Nevis', 'Saint Vincent', 'Salamon-szigetek', 'Salvador', 'San Marino', 'Seychelle-szigetek', 'Spanyolország', 'Srí Lanka', 'Suriname', 'Svájc', 'Svédország', 'Szamoa', 'Szaúd-Arábia', 'Szenegál', 'Szerbia', 'Szingapúr', 'Szlovákia', 'Szlovénia', 'Szomália', 'Szudán', 'Szváziföld', 'Szíria', 'São Tomé és Príncipe', + 'Tadzsikisztán', 'Tanzánia', 'Thaiföld', 'Togo', 'Tonga', 'Trinidad és Tobago', 'Tunézia', 'Tuvalu', 'Törökország', 'Türkmenisztán', + 'Uganda', 'Ukrajna', 'Uruguay', + 'Vanuatu', 'Venezuela', 'Vietnám', + 'Zambia', 'Zimbabwe', 'Zöld-foki-szigetek', + 'Észak-Korea', 'Észtország', 'Írország', 'Örményország', 'Új-Zéland', 'Üzbegisztán' + ); + + /** + * Source: https://hu.wikipedia.org/wiki/Magyarorsz%C3%A1g_v%C3%A1rosainak_list%C3%A1ja + */ + protected static $capitals = array('Budapest'); + protected static $bigCities = array( + 'Békéscsaba', 'Debrecen', 'Dunaújváros', 'Eger', 'Érd', 'Győr', 'Hódmezővásárhely', 'Kaposvár', 'Kecskemét', 'Miskolc', 'Nagykanizsa', 'Nyíregyháza', 'Pécs', 'Salgótarján', 'Sopron', 'Szeged', 'Székesfehérvár', 'Szekszárd', 'Szolnok', 'Szombathely', 'Tatabánya', 'Veszprém', 'Zalaegerszeg' + ); + protected static $smallerCities = array( + 'Ajka', 'Aszód', 'Bácsalmás', + 'Baja', 'Baktalórántháza', 'Balassagyarmat', 'Balatonalmádi', 'Balatonfüred', 'Balmazújváros', 'Barcs', 'Bátonyterenye', 'Békés', 'Bélapátfalva', 'Berettyóújfalu', 'Bicske', 'Bóly', 'Bonyhád', 'Budakeszi', + 'Cegléd', 'Celldömölk', 'Cigánd', 'Csenger', 'Csongrád', 'Csorna', 'Csurgó', + 'Dabas', 'Derecske', 'Devecser', 'Dombóvár', 'Dunakeszi', + 'Edelény', 'Encs', 'Enying', 'Esztergom', + 'Fehérgyarmat', 'Fonyód', 'Füzesabony', + 'Gárdony', 'Gödöllő', 'Gönc', 'Gyál', 'Gyomaendrőd', 'Gyöngyös', 'Gyula', + 'Hajdúböszörmény', 'Hajdúhadház', 'Hajdúnánás', 'Hajdúszoboszló', 'Hatvan', 'Heves', + 'Ibrány', + 'Jánoshalma', 'Jászapáti', 'Jászberény', + 'Kalocsa', 'Kapuvár', 'Karcag', 'Kazincbarcika', 'Kemecse', 'Keszthely', 'Kisbér', 'Kiskőrös', 'Kiskunfélegyháza', 'Kiskunhalas', 'Kiskunmajsa', 'Kistelek', 'Kisvárda', 'Komárom', 'Komló', 'Körmend', 'Kőszeg', 'Kunhegyes', 'Kunszentmárton', 'Kunszentmiklós', + 'Lenti', 'Letenye', + 'Makó', 'Marcali', 'Martonvásár', 'Mátészalka', 'Mezőcsát', 'Mezőkovácsháza', 'Mezőkövesd', 'Mezőtúr', 'Mohács', 'Monor', 'Mór', 'Mórahalom', 'Mosonmagyaróvár', + 'Nagyatád', 'Nagykálló', 'Nagykáta', 'Nagykőrös', 'Nyíradony', 'Nyírbátor', + 'Orosháza', 'Oroszlány', 'Ózd', + 'Paks', 'Pannonhalma', 'Pápa', 'Pásztó', 'Pécsvárad', 'Pétervására', 'Pilisvörösvár', 'Polgárdi', 'Püspökladány', 'Putnok', + 'Ráckeve', 'Rétság', + 'Sárbogárd', 'Sarkad', 'Sárospatak', 'Sárvár', 'Sásd', 'Sátoraljaújhely', 'Sellye', 'Siklós', 'Siófok', 'Sümeg', 'Szarvas', 'Szécsény', 'Szeghalom', 'Szentendre', 'Szentes', 'Szentgotthárd', 'Szentlőrinc', 'Szerencs', 'Szigetszentmiklós', 'Szigetvár', 'Szikszó', 'Szob', + 'Tab', 'Tamási', 'Tapolca', 'Tata', 'Tét', 'Tiszafüred', 'Tiszakécske', 'Tiszaújváros', 'Tiszavasvári', 'Tokaj', 'Tolna', 'Törökszentmiklós', + 'Vác', 'Várpalota', 'Vásárosnamény', 'Vasvár', 'Vecsés', + 'Záhony', 'Zalaszentgrót', 'Zirc' + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php new file mode 100644 index 0000000..7131654 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php @@ -0,0 +1,13 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php new file mode 100644 index 0000000..16b68d8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php @@ -0,0 +1,12 @@ +generator->parse(static::randomElement(static::$formats))); + } + + public function code() + { + return static::randomElement(static::$codes); + } + + /** + * @return mixed + */ + public function numberFormat() + { + return static::randomElement(static::$numberFormats); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php new file mode 100644 index 0000000..49fd1a7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php @@ -0,0 +1,316 @@ +generator->parse($format); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + public static function buildingNumber() + { + return static::numberBetween(1, 999); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php new file mode 100644 index 0000000..7839f1e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php @@ -0,0 +1,43 @@ +generator->parse($lastNameRandomElement); + } + + /** + * Return last name for male + * + * @access public + * @return string last name + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return last name for female + * + * @access public + * @return string last name + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * For academic title + * + * @access public + * @return string suffix + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } + + /** + * Generates Nomor Induk Kependudukan (NIK) + * + * @link https://en.wikipedia.org/wiki/National_identification_number#Indonesia + * + * @param null|string $gender + * @param null|\DateTime $birthDate + * @return string + */ + public function nik($gender = null, $birthDate = null) + { + # generate first numbers (region data) + $nik = $this->generator->numerify('######'); + + if (!$birthDate) { + $birthDate = $this->generator->dateTimeBetween(); + } + + if (!$gender) { + $gender = $this->generator->randomElement(array(self::GENDER_MALE, self::GENDER_FEMALE)); + } + + # if gender is female, add 40 to days + if ($gender == self::GENDER_FEMALE) { + $nik .= $birthDate->format('d') + 40; + } else { + $nik .= $birthDate->format('d'); + } + + $nik .= $birthDate->format('my'); + + # add last random digits + $nik.= $this->generator->numerify('####'); + + return $nik; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php new file mode 100644 index 0000000..de5c969 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php @@ -0,0 +1,55 @@ + + */ +class Address extends \Faker\Provider\Address +{ + /** + * @var array Countries in icelandic + */ + protected static $country = array( + 'Afganistan', 'Albanía', 'Alsír', 'Andorra', 'Angóla', 'Angvilla', 'Antígva og Barbúda', 'Argentína', + 'Armenía', 'Arúba', 'Aserbaídsjan', 'Austur-Kongó', 'Austurríki', 'Austur-Tímor', 'Álandseyjar', + 'Ástralía', 'Bahamaeyjar', 'Bandaríkin', 'Bandaríska Samóa', 'Bangladess', 'Barbados', 'Barein', + 'Belgía', 'Belís', 'Benín', 'Bermúdaeyjar', 'Bosnía og Hersegóvína', 'Botsvana', 'Bouvet-eyja', 'Bólivía', + 'Brasilía', 'Bresku Indlandshafseyjar', 'Bretland', 'Brúnei', 'Búlgaría', 'Búrkína Fasó', 'Búrúndí', 'Bútan', + 'Cayman-eyjar', 'Chile', 'Cooks-eyjar', 'Danmörk', 'Djíbútí', 'Dóminíka', 'Dóminíska lýðveldið', 'Egyptaland', + 'Eistland', 'Ekvador', 'El Salvador', 'England', 'Erítrea', 'Eþíópía', 'Falklandseyjar', 'Filippseyjar', + 'Finnland', 'Fídjieyjar', 'Fílabeinsströndin', 'Frakkland', 'Franska Gvæjana', 'Franska Pólýnesía', + 'Frönsku suðlægu landsvæðin', 'Færeyjar', 'Gabon', 'Gambía', 'Gana', 'Georgía', 'Gíbraltar', 'Gínea', + 'Gínea-Bissá', 'Grenada', 'Grikkland', 'Grænhöfðaeyjar', 'Grænland', 'Gvadelúpeyjar', 'Gvam', 'Gvatemala', + 'Gvæjana', 'Haítí', 'Heard og McDonalds-eyjar', 'Holland', 'Hollensku Antillur', 'Hondúras', 'Hong Kong', + 'Hvíta-Rússland', 'Indland', 'Indónesía', 'Írak', 'Íran', 'Írland', 'Ísland', 'Ísrael', 'Ítalía', 'Jamaíka', + 'Japan', 'Jemen', 'Jólaey', 'Jómfrúaeyjar', 'Jórdanía', 'Kambódía', 'Kamerún', 'Kanada', 'Kasakstan', 'Katar', + 'Kenía', 'Kirgisistan', 'Kína', 'Kíribatí', 'Kongó', 'Austur-Kongó', 'Vestur-Kongó', 'Kostaríka', 'Kókoseyjar', + 'Kólumbía', 'Kómoreyjar', 'Kórea', 'Norður-Kórea;', 'Suður-Kórea', 'Króatía', 'Kúba', 'Kúveit', 'Kýpur', + 'Laos', 'Lesótó', 'Lettland', 'Liechtenstein', 'Litháen', 'Líbanon', 'Líbería', 'Líbía', 'Lúxemborg', + 'Madagaskar', 'Makaó', 'Makedónía', 'Malasía', 'Malaví', 'Maldíveyjar', 'Malí', 'Malta', 'Marokkó', + 'Marshall-eyjar', 'Martiník', 'Mayotte', 'Máritanía', 'Máritíus', 'Mexíkó', 'Mið-Afríkulýðveldið', + 'Miðbaugs-Gínea', 'Míkrónesía', 'Mjanmar', 'Moldóva', 'Mongólía', 'Montserrat', 'Mónakó', 'Mósambík', + 'Namibía', 'Nárú', 'Nepal', 'Niue', 'Níger', 'Nígería', 'Níkaragva', 'Norður-Írland', 'Norður-Kórea', + 'Norður-Maríanaeyjar', 'Noregur', 'Norfolkeyja', 'Nýja-Kaledónía', 'Nýja-Sjáland', 'Óman', 'Pakistan', + 'Palá', 'Palestína', 'Panama', 'Papúa Nýja-Gínea', 'Paragvæ', 'Páfagarður', 'Perú', 'Pitcairn', 'Portúgal', + 'Pólland', 'Púertó Ríkó', 'Réunion', 'Rúanda', 'Rúmenía', 'Rússland', 'Salómonseyjar', 'Sambía', + 'Sameinuðu arabísku furstadæmin', 'Samóa', 'San Marínó', 'Sankti Helena', 'Sankti Kristófer og Nevis', + 'Sankti Lúsía', 'Sankti Pierre og Miquelon', 'Sankti Vinsent og Grenadíneyjar', 'Saó Tóme og Prinsípe', + 'Sádi-Arabía', 'Senegal', 'Serbía', 'Seychelles-eyjar', 'Simbabve', 'Singapúr', 'Síerra Leóne', 'Skotland', + 'Slóvakía', 'Slóvenía', 'Smáeyjar Bandaríkjanna', 'Sómalía', 'Spánn', 'Srí Lanka', 'Suður-Afríka', + 'Suður-Georgía og Suður-Sandvíkureyjar', 'Suður-Kórea', 'Suðurskautslandið', 'Súdan', 'Súrínam', 'Jan Mayen', + 'Svartfjallaland', 'Svasíland', 'Sviss', 'Svíþjóð', 'Sýrland', 'Tadsjikistan', 'Taíland', 'Taívan', 'Tansanía', + 'Tékkland', 'Tonga', 'Tógó', 'Tókelá', 'Trínidad og Tóbagó', 'Tsjad', 'Tsjetsjenía', 'Turks- og Caicos-eyjar', + 'Túnis', 'Túrkmenistan', 'Túvalú', 'Tyrkland', 'Ungverjaland', 'Úganda', 'Úkraína', 'Úrúgvæ', 'Úsbekistan', + 'Vanúatú', 'Venesúela', 'Vestur-Kongó', 'Vestur-Sahara', 'Víetnam', 'Wales', 'Wallis- og Fútúnaeyjar', 'Þýskaland' + ); + + /** + * @var array Icelandic cities. + */ + protected static $cityNames = array( + 'Reykjavík', 'Seltjarnarnes', 'Vogar', 'Kópavogur', 'Garðabær', 'Hafnarfjörður', 'Reykjanesbær', 'Grindavík', + 'Sandgerði', 'Garður', 'Reykjanesbær', 'Mosfellsbær', 'Akranes', 'Borgarnes', 'Reykholt', 'Stykkishólmur', + 'Flatey', 'Grundarfjörður', 'Ólafsvík', 'Snæfellsbær', 'Hellissandur', 'Búðardalur', 'Reykhólahreppur', + 'Ísafjörður', 'Hnífsdalur', 'Bolungarvík', 'Súðavík', 'Flateyri', 'Suðureyri', 'Patreksfjörður', + 'Tálknafjörður', 'Bíldudalur', 'Þingeyri', 'Staður', 'Hólmavík', 'Drangsnes', 'Árneshreppur', 'Hvammstangi', + 'Blönduós', 'Skagaströnd', 'Sauðárkrókur', 'Varmahlíð', 'Hofsós', 'Fljót', 'Siglufjörður', 'Akureyri', + 'Grenivík', 'Grímsey', 'Dalvík', 'Ólafsfjörður', 'Hrísey', 'Húsavík', 'Fosshóll', 'Laugar', 'Mývatn', + 'Kópasker', 'Raufarhöfn', 'Þórshöfn', 'Bakkafjörður', 'Vopnafjörður', 'Egilsstaðir', 'Seyðisfjörður', + 'Mjóifjörður', 'Borgarfjörður', 'Reyðarfjörður', 'Eskifjörður', 'Neskaupstaður', 'Fáskrúðsfjörður', + 'Stöðvarfjörður', 'Breiðdalsvík', 'Djúpivogur', 'Höfn', 'Selfoss', 'Hveragerði', 'Þorlákshöfn', 'Ölfus', + 'Eyrarbakki', 'Stokkseyri', 'Laugarvatn', 'Flúðir', 'Hella', 'Hvolsvöllur', 'Vík', 'Kirkjubæjarklaustur', + 'Vestmannaeyjar' + ); + + /** + * @var array Street name suffix. + */ + protected static $streetSuffix = array( + 'ás', 'bakki', 'braut', 'bær', 'brún', 'berg', 'fold', 'gata', 'gróf', + 'garðar', 'höfði', 'heimar', 'hamar', 'hólar', 'háls', 'kvísl', 'lækur', + 'leiti', 'land', 'múli', 'nes', 'rimi', 'stígur', 'stræti', 'stekkur', + 'slóð', 'skógar', 'sel', 'teigur', 'tún', 'vangur', 'vegur', 'vogur', + 'vað' + ); + + /** + * @var array Street name prefix. + */ + protected static $streetPrefix = array( + 'Aðal', 'Austur', 'Bakka', 'Braga', 'Báru', 'Brunn', 'Fiski', 'Leifs', + 'Týs', 'Birki', 'Suður', 'Norður', 'Vestur', 'Austur', 'Sanda', 'Skógar', + 'Stór', 'Sunnu', 'Tungu', 'Tangar', 'Úlfarfells', 'Vagn', 'Vind', 'Ysti', + 'Þing', 'Hamra', 'Hóla', 'Kríu', 'Iðu', 'Spóa', 'Starra', 'Uglu', 'Vals' + ); + + /** + * @var Icelandic zip code. + **/ + protected static $postcode = array( + '%##' + ); + + /** + * @var array Icelandic regions. + */ + protected static $regionNames = array( + 'Höfuðborgarsvæðið', 'Norðurland', 'Suðurland', 'Vesturland', 'Vestfirðir', 'Austurland', 'Suðurnes' + ); + + /** + * @var array Icelandic building numbers. + */ + protected static $buildingNumber = array( + '%##', '%#', '%#', '%', '%', '%', '%?', '% ?', + ); + + /** + * @var array Icelandic city format. + */ + protected static $cityFormats = array( + '{{cityName}}', + ); + + /** + * @var array Icelandic street's name formats. + */ + protected static $streetNameFormats = array( + '{{streetPrefix}}{{streetSuffix}}', + '{{streetPrefix}}{{streetSuffix}}', + '{{firstNameMale}}{{streetSuffix}}', + '{{firstNameFemale}}{{streetSuffix}}' + ); + + /** + * @var array Icelandic street's address formats. + */ + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}' + ); + + /** + * @var array Icelandic address format. + */ + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Randomly return a real city name. + * + * @return string + */ + public static function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Randomly return a street prefix. + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly return a building number. + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::bothify(static::randomElement(static::$buildingNumber))); + } + + /** + * Randomly return a real region name. + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regionNames); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php new file mode 100644 index 0000000..6b93451 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php @@ -0,0 +1,53 @@ + + */ +class Company extends \Faker\Provider\Company +{ + /** + * @var array Danish company name formats. + */ + protected static $formats = array( + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{firstname}} {{lastName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{firstname}} {{middleName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{middleName}} & {{middleName}} {{companySuffix}}', + '{{middleName}} og {{middleName}} {{companySuffix}}', + '{{middleName}} & {{lastName}}', + '{{middleName}} og {{lastName}}', + ); + + /** + * @var array Company suffixes. + */ + protected static $companySuffix = array('ehf.', 'hf.', 'sf.'); + + /** + * @link http://www.rsk.is/atvinnurekstur/virdisaukaskattur/ + * + * @var string VSK number format. + */ + protected static $vskFormat = '%####'; + + /** + * Generates a VSK number (5 digits). + * + * @return string + */ + public static function vsk() + { + return static::numerify(static::$vskFormat); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php new file mode 100644 index 0000000..a265da6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php @@ -0,0 +1,23 @@ + + */ +class Internet extends \Faker\Provider\Internet +{ + /** + * @var array Some email domains in Denmark. + */ + protected static $freeEmailDomain = array( + 'gmail.com', 'yahoo.com', 'hotmail.com', 'visir.is', 'simnet.is', 'internet.is' + ); + + /** + * @var array Some TLD. + */ + protected static $tld = array( + 'com', 'com', 'com', 'net', 'is', 'is', 'is', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php new file mode 100644 index 0000000..c119c38 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php @@ -0,0 +1,19 @@ + + */ +class Person extends \Faker\Provider\Person +{ + /** + * @var array Icelandic person name formats. + */ + protected static $maleNameFormats = array( + '{{firstNameMale}} {{lastNameMale}}', + '{{firstNameMale}} {{lastNameMale}}', + '{{firstNameMale}} {{middleName}} {{lastNameMale}}', + '{{firstNameMale}} {{middleName}} {{lastNameMale}}', + ); + + protected static $femaleNameFormats = array( + '{{firstNameFemale}} {{lastNameFemale}}', + '{{firstNameFemale}} {{lastNameFemale}}', + '{{firstNameFemale}} {{middleName}} {{lastNameFemale}}', + '{{firstNameFemale}} {{middleName}} {{lastNameFemale}}', + ); + + /** + * @var string Icelandic women names. + */ + protected static $firstNameFemale = array('Aagot', 'Abela', 'Abigael', 'Ada', 'Adda', 'Addý', 'Adela', 'Adelía', 'Adríana', 'Aðalbjörg', 'Aðalbjört', 'Aðalborg', 'Aðaldís', 'Aðalfríður', 'Aðalheiður', 'Aðalrós', 'Aðalsteina', 'Aðalsteinunn', 'Aðalveig', 'Agata', 'Agatha', 'Agða', 'Agla', 'Agnea', 'Agnes', 'Agneta', 'Alanta', 'Alba', 'Alberta', 'Albína', 'Alda', 'Aldís', 'Aldný', 'Aleta', 'Aletta', 'Alexa', 'Alexandra', 'Alexandría', 'Alexis', 'Alexía', 'Alfa', 'Alfífa', 'Alice', 'Alida', 'Alída', 'Alína', 'Alís', 'Alísa', 'Alla', 'Allý', 'Alma', 'Alrún', 'Alva', 'Alvilda', 'Amadea', 'Amal', 'Amalía', 'Amanda', 'Amelía', 'Amilía', 'Amíra', 'Amy', 'Amý', 'Analía', 'Anastasía', 'Andra', 'Andrá', 'Andrea', 'Anetta', 'Angela', 'Angelíka', 'Anika', 'Anita', 'Aníka', 'Anína', 'Aníta', 'Anja', 'Ann', 'Anna', 'Annabella', 'Annalísa', 'Anne', 'Annelí', 'Annetta', 'Anney', 'Annika', 'Annía', 'Anný', 'Antonía', 'Apríl', 'Ardís', 'Arey', 'Arinbjörg', 'Aris', 'Arisa', 'Aría', 'Aríanna', 'Aríella', 'Arín', 'Arína', 'Arís', 'Armenía', 'Arna', 'Arnbjörg', 'Arnborg', 'Arndís', 'Arney', 'Arnfinna', 'Arnfríður', 'Arngerður', 'Arngunnur', 'Arnheiður', 'Arnhildur', 'Arnika', 'Arnkatla', 'Arnlaug', 'Arnleif', 'Arnlín', 'Arnljót', 'Arnóra', 'Arnrós', 'Arnrún', 'Arnþóra', 'Arnþrúður', 'Asírí', 'Askja', 'Assa', 'Astrid', 'Atalía', 'Atena', 'Athena', 'Atla', 'Atlanta', 'Auðbjörg', 'Auðbjört', 'Auðdís', 'Auðlín', 'Auðna', 'Auðný', 'Auðrún', 'Auður', 'Aurora', 'Axelía', 'Axelma', 'Aþena', 'Ágústa', 'Ágústína', 'Álfdís', 'Álfey', 'Álfgerður', 'Álfheiður', 'Álfhildur', 'Álfrós', 'Álfrún', 'Álfsól', 'Árbjörg', 'Árbjört', 'Árdís', 'Árelía', 'Árlaug', 'Ármey', 'Árna', 'Árndís', 'Árney', 'Árnheiður', 'Árnína', 'Árný', 'Áróra', 'Ársól', 'Ársæl', 'Árún', 'Árveig', 'Árvök', 'Árþóra', 'Ása', 'Ásbjörg', 'Ásborg', 'Ásdís', 'Ásfríður', 'Ásgerður', 'Áshildur', 'Áskatla', 'Ásla', 'Áslaug', 'Ásleif', 'Ásný', 'Ásrós', 'Ásrún', 'Ást', 'Ásta', 'Ástbjörg', 'Ástbjört', 'Ástdís', 'Ástfríður', 'Ástgerður', 'Ástheiður', 'Ásthildur', 'Ástríður', 'Ástrós', 'Ástrún', 'Ástveig', 'Ástþóra', 'Ástþrúður', 'Ásvör', 'Baldey', 'Baldrún', 'Baldvina', 'Barbara', 'Barbára', 'Bassí', 'Bára', 'Bebba', 'Begga', 'Belinda', 'Bella', 'Benedikta', 'Bengta', 'Benidikta', 'Benía', 'Beníta', 'Benna', 'Benney', 'Benný', 'Benta', 'Bentey', 'Bentína', 'Bera', 'Bergdís', 'Bergey', 'Bergfríður', 'Bergheiður', 'Berghildur', 'Berglaug', 'Berglind', 'Berglín', 'Bergljót', 'Bergmannía', 'Bergný', 'Bergrán', 'Bergrín', 'Bergrós', 'Bergrún', 'Bergþóra', 'Berit', 'Bernódía', 'Berta', 'Bertha', 'Bessí', 'Bestla', 'Beta', 'Betanía', 'Betsý', 'Bettý', 'Bil', 'Birgit', 'Birgitta', 'Birna', 'Birta', 'Birtna', 'Bíbí', 'Bína', 'Bjargdís', 'Bjargey', 'Bjargheiður', 'Bjarghildur', 'Bjarglind', 'Bjarkey', 'Bjarklind', 'Bjarma', 'Bjarndís', 'Bjarney', 'Bjarnfríður', 'Bjarngerður', 'Bjarnheiður', 'Bjarnhildur', 'Bjarnlaug', 'Bjarnrún', 'Bjarnveig', 'Bjarný', 'Bjarnþóra', 'Bjarnþrúður', 'Bjartey', 'Bjartmey', 'Björg', 'Björgey', 'Björgheiður', 'Björghildur', 'Björk', 'Björney', 'Björnfríður', 'Björt', 'Bláey', 'Blíða', 'Blín', 'Blómey', 'Blædís', 'Blær', 'Bobba', 'Boga', 'Bogdís', 'Bogey', 'Bogga', 'Boghildur', 'Borg', 'Borgdís', 'Borghildur', 'Borgný', 'Borgrún', 'Borgþóra', 'Botnía', 'Bóel', 'Bót', 'Bóthildur', 'Braga', 'Braghildur', 'Branddís', 'Brá', 'Brák', 'Brigitta', 'Brimdís', 'Brimhildur', 'Brimrún', 'Brit', 'Britt', 'Britta', 'Bríana', 'Bríanna', 'Bríet', 'Bryndís', 'Brynfríður', 'Bryngerður', 'Brynheiður', 'Brynhildur', 'Brynja', 'Brynný', 'Burkney', 'Bylgja', 'Camilla', 'Carla', 'Carmen', 'Cecilia', 'Cecilía', 'Charlotta', 'Charlotte', 'Christina', 'Christine', 'Clara', 'Daðey', 'Daðína', 'Dagbjörg', 'Dagbjört', 'Dagfríður', 'Daggrós', 'Dagheiður', 'Dagmar', 'Dagmey', 'Dagný', 'Dagrún', 'Daldís', 'Daley', 'Dalía', 'Dalla', 'Dallilja', 'Dalrós', 'Dana', 'Daney', 'Danfríður', 'Danheiður', 'Danhildur', 'Danía', 'Daníela', 'Daníella', 'Dara', 'Debora', 'Debóra', 'Dendý', 'Didda', 'Dilja', 'Diljá', 'Dimmblá', 'Dimmey', 'Día', 'Díana', 'Díanna', 'Díma', 'Dís', 'Dísa', 'Dísella', 'Donna', 'Doris', 'Dorothea', 'Dóa', 'Dómhildur', 'Dóra', 'Dórey', 'Dóris', 'Dórothea', 'Dórótea', 'Dóróthea', 'Drauma', 'Draumey', 'Drífa', 'Droplaug', 'Drótt', 'Dröfn', 'Dúa', 'Dúfa', 'Dúna', 'Dýrborg', 'Dýrfinna', 'Dýrleif', 'Dýrley', 'Dýrunn', 'Dæja', 'Dögg', 'Dögun', 'Ebba', 'Ebonney', 'Edda', 'Edel', 'Edil', 'Edit', 'Edith', 'Eðna', 'Efemía', 'Egedía', 'Eggrún', 'Egla', 'Eiðný', 'Eiðunn', 'Eik', 'Einbjörg', 'Eindís', 'Einey', 'Einfríður', 'Einhildur', 'Einína', 'Einrún', 'Eir', 'Eirdís', 'Eirfinna', 'Eiríka', 'Eirný', 'Eirún', 'Elba', 'Eldbjörg', 'Eldey', 'Eldlilja', 'Eldrún', 'Eleina', 'Elektra', 'Elena', 'Elenborg', 'Elfa', 'Elfur', 'Elina', 'Elinborg', 'Elisabeth', 'Elía', 'Elíana', 'Elín', 'Elína', 'Elíná', 'Elínbet', 'Elínbjörg', 'Elínbjört', 'Elínborg', 'Elíndís', 'Elíngunnur', 'Elínheiður', 'Elínrós', 'Elírós', 'Elísa', 'Elísabet', 'Elísabeth', 'Elka', 'Ella', 'Ellen', 'Elley', 'Ellisif', 'Ellín', 'Elly', 'Ellý', 'Elma', 'Elna', 'Elsa', 'Elsabet', 'Elsie', 'Elsí', 'Elsý', 'Elva', 'Elvi', 'Elvíra', 'Elvý', 'Embla', 'Emelía', 'Emelíana', 'Emelína', 'Emeralda', 'Emilía', 'Emilíana', 'Emilíanna', 'Emilý', 'Emma', 'Emmý', 'Emý', 'Enea', 'Eneka', 'Engilbjört', 'Engilráð', 'Engilrós', 'Engla', 'Enika', 'Enja', 'Enóla', 'Eres', 'Erika', 'Erin', 'Erla', 'Erlen', 'Erlín', 'Erna', 'Esja', 'Esmeralda', 'Ester', 'Esther', 'Estiva', 'Ethel', 'Etna', 'Eufemía', 'Eva', 'Evelyn', 'Evey', 'Evfemía', 'Evgenía', 'Evíta', 'Evlalía', 'Ey', 'Eybjörg', 'Eybjört', 'Eydís', 'Eyfríður', 'Eygerður', 'Eygló', 'Eyhildur', 'Eyja', 'Eyjalín', 'Eyleif', 'Eylín', 'Eyrós', 'Eyrún', 'Eyveig', 'Eyvör', 'Eyþóra', 'Eyþrúður', 'Fanndís', 'Fanney', 'Fannlaug', 'Fanny', 'Fanný', 'Febrún', 'Fema', 'Filipía', 'Filippa', 'Filippía', 'Finna', 'Finnbjörg', 'Finnbjörk', 'Finnboga', 'Finnborg', 'Finndís', 'Finney', 'Finnfríður', 'Finnlaug', 'Finnrós', 'Fía', 'Fídes', 'Fífa', 'Fjalldís', 'Fjóla', 'Flóra', 'Folda', 'Fransiska', 'Franziska', 'Frán', 'Fregn', 'Freydís', 'Freygerður', 'Freyja', 'Freylaug', 'Freyleif', 'Friðbjörg', 'Friðbjört', 'Friðborg', 'Friðdís', 'Friðdóra', 'Friðey', 'Friðfinna', 'Friðgerður', 'Friðjóna', 'Friðlaug', 'Friðleif', 'Friðlín', 'Friðmey', 'Friðný', 'Friðrika', 'Friðrikka', 'Friðrós', 'Friðrún', 'Friðsemd', 'Friðveig', 'Friðþóra', 'Frigg', 'Fríða', 'Fríður', 'Frostrós', 'Fróðný', 'Fura', 'Fönn', 'Gabríela', 'Gabríella', 'Gauja', 'Gauthildur', 'Gefjun', 'Gefn', 'Geira', 'Geirbjörg', 'Geirdís', 'Geirfinna', 'Geirfríður', 'Geirhildur', 'Geirlaug', 'Geirlöð', 'Geirný', 'Geirríður', 'Geirrún', 'Geirþrúður', 'Georgía', 'Gerða', 'Gerður', 'Gestheiður', 'Gestný', 'Gestrún', 'Gillý', 'Gilslaug', 'Gissunn', 'Gía', 'Gígja', 'Gísela', 'Gísla', 'Gísley', 'Gíslína', 'Gíslný', 'Gíslrún', 'Gíslunn', 'Gíta', 'Gjaflaug', 'Gloría', 'Gló', 'Glóa', 'Glóbjört', 'Glódís', 'Glóð', 'Glóey', 'Gná', 'Góa', 'Gógó', 'Grein', 'Gret', 'Greta', 'Grélöð', 'Grét', 'Gréta', 'Gríma', 'Grímey', 'Grímheiður', 'Grímhildur', 'Gróa', 'Guðbjörg', 'Guðbjört', 'Guðborg', 'Guðdís', 'Guðfinna', 'Guðfríður', 'Guðjóna', 'Guðlaug', 'Guðleif', 'Guðlín', 'Guðmey', 'Guðmunda', 'Guðmundína', 'Guðný', 'Guðríður', 'Guðrún', 'Guðsteina', 'Guðveig', 'Gullbrá', 'Gullveig', 'Gullý', 'Gumma', 'Gunnbjörg', 'Gunnbjört', 'Gunnborg', 'Gunndís', 'Gunndóra', 'Gunnella', 'Gunnfinna', 'Gunnfríður', 'Gunnharða', 'Gunnheiður', 'Gunnhildur', 'Gunnjóna', 'Gunnlaug', 'Gunnleif', 'Gunnlöð', 'Gunnrún', 'Gunnur', 'Gunnveig', 'Gunnvör', 'Gunný', 'Gunnþóra', 'Gunnþórunn', 'Gurrý', 'Gúa', 'Gyða', 'Gyðja', 'Gyðríður', 'Gytta', 'Gæfa', 'Gæflaug', 'Hadda', 'Haddý', 'Hafbjörg', 'Hafborg', 'Hafdís', 'Hafey', 'Hafliða', 'Haflína', 'Hafný', 'Hafrós', 'Hafrún', 'Hafsteina', 'Hafþóra', 'Halla', 'Hallbera', 'Hallbjörg', 'Hallborg', 'Halldís', 'Halldóra', 'Halley', 'Hallfríður', 'Hallgerður', 'Hallgunnur', 'Hallkatla', 'Hallný', 'Hallrún', 'Hallveig', 'Hallvör', 'Hanna', 'Hanney', 'Hansa', 'Hansína', 'Harpa', 'Hauður', 'Hákonía', 'Heba', 'Hedda', 'Hedí', 'Heiða', 'Heiðbjörg', 'Heiðbjörk', 'Heiðbjört', 'Heiðbrá', 'Heiðdís', 'Heiðlaug', 'Heiðlóa', 'Heiðný', 'Heiðrós', 'Heiðrún', 'Heiður', 'Heiðveig', 'Hekla', 'Helen', 'Helena', 'Helga', 'Hella', 'Helma', 'Hendrikka', 'Henný', 'Henrietta', 'Henrika', 'Henríetta', 'Hera', 'Herbjörg', 'Herbjört', 'Herborg', 'Herdís', 'Herfríður', 'Hergerður', 'Herlaug', 'Hermína', 'Hersilía', 'Herta', 'Hertha', 'Hervör', 'Herþrúður', 'Hilda', 'Hildegard', 'Hildibjörg', 'Hildigerður', 'Hildigunnur', 'Hildiríður', 'Hildisif', 'Hildur', 'Hilma', 'Himinbjörg', 'Hind', 'Hinrika', 'Hinrikka', 'Hjalta', 'Hjaltey', 'Hjálmdís', 'Hjálmey', 'Hjálmfríður', 'Hjálmgerður', 'Hjálmrós', 'Hjálmrún', 'Hjálmveig', 'Hjördís', 'Hjörfríður', 'Hjörleif', 'Hjörný', 'Hjörtfríður', 'Hlaðgerður', 'Hlédís', 'Hlíf', 'Hlín', 'Hlökk', 'Hólmbjörg', 'Hólmdís', 'Hólmfríður', 'Hrafna', 'Hrafnborg', 'Hrafndís', 'Hrafney', 'Hrafngerður', 'Hrafnheiður', 'Hrafnhildur', 'Hrafnkatla', 'Hrafnlaug', 'Hrafntinna', 'Hraundís', 'Hrefna', 'Hreindís', 'Hróðný', 'Hrólfdís', 'Hrund', 'Hrönn', 'Hugbjörg', 'Hugbjört', 'Hugborg', 'Hugdís', 'Hugljúf', 'Hugrún', 'Huld', 'Hulda', 'Huldís', 'Huldrún', 'Húnbjörg', 'Húndís', 'Húngerður', 'Hvönn', 'Hödd', 'Högna', 'Hörn', 'Ida', 'Idda', 'Iða', 'Iðunn', 'Ilmur', 'Immý', 'Ina', 'Inda', 'India', 'Indiana', 'Indía', 'Indíana', 'Indíra', 'Indra', 'Inga', 'Ingdís', 'Ingeborg', 'Inger', 'Ingey', 'Ingheiður', 'Inghildur', 'Ingibjörg', 'Ingibjört', 'Ingiborg', 'Ingifinna', 'Ingifríður', 'Ingigerður', 'Ingilaug', 'Ingileif', 'Ingilín', 'Ingimaría', 'Ingimunda', 'Ingiríður', 'Ingirós', 'Ingisól', 'Ingiveig', 'Ingrid', 'Ingrún', 'Ingunn', 'Ingveldur', 'Inna', 'Irena', 'Irene', 'Irja', 'Irma', 'Irmý', 'Irpa', 'Isabel', 'Isabella', 'Ída', 'Íma', 'Ína', 'Ír', 'Íren', 'Írena', 'Íris', 'Írunn', 'Ísabel', 'Ísabella', 'Ísadóra', 'Ísafold', 'Ísalind', 'Ísbjörg', 'Ísdís', 'Ísey', 'Ísfold', 'Ísgerður', 'Íshildur', 'Ísis', 'Íslaug', 'Ísleif', 'Ísmey', 'Ísold', 'Ísól', 'Ísrún', 'Íssól', 'Ísveig', 'Íunn', 'Íva', 'Jakobína', 'Jana', 'Jane', 'Janetta', 'Jannika', 'Jara', 'Jarún', 'Jarþrúður', 'Jasmín', 'Járnbrá', 'Járngerður', 'Jenetta', 'Jenna', 'Jenný', 'Jensína', 'Jessý', 'Jovina', 'Jóa', 'Jóanna', 'Jódís', 'Jófríður', 'Jóhanna', 'Jólín', 'Jóna', 'Jónanna', 'Jónasína', 'Jónbjörg', 'Jónbjört', 'Jóndís', 'Jóndóra', 'Jóney', 'Jónfríður', 'Jóngerð', 'Jónheiður', 'Jónhildur', 'Jóninna', 'Jónída', 'Jónína', 'Jónný', 'Jóný', 'Jóra', 'Jóríður', 'Jórlaug', 'Jórunn', 'Jósebína', 'Jósefín', 'Jósefína', 'Judith', 'Júdea', 'Júdit', 'Júlía', 'Júlíana', 'Júlíanna', 'Júlíetta', 'Júlírós', 'Júnía', 'Júníana', 'Jökla', 'Jökulrós', 'Jörgína', 'Kaðlín', 'Kaja', 'Kalla', 'Kamilla', 'Kamí', 'Kamma', 'Kapitola', 'Kapítóla', 'Kara', 'Karen', 'Karin', 'Karitas', 'Karí', 'Karín', 'Karína', 'Karítas', 'Karla', 'Karlinna', 'Karlína', 'Karlotta', 'Karolína', 'Karó', 'Karólín', 'Karólína', 'Kassandra', 'Kata', 'Katarína', 'Katerína', 'Katharina', 'Kathinka', 'Katinka', 'Katla', 'Katrín', 'Katrína', 'Katý', 'Kára', 'Kellý', 'Kendra', 'Ketilbjörg', 'Ketilfríður', 'Ketilríður', 'Kiddý', 'Kira', 'Kirsten', 'Kirstín', 'Kittý', 'Kjalvör', 'Klara', 'Kládía', 'Klementína', 'Kleópatra', 'Kolbjörg', 'Kolbrá', 'Kolbrún', 'Koldís', 'Kolfinna', 'Kolfreyja', 'Kolgríma', 'Kolka', 'Konkordía', 'Konný', 'Korka', 'Kormlöð', 'Kornelía', 'Kókó', 'Krista', 'Kristbjörg', 'Kristborg', 'Kristel', 'Kristensa', 'Kristey', 'Kristfríður', 'Kristgerður', 'Kristin', 'Kristine', 'Kristíana', 'Kristíanna', 'Kristín', 'Kristína', 'Kristjana', 'Kristjóna', 'Kristlaug', 'Kristlind', 'Kristlín', 'Kristný', 'Kristólína', 'Kristrós', 'Kristrún', 'Kristveig', 'Kristvina', 'Kristþóra', 'Kría', 'Kæja', 'Laila', 'Laíla', 'Lana', 'Lara', 'Laufey', 'Laufheiður', 'Laufhildur', 'Lauga', 'Laugey', 'Laugheiður', 'Lára', 'Lárensína', 'Láretta', 'Lárey', 'Lea', 'Leikný', 'Leila', 'Lena', 'Leonóra', 'Leóna', 'Leónóra', 'Lilja', 'Liljá', 'Liljurós', 'Lill', 'Lilla', 'Lillian', 'Lillý', 'Lily', 'Lilý', 'Lind', 'Linda', 'Linddís', 'Lingný', 'Lisbeth', 'Listalín', 'Liv', 'Líba', 'Líf', 'Lífdís', 'Lín', 'Lína', 'Línbjörg', 'Líndís', 'Líneik', 'Líney', 'Línhildur', 'Lísa', 'Lísabet', 'Lísandra', 'Lísbet', 'Lísebet', 'Lív', 'Ljósbjörg', 'Ljósbrá', 'Ljótunn', 'Lofn', 'Loftveig', 'Logey', 'Lokbrá', 'Lotta', 'Louisa', 'Lousie', 'Lovísa', 'Lóa', 'Lóreley', 'Lukka', 'Lúcía', 'Lúðvíka', 'Lúísa', 'Lúna', 'Lúsinda', 'Lúsía', 'Lúvísa', 'Lydia', 'Lydía', 'Lyngheiður', 'Lýdía', 'Læla', 'Maddý', 'Magda', 'Magdalena', 'Magðalena', 'Magga', 'Maggey', 'Maggý', 'Magna', 'Magndís', 'Magnea', 'Magnes', 'Magney', 'Magnfríður', 'Magnheiður', 'Magnhildur', 'Magnúsína', 'Magný', 'Magnþóra', 'Maía', 'Maídís', 'Maísól', 'Maj', 'Maja', 'Malen', 'Malena', 'Malía', 'Malín', 'Malla', 'Manda', 'Manúela', 'Mara', 'Mardís', 'Marela', 'Marella', 'Maren', 'Marey', 'Marfríður', 'Margit', 'Margot', 'Margret', 'Margrét', 'Margrjet', 'Margunnur', 'Marheiður', 'Maria', 'Marie', 'Marikó', 'Marinella', 'Marit', 'Marí', 'María', 'Maríam', 'Marían', 'Maríana', 'Maríanna', 'Marín', 'Marína', 'Marínella', 'Maríon', 'Marísa', 'Marísól', 'Marít', 'Maríuerla', 'Marja', 'Markrún', 'Marlaug', 'Marlena', 'Marlín', 'Marlís', 'Marólína', 'Marsa', 'Marselía', 'Marselína', 'Marsibil', 'Marsilía', 'Marsý', 'Marta', 'Martha', 'Martína', 'Mary', 'Marý', 'Matta', 'Mattea', 'Matthea', 'Matthilda', 'Matthildur', 'Matthía', 'Mattíana', 'Mattína', 'Mattý', 'Maxima', 'Mábil', 'Málfríður', 'Málhildur', 'Málmfríður', 'Mánadís', 'Máney', 'Mára', 'Meda', 'Mekkin', 'Mekkín', 'Melinda', 'Melissa', 'Melkorka', 'Melrós', 'Messíana', 'Metta', 'Mey', 'Mikaela', 'Mikaelína', 'Mikkalína', 'Milda', 'Mildríður', 'Milla', 'Millý', 'Minerva', 'Minna', 'Minney', 'Minný', 'Miriam', 'Mirja', 'Mirjam', 'Mirra', 'Mist', 'Mía', 'Mínerva', 'Míra', 'Míranda', 'Mítra', 'Mjaðveig', 'Mjalldís', 'Mjallhvít', 'Mjöll', 'Mona', 'Monika', 'Módís', 'Móeiður', 'Móey', 'Móheiður', 'Móna', 'Mónika', 'Móníka', 'Munda', 'Mundheiður', 'Mundhildur', 'Mundína', 'Myrra', 'Mýr', 'Mýra', 'Mýrún', 'Mörk', 'Nadia', 'Nadía', 'Nadja', 'Nana', 'Nanna', 'Nanný', 'Nansý', 'Naomí', 'Naómí', 'Natalie', 'Natalía', 'Náttsól', 'Nella', 'Nellý', 'Nenna', 'Nicole', 'Niðbjörg', 'Nikíta', 'Nikoletta', 'Nikólína', 'Ninja', 'Ninna', 'Nína', 'Níní', 'Njála', 'Njóla', 'Norma', 'Nóa', 'Nóra', 'Nótt', 'Nýbjörg', 'Odda', 'Oddbjörg', 'Oddfreyja', 'Oddfríður', 'Oddgerður', 'Oddhildur', 'Oddlaug', 'Oddleif', 'Oddný', 'Oddrún', 'Oddveig', 'Oddvör', 'Oktavía', 'Októvía', 'Olga', 'Ollý', 'Ora', 'Orka', 'Ormheiður', 'Ormhildur', 'Otkatla', 'Otta', 'Óda', 'Ófelía', 'Óla', 'Ólafía', 'Ólafína', 'Ólavía', 'Ólivía', 'Ólína', 'Ólöf', 'Ósa', 'Ósk', 'Ótta', 'Pamela', 'París', 'Patricia', 'Patrisía', 'Pála', 'Páldís', 'Páley', 'Pálfríður', 'Pálhanna', 'Pálheiður', 'Pálhildur', 'Pálín', 'Pálína', 'Pálmey', 'Pálmfríður', 'Pálrún', 'Perla', 'Peta', 'Petra', 'Petrea', 'Petrína', 'Petronella', 'Petrónella', 'Petrós', 'Petrún', 'Petrúnella', 'Pétrína', 'Pétrún', 'Pía', 'Polly', 'Pollý', 'Pría', 'Rafney', 'Rafnhildur', 'Ragna', 'Ragnbjörg', 'Ragney', 'Ragnfríður', 'Ragnheiður', 'Ragnhildur', 'Rakel', 'Ramóna', 'Randalín', 'Randíður', 'Randý', 'Ranka', 'Rannva', 'Rannveig', 'Ráðhildur', 'Rán', 'Rebekka', 'Reginbjörg', 'Regína', 'Rein', 'Renata', 'Reyn', 'Reyndís', 'Reynheiður', 'Reynhildur', 'Rikka', 'Ripley', 'Rita', 'Ríkey', 'Rín', 'Ríta', 'Ronja', 'Rorí', 'Roxanna', 'Róberta', 'Róbjörg', 'Rós', 'Rósa', 'Rósalind', 'Rósanna', 'Rósbjörg', 'Rósborg', 'Róselía', 'Rósey', 'Rósfríður', 'Róshildur', 'Rósinkara', 'Rósinkransa', 'Róska', 'Róslaug', 'Róslind', 'Róslinda', 'Róslín', 'Rósmary', 'Rósmarý', 'Rósmunda', 'Rósný', 'Runný', 'Rut', 'Ruth', 'Rúbý', 'Rún', 'Rúna', 'Rúndís', 'Rúnhildur', 'Rúrí', 'Röfn', 'Rögn', 'Röskva', 'Sabína', 'Sabrína', 'Saga', 'Salbjörg', 'Saldís', 'Salgerður', 'Salín', 'Salína', 'Salka', 'Salma', 'Salný', 'Salome', 'Salóme', 'Salvör', 'Sandra', 'Sanna', 'Santía', 'Sara', 'Sarína', 'Sefanía', 'Selja', 'Selka', 'Selma', 'Senía', 'Septíma', 'Sera', 'Serena', 'Seselía', 'Sesilía', 'Sesselía', 'Sesselja', 'Sessilía', 'Sif', 'Sigdís', 'Sigdóra', 'Sigfríð', 'Sigfríður', 'Sigga', 'Siggerður', 'Sigmunda', 'Signa', 'Signhildur', 'Signý', 'Sigríður', 'Sigrún', 'Sigurást', 'Sigurásta', 'Sigurbára', 'Sigurbirna', 'Sigurbjörg', 'Sigurbjört', 'Sigurborg', 'Sigurdís', 'Sigurdóra', 'Sigurdríf', 'Sigurdrífa', 'Sigurða', 'Sigurey', 'Sigurfinna', 'Sigurfljóð', 'Sigurgeira', 'Sigurhanna', 'Sigurhelga', 'Sigurhildur', 'Sigurjóna', 'Sigurlaug', 'Sigurleif', 'Sigurlilja', 'Sigurlinn', 'Sigurlín', 'Sigurlína', 'Sigurmunda', 'Sigurnanna', 'Sigurósk', 'Sigurrós', 'Sigursteina', 'Sigurunn', 'Sigurveig', 'Sigurvina', 'Sigurþóra', 'Sigyn', 'Sigþóra', 'Sigþrúður', 'Silfa', 'Silfá', 'Silfrún', 'Silja', 'Silka', 'Silla', 'Silva', 'Silvana', 'Silvía', 'Sirra', 'Sirrý', 'Siv', 'Sía', 'Símonía', 'Sísí', 'Síta', 'Sjöfn', 'Skarpheiður', 'Skugga', 'Skuld', 'Skúla', 'Skúlína', 'Snjáfríður', 'Snjáka', 'Snjófríður', 'Snjólaug', 'Snorra', 'Snót', 'Snæbjörg', 'Snæbjört', 'Snæborg', 'Snæbrá', 'Snædís', 'Snæfríður', 'Snælaug', 'Snærós', 'Snærún', 'Soffía', 'Sofie', 'Sofía', 'Solveig', 'Sonja', 'Sonný', 'Sophia', 'Sophie', 'Sól', 'Sóla', 'Sólbjörg', 'Sólbjört', 'Sólborg', 'Sólbrá', 'Sólbrún', 'Sóldís', 'Sóldögg', 'Sóley', 'Sólfríður', 'Sólgerður', 'Sólhildur', 'Sólín', 'Sólkatla', 'Sóllilja', 'Sólný', 'Sólrós', 'Sólrún', 'Sólveig', 'Sólvör', 'Sónata', 'Stefana', 'Stefanía', 'Stefánný', 'Steina', 'Steinbjörg', 'Steinborg', 'Steindís', 'Steindóra', 'Steiney', 'Steinfríður', 'Steingerður', 'Steinhildur', 'Steinlaug', 'Steinrós', 'Steinrún', 'Steinunn', 'Steinvör', 'Steinþóra', 'Stella', 'Stígheiður', 'Stígrún', 'Stína', 'Stjarna', 'Styrgerður', 'Sumarlína', 'Sumarrós', 'Sunna', 'Sunnefa', 'Sunneva', 'Sunniva', 'Sunníva', 'Susan', 'Súla', 'Súsan', 'Súsanna', 'Svafa', 'Svala', 'Svalrún', 'Svana', 'Svanbjörg', 'Svanbjört', 'Svanborg', 'Svandís', 'Svaney', 'Svanfríður', 'Svanheiður', 'Svanhildur', 'Svanhvít', 'Svanlaug', 'Svanrós', 'Svanþrúður', 'Svava', 'Svea', 'Sveina', 'Sveinbjörg', 'Sveinborg', 'Sveindís', 'Sveiney', 'Sveinfríður', 'Sveingerður', 'Sveinhildur', 'Sveinlaug', 'Sveinrós', 'Sveinrún', 'Sveinsína', 'Sveinveig', 'Sylgja', 'Sylva', 'Sylvía', 'Sæbjörg', 'Sæbjört', 'Sæborg', 'Sædís', 'Sæfinna', 'Sæfríður', 'Sæhildur', 'Sælaug', 'Sæmunda', 'Sæný', 'Særós', 'Særún', 'Sæsól', 'Sæunn', 'Sævör', 'Sölva', 'Sölvey', 'Sölvína', 'Tala', 'Talía', 'Tamar', 'Tamara', 'Tanía', 'Tanja', 'Tanya', 'Tanya', 'Tara', 'Tea', 'Teitný', 'Tekla', 'Telma', 'Tera', 'Teresa', 'Teresía', 'Thea', 'Thelma', 'Theodóra', 'Theódóra', 'Theresa', 'Tindra', 'Tinna', 'Tirsa', 'Tía', 'Tíbrá', 'Tína', 'Todda', 'Torbjörg', 'Torfey', 'Torfheiður', 'Torfhildur', 'Tóbý', 'Tóka', 'Tóta', 'Tristana', 'Trú', 'Tryggva', 'Tryggvína', 'Týra', 'Ugla', 'Una', 'Undína', 'Unna', 'Unnbjörg', 'Unndís', 'Unnur', 'Urður', 'Úa', 'Úlfa', 'Úlfdís', 'Úlfey', 'Úlfheiður', 'Úlfhildur', 'Úlfrún', 'Úlla', 'Úna', 'Úndína', 'Úranía', 'Úrsúla', 'Vagna', 'Vagnbjörg', 'Vagnfríður', 'Vaka', 'Vala', 'Valbjörg', 'Valbjörk', 'Valbjört', 'Valborg', 'Valdheiður', 'Valdís', 'Valentína', 'Valería', 'Valey', 'Valfríður', 'Valgerða', 'Valgerður', 'Valhildur', 'Valka', 'Vallý', 'Valný', 'Valrós', 'Valrún', 'Valva', 'Valý', 'Valþrúður', 'Vanda', 'Vár', 'Veig', 'Veiga', 'Venus', 'Vera', 'Veronika', 'Verónika', 'Veróníka', 'Vetrarrós', 'Vébjörg', 'Védís', 'Végerður', 'Vélaug', 'Véný', 'Vibeka', 'Victoría', 'Viðja', 'Vigdís', 'Vigný', 'Viktoria', 'Viktoría', 'Vilborg', 'Vildís', 'Vilfríður', 'Vilgerður', 'Vilhelmína', 'Villa', 'Villimey', 'Vilma', 'Vilný', 'Vinbjörg', 'Vinný', 'Vinsý', 'Virginía', 'Víbekka', 'Víf', 'Vígdögg', 'Víggunnur', 'Víóla', 'Víóletta', 'Vísa', 'Von', 'Von', 'Voney', 'Vordís', 'Ylfa', 'Ylfur', 'Ylja', 'Ylva', 'Ynja', 'Yrja', 'Yrsa', 'Ýja', 'Ýma', 'Ýr', 'Ýrr', 'Þalía', 'Þeba', 'Þeódís', 'Þeódóra', 'Þjóðbjörg', 'Þjóðhildur', 'Þoka', 'Þorbjörg', 'Þorfinna', 'Þorgerður', 'Þorgríma', 'Þorkatla', 'Þorlaug', 'Þorleif', 'Þorsteina', 'Þorstína', 'Þóra', 'Þóranna', 'Þórarna', 'Þórbjörg', 'Þórdís', 'Þórða', 'Þórelfa', 'Þórelfur', 'Þórey', 'Þórfríður', 'Þórgunna', 'Þórgunnur', 'Þórhalla', 'Þórhanna', 'Þórheiður', 'Þórhildur', 'Þórkatla', 'Þórlaug', 'Þórleif', 'Þórný', 'Þórodda', 'Þórsteina', 'Þórsteinunn', 'Þórstína', 'Þórunn', 'Þórveig', 'Þórvör', 'Þrá', 'Þrúða', 'Þrúður', 'Þula', 'Þura', 'Þurí', 'Þuríður', 'Þurý', 'Þúfa', 'Þyri', 'Þyrí', 'Þöll', 'Ægileif', 'Æsa', 'Æsgerður', 'Ögmunda', 'Ögn', 'Ölrún', 'Ölveig', 'Örbrún', 'Örk', 'Ösp'); + + /** + * @var string Icelandic men names. + */ + protected static $firstNameMale = array('Aage', 'Abel', 'Abraham', 'Adam', 'Addi', 'Adel', 'Adíel', 'Adólf', 'Adrían', 'Adríel', 'Aðalberg', 'Aðalbergur', 'Aðalbert', 'Aðalbjörn', 'Aðalborgar', 'Aðalgeir', 'Aðalmundur', 'Aðalráður', 'Aðalsteinn', 'Aðólf', 'Agnar', 'Agni', 'Albert', 'Aldar', 'Alex', 'Alexander', 'Alexíus', 'Alfons', 'Alfred', 'Alfreð', 'Ali', 'Allan', 'Alli', 'Almar', 'Alrekur', 'Alvar', 'Alvin', 'Amír', 'Amos', 'Anders', 'Andreas', 'André', 'Andrés', 'Andri', 'Anes', 'Anfinn', 'Angantýr', 'Angi', 'Annar', 'Annarr', 'Annas', 'Annel', 'Annes', 'Anthony', 'Anton', 'Antoníus', 'Aran', 'Arent', 'Ares', 'Ari', 'Arilíus', 'Arinbjörn', 'Aríel', 'Aríus', 'Arnald', 'Arnaldur', 'Arnar', 'Arnberg', 'Arnbergur', 'Arnbjörn', 'Arndór', 'Arnes', 'Arnfinnur', 'Arnfreyr', 'Arngeir', 'Arngils', 'Arngrímur', 'Arnkell', 'Arnlaugur', 'Arnleifur', 'Arnljótur', 'Arnmóður', 'Arnmundur', 'Arnoddur', 'Arnold', 'Arnór', 'Arnsteinn', 'Arnúlfur', 'Arnviður', 'Arnþór', 'Aron', 'Arthur', 'Arthúr', 'Artúr', 'Asael', 'Askur', 'Aspar', 'Atlas', 'Atli', 'Auðbergur', 'Auðbert', 'Auðbjörn', 'Auðgeir', 'Auðkell', 'Auðmundur', 'Auðólfur', 'Auðun', 'Auðunn', 'Austar', 'Austmann', 'Austmar', 'Austri', 'Axel', 'Ágúst', 'Áki', 'Álfar', 'Álfgeir', 'Álfgrímur', 'Álfur', 'Álfþór', 'Ámundi', 'Árbjartur', 'Árbjörn', 'Árelíus', 'Árgeir', 'Árgils', 'Ármann', 'Árni', 'Ársæll', 'Ás', 'Ásberg', 'Ásbergur', 'Ásbjörn', 'Ásgautur', 'Ásgeir', 'Ásgils', 'Ásgrímur', 'Ási', 'Áskell', 'Áslaugur', 'Áslákur', 'Ásmar', 'Ásmundur', 'Ásólfur', 'Ásröður', 'Ástbjörn', 'Ástgeir', 'Ástmar', 'Ástmundur', 'Ástráður', 'Ástríkur', 'Ástvald', 'Ástvaldur', 'Ástvar', 'Ástvin', 'Ástþór', 'Ásvaldur', 'Ásvarður', 'Ásþór', 'Baldur', 'Baldvin', 'Baldwin', 'Baltasar', 'Bambi', 'Barði', 'Barri', 'Bassi', 'Bastían', 'Baugur', 'Bárður', 'Beinir', 'Beinteinn', 'Beitir', 'Bekan', 'Benedikt', 'Benidikt', 'Benjamín', 'Benoný', 'Benóní', 'Benóný', 'Bent', 'Berent', 'Berg', 'Bergfinnur', 'Berghreinn', 'Bergjón', 'Bergmann', 'Bergmar', 'Bergmundur', 'Bergsteinn', 'Bergsveinn', 'Bergur', 'Bergvin', 'Bergþór', 'Bernhard', 'Bernharð', 'Bernharður', 'Berni', 'Bernódus', 'Bersi', 'Bertel', 'Bertram', 'Bessi', 'Betúel', 'Bill', 'Birgir', 'Birkir', 'Birnir', 'Birtingur', 'Birtir', 'Bjargar', 'Bjargmundur', 'Bjargþór', 'Bjarkan', 'Bjarkar', 'Bjarki', 'Bjarmar', 'Bjarmi', 'Bjarnar', 'Bjarnfinnur', 'Bjarnfreður', 'Bjarnharður', 'Bjarnhéðinn', 'Bjarni', 'Bjarnlaugur', 'Bjarnleifur', 'Bjarnólfur', 'Bjarnsteinn', 'Bjarnþór', 'Bjartmann', 'Bjartmar', 'Bjartur', 'Bjartþór', 'Bjólan', 'Bjólfur', 'Björgmundur', 'Björgólfur', 'Björgúlfur', 'Björgvin', 'Björn', 'Björnólfur', 'Blængur', 'Blær', 'Blævar', 'Boði', 'Bogi', 'Bolli', 'Borgar', 'Borgúlfur', 'Borgþór', 'Bóas', 'Bói', 'Bótólfur', 'Bragi', 'Brandur', 'Breki', 'Bresi', 'Brestir', 'Brimar', 'Brimi', 'Brimir', 'Brími', 'Brjánn', 'Broddi', 'Bruno', 'Bryngeir', 'Brynjar', 'Brynjólfur', 'Brynjúlfur', 'Brynleifur', 'Brynsteinn', 'Bryntýr', 'Brynþór', 'Burkni', 'Búi', 'Búri', 'Bæring', 'Bæringur', 'Bæron', 'Böðvar', 'Börkur', 'Carl', 'Cecil', 'Christian', 'Christopher', 'Cýrus', 'Daði', 'Dagbjartur', 'Dagfari', 'Dagfinnur', 'Daggeir', 'Dagmann', 'Dagnýr', 'Dagur', 'Dagþór', 'Dalbert', 'Dalli', 'Dalmann', 'Dalmar', 'Dalvin', 'Damjan', 'Dan', 'Danelíus', 'Daniel', 'Danival', 'Daníel', 'Daníval', 'Dante', 'Daríus', 'Darri', 'Davíð', 'Demus', 'Deníel', 'Dennis', 'Diðrik', 'Díómedes', 'Dofri', 'Dolli', 'Dominik', 'Dómald', 'Dómaldi', 'Dómaldur', 'Dónald', 'Dónaldur', 'Dór', 'Dóri', 'Dósóþeus', 'Draupnir', 'Dreki', 'Drengur', 'Dufgus', 'Dufþakur', 'Dugfús', 'Dúi', 'Dúnn', 'Dvalinn', 'Dýri', 'Dýrmundur', 'Ebbi', 'Ebeneser', 'Ebenezer', 'Eberg', 'Edgar', 'Edilon', 'Edílon', 'Edvard', 'Edvin', 'Edward', 'Eðvald', 'Eðvar', 'Eðvarð', 'Efraím', 'Eggert', 'Eggþór', 'Egill', 'Eiðar', 'Eiður', 'Eikar', 'Eilífur', 'Einar', 'Einir', 'Einvarður', 'Einþór', 'Eiríkur', 'Eivin', 'Elberg', 'Elbert', 'Eldar', 'Eldgrímur', 'Eldjárn', 'Eldmar', 'Eldon', 'Eldór', 'Eldur', 'Elentínus', 'Elfar', 'Elfráður', 'Elimar', 'Elinór', 'Elis', 'Elí', 'Elías', 'Elíeser', 'Elímar', 'Elínbergur', 'Elínmundur', 'Elínór', 'Elís', 'Ellert', 'Elli', 'Elliði', 'Ellís', 'Elmar', 'Elvar', 'Elvin', 'Elvis', 'Emanúel', 'Embrek', 'Emerald', 'Emil', 'Emmanúel', 'Engilbert', 'Engilbjartur', 'Engiljón', 'Engill', 'Enok', 'Eric', 'Erik', 'Erlar', 'Erlendur', 'Erling', 'Erlingur', 'Ernestó', 'Ernir', 'Ernst', 'Eron', 'Erpur', 'Esekíel', 'Esjar', 'Esra', 'Estefan', 'Evald', 'Evan', 'Evert', 'Eyberg', 'Eyjólfur', 'Eylaugur', 'Eyleifur', 'Eymar', 'Eymundur', 'Eyríkur', 'Eysteinn', 'Eyvar', 'Eyvindur', 'Eyþór', 'Fabrisíus', 'Falgeir', 'Falur', 'Fannar', 'Fannberg', 'Fanngeir', 'Fáfnir', 'Fálki', 'Felix', 'Fengur', 'Fenrir', 'Ferdinand', 'Ferdínand', 'Fertram', 'Feykir', 'Filip', 'Filippus', 'Finn', 'Finnbjörn', 'Finnbogi', 'Finngeir', 'Finnjón', 'Finnlaugur', 'Finnur', 'Finnvarður', 'Fífill', 'Fjalar', 'Fjarki', 'Fjólar', 'Fjólmundur', 'Fjölnir', 'Fjölvar', 'Fjörnir', 'Flemming', 'Flosi', 'Flóki', 'Flórent', 'Flóvent', 'Forni', 'Fossmar', 'Fólki', 'Francis', 'Frank', 'Franklín', 'Frans', 'Franz', 'Fránn', 'Frár', 'Freybjörn', 'Freygarður', 'Freymar', 'Freymóður', 'Freymundur', 'Freyr', 'Freysteinn', 'Freyviður', 'Freyþór', 'Friðberg', 'Friðbergur', 'Friðbert', 'Friðbjörn', 'Friðfinnur', 'Friðgeir', 'Friðjón', 'Friðlaugur', 'Friðleifur', 'Friðmann', 'Friðmar', 'Friðmundur', 'Friðrik', 'Friðsteinn', 'Friður', 'Friðvin', 'Friðþjófur', 'Friðþór', 'Friedrich', 'Fritz', 'Frímann', 'Frosti', 'Fróði', 'Fróðmar', 'Funi', 'Fúsi', 'Fylkir', 'Gabriel', 'Gabríel', 'Gael', 'Galdur', 'Gamalíel', 'Garðar', 'Garibaldi', 'Garpur', 'Garri', 'Gaui', 'Gaukur', 'Gauti', 'Gautrekur', 'Gautur', 'Gautviður', 'Geir', 'Geirarður', 'Geirfinnur', 'Geirharður', 'Geirhjörtur', 'Geirhvatur', 'Geiri', 'Geirlaugur', 'Geirleifur', 'Geirmundur', 'Geirólfur', 'Geirröður', 'Geirtryggur', 'Geirvaldur', 'Geirþjófur', 'Geisli', 'Gellir', 'Georg', 'Gerald', 'Gerðar', 'Geri', 'Gestur', 'Gilbert', 'Gilmar', 'Gils', 'Gissur', 'Gizur', 'Gídeon', 'Gígjar', 'Gísli', 'Gjúki', 'Glói', 'Glúmur', 'Gneisti', 'Gnúpur', 'Gnýr', 'Goði', 'Goðmundur', 'Gottskálk', 'Gottsveinn', 'Gói', 'Grani', 'Grankell', 'Gregor', 'Greipur', 'Greppur', 'Gretar', 'Grettir', 'Grétar', 'Grímar', 'Grímkell', 'Grímlaugur', 'Grímnir', 'Grímólfur', 'Grímur', 'Grímúlfur', 'Guðberg', 'Guðbergur', 'Guðbjarni', 'Guðbjartur', 'Guðbjörn', 'Guðbrandur', 'Guðfinnur', 'Guðfreður', 'Guðgeir', 'Guðjón', 'Guðlaugur', 'Guðleifur', 'Guðleikur', 'Guðmann', 'Guðmar', 'Guðmon', 'Guðmundur', 'Guðni', 'Guðráður', 'Guðröður', 'Guðsteinn', 'Guðvarður', 'Guðveigur', 'Guðvin', 'Guðþór', 'Gumi', 'Gunnar', 'Gunnberg', 'Gunnbjörn', 'Gunndór', 'Gunngeir', 'Gunnhallur', 'Gunnlaugur', 'Gunnleifur', 'Gunnólfur', 'Gunnóli', 'Gunnröður', 'Gunnsteinn', 'Gunnvaldur', 'Gunnþór', 'Gustav', 'Gutti', 'Guttormur', 'Gústaf', 'Gústav', 'Gylfi', 'Gyrðir', 'Gýgjar', 'Gýmir', 'Haddi', 'Haddur', 'Hafberg', 'Hafgrímur', 'Hafliði', 'Hafnar', 'Hafni', 'Hafsteinn', 'Hafþór', 'Hagalín', 'Hagbarður', 'Hagbert', 'Haki', 'Hallberg', 'Hallbjörn', 'Halldór', 'Hallfreður', 'Hallgarður', 'Hallgeir', 'Hallgils', 'Hallgrímur', 'Hallkell', 'Hallmann', 'Hallmar', 'Hallmundur', 'Hallsteinn', 'Hallur', 'Hallvarður', 'Hallþór', 'Hamar', 'Hannes', 'Hannibal', 'Hans', 'Harald', 'Haraldur', 'Harri', 'Harry', 'Harrý', 'Hartmann', 'Hartvig', 'Hauksteinn', 'Haukur', 'Haukvaldur', 'Hákon', 'Háleygur', 'Hálfdan', 'Hálfdán', 'Hámundur', 'Hárekur', 'Hárlaugur', 'Hásteinn', 'Hávar', 'Hávarður', 'Hávarr', 'Hávarr', 'Heiðar', 'Heiðarr', 'Heiðberg', 'Heiðbert', 'Heiðlindur', 'Heiðmann', 'Heiðmar', 'Heiðmundur', 'Heiðrekur', 'Heikir', 'Heilmóður', 'Heimir', 'Heinrekur', 'Heisi', 'Hektor', 'Helgi', 'Helmút', 'Hemmert', 'Hendrik', 'Henning', 'Henrik', 'Henry', 'Henrý', 'Herbert', 'Herbjörn', 'Herfinnur', 'Hergeir', 'Hergill', 'Hergils', 'Herjólfur', 'Herlaugur', 'Herleifur', 'Herluf', 'Hermann', 'Hermóður', 'Hermundur', 'Hersir', 'Hersteinn', 'Hersveinn', 'Hervar', 'Hervarður', 'Hervin', 'Héðinn', 'Hilaríus', 'Hilbert', 'Hildar', 'Hildibergur', 'Hildibrandur', 'Hildigeir', 'Hildiglúmur', 'Hildimar', 'Hildimundur', 'Hildingur', 'Hildir', 'Hildiþór', 'Hilmar', 'Hilmir', 'Himri', 'Hinrik', 'Híram', 'Hjallkár', 'Hjalti', 'Hjarnar', 'Hjálmar', 'Hjálmgeir', 'Hjálmtýr', 'Hjálmur', 'Hjálmþór', 'Hjörleifur', 'Hjörtur', 'Hjörtþór', 'Hjörvar', 'Hleiðar', 'Hlégestur', 'Hlér', 'Hlini', 'Hlíðar', 'Hlíðberg', 'Hlífar', 'Hljómur', 'Hlynur', 'Hlöðmundur', 'Hlöður', 'Hlöðvarður', 'Hlöðver', 'Hnefill', 'Hnikar', 'Hnikarr', 'Holgeir', 'Holger', 'Holti', 'Hólm', 'Hólmar', 'Hólmbert', 'Hólmfastur', 'Hólmgeir', 'Hólmgrímur', 'Hólmkell', 'Hólmsteinn', 'Hólmþór', 'Hóseas', 'Hrafn', 'Hrafnar', 'Hrafnbergur', 'Hrafnkell', 'Hrafntýr', 'Hrannar', 'Hrappur', 'Hraunar', 'Hreggviður', 'Hreiðar', 'Hreiðmar', 'Hreimur', 'Hreinn', 'Hringur', 'Hrímnir', 'Hrollaugur', 'Hrolleifur', 'Hróaldur', 'Hróar', 'Hróbjartur', 'Hróðgeir', 'Hróðmar', 'Hróðólfur', 'Hróðvar', 'Hrói', 'Hrólfur', 'Hrómundur', 'Hrútur', 'Hrærekur', 'Hugberg', 'Hugi', 'Huginn', 'Hugleikur', 'Hugo', 'Hugó', 'Huldar', 'Huxley', 'Húbert', 'Húgó', 'Húmi', 'Húnbogi', 'Húni', 'Húnn', 'Húnröður', 'Hvannar', 'Hyltir', 'Hylur', 'Hængur', 'Hænir', 'Höður', 'Högni', 'Hörður', 'Höskuldur', 'Illugi', 'Immanúel', 'Indriði', 'Ingberg', 'Ingi', 'Ingiberg', 'Ingibergur', 'Ingibert', 'Ingibjartur', 'Ingibjörn', 'Ingileifur', 'Ingimagn', 'Ingimar', 'Ingimundur', 'Ingivaldur', 'Ingiþór', 'Ingjaldur', 'Ingmar', 'Ingólfur', 'Ingvaldur', 'Ingvar', 'Ingvi', 'Ingþór', 'Ismael', 'Issi', 'Ían', 'Ígor', 'Ími', 'Ísak', 'Ísar', 'Ísarr', 'Ísbjörn', 'Íseldur', 'Ísgeir', 'Ísidór', 'Ísleifur', 'Ísmael', 'Ísmar', 'Ísólfur', 'Ísrael', 'Ívan', 'Ívar', 'Jack', 'Jafet', 'Jaki', 'Jakob', 'Jakop', 'Jamil', 'Jan', 'Janus', 'Jarl', 'Jason', 'Járngrímur', 'Játgeir', 'Játmundur', 'Játvarður', 'Jenni', 'Jens', 'Jeremías', 'Jes', 'Jesper', 'Jochum', 'Johan', 'John', 'Joshua', 'Jóakim', 'Jóann', 'Jóel', 'Jóhann', 'Jóhannes', 'Jói', 'Jómar', 'Jómundur', 'Jón', 'Jónar', 'Jónas', 'Jónatan', 'Jónbjörn', 'Jóndór', 'Jóngeir', 'Jónmundur', 'Jónsteinn', 'Jónþór', 'Jósafat', 'Jósavin', 'Jósef', 'Jósep', 'Jósteinn', 'Jósúa', 'Jóvin', 'Julian', 'Júlí', 'Júlían', 'Júlíus', 'Júní', 'Júníus', 'Júrek', 'Jökull', 'Jörfi', 'Jörgen', 'Jörmundur', 'Jörri', 'Jörundur', 'Jörvar', 'Jörvi', 'Kaj', 'Kakali', 'Kaktus', 'Kaldi', 'Kaleb', 'Kali', 'Kalman', 'Kalmann', 'Kalmar', 'Kaprasíus', 'Karel', 'Karim', 'Karkur', 'Karl', 'Karles', 'Karli', 'Karvel', 'Kaspar', 'Kasper', 'Kastíel', 'Katarínus', 'Kató', 'Kár', 'Kári', 'Keran', 'Ketilbjörn', 'Ketill', 'Kilían', 'Kiljan', 'Kjalar', 'Kjallakur', 'Kjaran', 'Kjartan', 'Kjarval', 'Kjárr', 'Kjói', 'Klemens', 'Klemenz', 'Klængur', 'Knútur', 'Knörr', 'Koðrán', 'Koggi', 'Kolbeinn', 'Kolbjörn', 'Kolfinnur', 'Kolgrímur', 'Kolmar', 'Kolskeggur', 'Kolur', 'Kolviður', 'Konráð', 'Konstantínus', 'Kormákur', 'Kornelíus', 'Kort', 'Kópur', 'Kraki', 'Kris', 'Kristall', 'Kristberg', 'Kristbergur', 'Kristbjörn', 'Kristdór', 'Kristens', 'Krister', 'Kristfinnur', 'Kristgeir', 'Kristian', 'Kristinn', 'Kristján', 'Kristjón', 'Kristlaugur', 'Kristleifur', 'Kristmann', 'Kristmar', 'Kristmundur', 'Kristofer', 'Kristófer', 'Kristvaldur', 'Kristvarður', 'Kristvin', 'Kristþór', 'Krummi', 'Kveldúlfur', 'Lambert', 'Lars', 'Laufar', 'Laugi', 'Lauritz', 'Lár', 'Lárent', 'Lárentíus', 'Lárus', 'Leiðólfur', 'Leif', 'Leifur', 'Leiknir', 'Leo', 'Leon', 'Leonard', 'Leonhard', 'Leó', 'Leópold', 'Leví', 'Lér', 'Liljar', 'Lindar', 'Lindberg', 'Línberg', 'Líni', 'Ljósálfur', 'Ljótur', 'Ljúfur', 'Loðmundur', 'Loftur', 'Logi', 'Loki', 'Lórens', 'Lórenz', 'Ludvig', 'Lundi', 'Lúðvíg', 'Lúðvík', 'Lúkas', 'Lúter', 'Lúther', 'Lyngar', 'Lýður', 'Lýtingur', 'Maggi', 'Magngeir', 'Magni', 'Magnús', 'Magnþór', 'Makan', 'Manfred', 'Manfreð', 'Manúel', 'Mar', 'Marbjörn', 'Marel', 'Margeir', 'Margrímur', 'Mari', 'Marijón', 'Marinó', 'Marías', 'Marínó', 'Marís', 'Maríus', 'Marjón', 'Markó', 'Markús', 'Markþór', 'Maron', 'Marri', 'Mars', 'Marsellíus', 'Marteinn', 'Marten', 'Marthen', 'Martin', 'Marvin', 'Mathías', 'Matthías', 'Matti', 'Mattías', 'Max', 'Maximus', 'Máni', 'Már', 'Márus', 'Mekkinó', 'Melkíor', 'Melkólmur', 'Melrakki', 'Mensalder', 'Merkúr', 'Methúsalem', 'Metúsalem', 'Meyvant', 'Michael', 'Mikael', 'Mikjáll', 'Mikkael', 'Mikkel', 'Mildinberg', 'Mías', 'Mímir', 'Míó', 'Mír', 'Mjöllnir', 'Mjölnir', 'Moli', 'Morgan', 'Moritz', 'Mosi', 'Móði', 'Móri', 'Mórits', 'Móses', 'Muggur', 'Muni', 'Muninn', 'Múli', 'Myrkvi', 'Mýrkjartan', 'Mörður', 'Narfi', 'Natan', 'Natanael', 'Nataníel', 'Náttmörður', 'Náttúlfur', 'Neisti', 'Nenni', 'Neptúnus', 'Nicolas', 'Nikanor', 'Nikolai', 'Nikolas', 'Nikulás', 'Nils', 'Níels', 'Níls', 'Njáll', 'Njörður', 'Nonni', 'Norbert', 'Norðmann', 'Normann', 'Nóam', 'Nóel', 'Nói', 'Nóni', 'Nóri', 'Nóvember', 'Númi', 'Nývarð', 'Nökkvi', 'Oddbergur', 'Oddbjörn', 'Oddfreyr', 'Oddgeir', 'Oddi', 'Oddkell', 'Oddleifur', 'Oddmar', 'Oddsteinn', 'Oddur', 'Oddvar', 'Oddþór', 'Oktavíus', 'Októ', 'Októvíus', 'Olaf', 'Olav', 'Olgeir', 'Oliver', 'Olivert', 'Orfeus', 'Ormar', 'Ormur', 'Orri', 'Orvar', 'Otkell', 'Otri', 'Otti', 'Ottó', 'Otur', 'Óðinn', 'Ófeigur', 'Ólafur', 'Óli', 'Óliver', 'Ólíver', 'Ómar', 'Ómi', 'Óskar', 'Ósvald', 'Ósvaldur', 'Ósvífur', 'Óttar', 'Óttarr', 'Parmes', 'Patrek', 'Patrekur', 'Patrick', 'Patrik', 'Páll', 'Pálmar', 'Pálmi', 'Pedró', 'Per', 'Peter', 'Pétur', 'Pjetur', 'Príor', 'Rafael', 'Rafn', 'Rafnar', 'Rafnkell', 'Ragnar', 'Ragúel', 'Randver', 'Rannver', 'Rasmus', 'Ráðgeir', 'Ráðvarður', 'Refur', 'Reginbaldur', 'Reginn', 'Reidar', 'Reifnir', 'Reimar', 'Reinar', 'Reinhart', 'Reinhold', 'Reynald', 'Reynar', 'Reynir', 'Reyr', 'Richard', 'Rikharð', 'Rikharður', 'Ríkarður', 'Ríkharð', 'Ríkharður', 'Ríó', 'Robert', 'Rolf', 'Ronald', 'Róbert', 'Rólant', 'Róman', 'Rómeó', 'Rósant', 'Rósar', 'Rósberg', 'Rósenberg', 'Rósi', 'Rósinberg', 'Rósinkar', 'Rósinkrans', 'Rósmann', 'Rósmundur', 'Rudolf', 'Runi', 'Runólfur', 'Rúbar', 'Rúben', 'Rúdólf', 'Rúnar', 'Rúrik', 'Rútur', 'Röðull', 'Rögnvald', 'Rögnvaldur', 'Rögnvar', 'Rökkvi', 'Safír', 'Sakarías', 'Salmann', 'Salmar', 'Salómon', 'Salvar', 'Samson', 'Samúel', 'Sandel', 'Sandri', 'Sandur', 'Saxi', 'Sebastian', 'Sebastían', 'Seifur', 'Seimur', 'Sesar', 'Sesil', 'Sigbergur', 'Sigbert', 'Sigbjartur', 'Sigbjörn', 'Sigdór', 'Sigfastur', 'Sigfinnur', 'Sigfreður', 'Sigfús', 'Siggeir', 'Sighvatur', 'Sigjón', 'Siglaugur', 'Sigmann', 'Sigmar', 'Sigmundur', 'Signar', 'Sigri', 'Sigríkur', 'Sigsteinn', 'Sigtryggur', 'Sigtýr', 'Sigur', 'Sigurbaldur', 'Sigurberg', 'Sigurbergur', 'Sigurbjarni', 'Sigurbjartur', 'Sigurbjörn', 'Sigurbrandur', 'Sigurdór', 'Sigurður', 'Sigurfinnur', 'Sigurgeir', 'Sigurgestur', 'Sigurgísli', 'Sigurgrímur', 'Sigurhans', 'Sigurhjörtur', 'Sigurjón', 'Sigurkarl', 'Sigurlaugur', 'Sigurlás', 'Sigurleifur', 'Sigurliði', 'Sigurlinni', 'Sigurmann', 'Sigurmar', 'Sigurmon', 'Sigurmundur', 'Sigurnýas', 'Sigurnýjas', 'Siguroddur', 'Siguróli', 'Sigurpáll', 'Sigursteinn', 'Sigursveinn', 'Sigurvaldi', 'Sigurvin', 'Sigurþór', 'Sigvaldi', 'Sigvarður', 'Sigþór', 'Silli', 'Sindri', 'Símon', 'Sírnir', 'Sírus', 'Sívar', 'Sjafnar', 'Skafti', 'Skapti', 'Skarphéðinn', 'Skefill', 'Skeggi', 'Skíði', 'Skírnir', 'Skjöldur', 'Skorri', 'Skuggi', 'Skúli', 'Skúta', 'Skær', 'Skæringur', 'Smári', 'Smiður', 'Smyrill', 'Snjóki', 'Snjólaugur', 'Snjólfur', 'Snorri', 'Snæbjartur', 'Snæbjörn', 'Snæhólm', 'Snælaugur', 'Snær', 'Snæringur', 'Snævar', 'Snævarr', 'Snæþór', 'Soffanías', 'Sophanías', 'Sophus', 'Sófónías', 'Sófus', 'Sókrates', 'Sólberg', 'Sólbergur', 'Sólbjartur', 'Sólbjörn', 'Sólimann', 'Sólmar', 'Sólmundur', 'Sólon', 'Sólver', 'Sólvin', 'Spartakus', 'Sporði', 'Spói', 'Stanley', 'Stapi', 'Starkaður', 'Starri', 'Stefan', 'Stefán', 'Stefnir', 'Steinar', 'Steinarr', 'Steinberg', 'Steinbergur', 'Steinbjörn', 'Steindór', 'Steinfinnur', 'Steingrímur', 'Steini', 'Steinkell', 'Steinmann', 'Steinmar', 'Steinmóður', 'Steinn', 'Steinólfur', 'Steinröður', 'Steinvarður', 'Steinþór', 'Stirnir', 'Stígur', 'Stormur', 'Stórólfur', 'Sturla', 'Sturlaugur', 'Sturri', 'Styr', 'Styrbjörn', 'Styrkár', 'Styrmir', 'Styrr', 'Sumarliði', 'Svafar', 'Svali', 'Svan', 'Svanberg', 'Svanbergur', 'Svanbjörn', 'Svangeir', 'Svanhólm', 'Svani', 'Svanlaugur', 'Svanmundur', 'Svanur', 'Svanþór', 'Svavar', 'Sváfnir', 'Sveinar', 'Sveinberg', 'Sveinbjartur', 'Sveinbjörn', 'Sveinjón', 'Sveinlaugur', 'Sveinmar', 'Sveinn', 'Sveinungi', 'Sveinþór', 'Svend', 'Sverre', 'Sverrir', 'Svölnir', 'Svörfuður', 'Sýrus', 'Sæberg', 'Sæbergur', 'Sæbjörn', 'Sæi', 'Sælaugur', 'Sæmann', 'Sæmundur', 'Sær', 'Sævald', 'Sævaldur', 'Sævar', 'Sævarr', 'Sævin', 'Sæþór', 'Sölmundur', 'Sölvar', 'Sölvi', 'Sören', 'Sörli', 'Tandri', 'Tarfur', 'Teitur', 'Theodór', 'Theódór', 'Thomas', 'Thor', 'Thorberg', 'Thór', 'Tindar', 'Tindri', 'Tindur', 'Tinni', 'Tími', 'Tímon', 'Tímoteus', 'Tímóteus', 'Tístran', 'Tjaldur', 'Tjörfi', 'Tjörvi', 'Tobías', 'Tolli', 'Tonni', 'Torfi', 'Tóbías', 'Tói', 'Tóki', 'Tómas', 'Tór', 'Trausti', 'Tristan', 'Trostan', 'Trúmann', 'Tryggvi', 'Tumas', 'Tumi', 'Tyrfingur', 'Týr', 'Ubbi', 'Uggi', 'Ulrich', 'Uni', 'Unnar', 'Unnbjörn', 'Unndór', 'Unnsteinn', 'Unnþór', 'Urðar', 'Uxi', 'Úddi', 'Úlfar', 'Úlfgeir', 'Úlfhéðinn', 'Úlfkell', 'Úlfljótur', 'Úlftýr', 'Úlfur', 'Úlrik', 'Úranus', 'Vagn', 'Vakur', 'Valberg', 'Valbergur', 'Valbjörn', 'Valbrandur', 'Valdemar', 'Valdi', 'Valdimar', 'Valdór', 'Valentín', 'Valentínus', 'Valgarð', 'Valgarður', 'Valgeir', 'Valíant', 'Vallaður', 'Valmar', 'Valmundur', 'Valsteinn', 'Valter', 'Valtýr', 'Valur', 'Valves', 'Valþór', 'Varmar', 'Vatnar', 'Váli', 'Vápni', 'Veigar', 'Veigur', 'Ver', 'Vermundur', 'Vernharð', 'Vernharður', 'Vestar', 'Vestmar', 'Veturliði', 'Vébjörn', 'Végeir', 'Vékell', 'Vélaugur', 'Vémundur', 'Vésteinn', 'Victor', 'Viðar', 'Vigfús', 'Viggó', 'Vignir', 'Vigri', 'Vigtýr', 'Vigur', 'Vikar', 'Viktor', 'Vilberg', 'Vilbergur', 'Vilbert', 'Vilbjörn', 'Vilbogi', 'Vilbrandur', 'Vilgeir', 'Vilhelm', 'Vilhjálmur', 'Vili', 'Viljar', 'Vilji', 'Villi', 'Vilmar', 'Vilmundur', 'Vincent', 'Vinjar', 'Virgill', 'Víðar', 'Víðir', 'Vífill', 'Víglundur', 'Vígmar', 'Vígmundur', 'Vígsteinn', 'Vígþór', 'Víkingur', 'Vopni', 'Vorm', 'Vöggur', 'Völundur', 'Vörður', 'Vöttur', 'Walter', 'Werner', 'Wilhelm', 'Willard', 'William', 'Willum', 'Ylur', 'Ymir', 'Yngvar', 'Yngvi', 'Yrkill', 'Ýmir', 'Ýrar', 'Zakaría', 'Zakarías', 'Zophanías', 'Zophonías', 'Zóphanías', 'Zóphonías', 'Þangbrandur', 'Þengill', 'Þeyr', 'Þiðrandi', 'Þiðrik', 'Þinur', 'Þjálfi', 'Þjóðann', 'Þjóðbjörn', 'Þjóðgeir', 'Þjóðleifur', 'Þjóðmar', 'Þjóðólfur', 'Þjóðrekur', 'Þjóðvarður', 'Þjóstar', 'Þjóstólfur', 'Þorberg', 'Þorbergur', 'Þorbjörn', 'Þorbrandur', 'Þorfinnur', 'Þorgarður', 'Þorgautur', 'Þorgeir', 'Þorgestur', 'Þorgils', 'Þorgísl', 'Þorgnýr', 'Þorgrímur', 'Þorkell', 'Þorlaugur', 'Þorlákur', 'Þorleifur', 'Þorleikur', 'Þormar', 'Þormóður', 'Þormundur', 'Þorri', 'Þorsteinn', 'Þorvaldur', 'Þorvar', 'Þorvarður', 'Þór', 'Þórar', 'Þórarinn', 'Þórbergur', 'Þórbjörn', 'Þórður', 'Þórgnýr', 'Þórgrímur', 'Þórhaddur', 'Þórhalli', 'Þórhallur', 'Þórir', 'Þórlaugur', 'Þórleifur', 'Þórlindur', 'Þórmar', 'Þórmundur', 'Þóroddur', 'Þórormur', 'Þórólfur', 'Þórsteinn', 'Þórörn', 'Þrastar', 'Þráinn', 'Þrándur', 'Þróttur', 'Þrúðmar', 'Þrymur', 'Þröstur', 'Þyrnir', 'Ægir', 'Æsir', 'Ævar', 'Ævarr', 'Ögmundur', 'Ögri', 'Ölnir', 'Ölver', 'Ölvir', 'Öndólfur', 'Önundur', 'Örlaugur', 'Örlygur', 'Örn', 'Örnólfur', 'Örvar', 'Össur', 'Öxar'); + + /** + * @var string Icelandic middle names. + */ + protected static $middleName = array( + 'Aðaldal', 'Aldan', 'Arnberg', 'Arnfjörð', 'Austan', 'Austdal', 'Austfjörð', 'Áss', 'Bakkdal', 'Bakkmann', 'Bald', 'Ben', 'Bergholt', 'Bergland', 'Bíldsfells', 'Bjarg', 'Bjarndal', 'Bjarnfjörð', 'Bláfeld', 'Blómkvist', 'Borgdal', 'Brekkmann', 'Brim', 'Brúnsteð', 'Dalhoff', 'Dan', 'Diljan', 'Ektavon', 'Eldberg', 'Elísberg', 'Elvan', 'Espólín', 'Eyhlíð', 'Eyvík', 'Falk', 'Finndal', 'Fossberg', 'Freydal', 'Friðhólm', 'Giljan', 'Gilsfjörð', 'Gnarr', 'Gnurr', 'Grendal', 'Grindvík', 'Gull', 'Haffjörð', 'Hafnes', 'Hafnfjörð', 'Har', 'Heimdal', 'Heimsberg', 'Helgfell', 'Herberg', 'Hildiberg', 'Hjaltdal', 'Hlíðkvist', 'Hnappdal', 'Hnífsdal', 'Hofland', 'Hofteig', 'Hornfjörð', 'Hólmberg', 'Hrafnan', 'Hrafndal', 'Hraunberg', 'Hreinberg', 'Hreindal', 'Hrútfjörð', 'Hvammdal', 'Hvítfeld', 'Höfðdal', 'Hörðdal', 'Íshólm', 'Júl', 'Kjarrval', 'Knaran', 'Knarran', 'Krossdal', 'Laufkvist', 'Laufland', 'Laugdal', 'Laxfoss', 'Liljan', 'Linddal', 'Línberg', 'Ljós', 'Loðmfjörð', 'Lyngberg', 'Magdal', 'Magg', 'Matt', 'Miðdal', 'Miðvík', 'Mjófjörð', 'Móberg', 'Mýrmann', 'Nesmann', 'Norðland', 'Núpdal', 'Ólfjörð', 'Ósland', 'Ósmann', 'Reginbald', 'Reykfell', 'Reykfjörð', 'Reynholt', 'Salberg', 'Sandhólm', 'Seljan', 'Sigurhólm', 'Skagalín', 'Skíðdal', 'Snæberg', 'Snædahl', 'Sólan', 'Stardal', 'Stein', 'Steinbekk', 'Steinberg', 'Storm', 'Straumberg', 'Svanhild', 'Svarfdal', 'Sædal', 'Val', 'Valagils', 'Vald', 'Varmdal', 'Vatnsfjörð', 'Vattar', 'Vattnes', 'Viðfjörð', 'Vídalín', 'Víking', 'Vopnfjörð', 'Yngling', 'Þor', 'Önfjörð', 'Örbekk', 'Öxdal', 'Öxndal' + ); + + /** + * Randomly return a icelandic middle name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Generate prepared last name for further processing + * + * @return string + */ + public function lastName() + { + $name = static::firstNameMale(); + + if (substr($name, -2) === 'ur') { + $name = substr($name, 0, strlen($name) - 2); + } + + if (substr($name, -1) !== 's') { + $name .= 's'; + } + + return $name; + } + + /** + * Randomly return a icelandic last name for woman. + * + * @return string + */ + public function lastNameMale() + { + return $this->lastName().'son'; + } + + /** + * Randomly return a icelandic last name for man. + * + * @return string + */ + public function lastNameFemale() + { + return $this->lastName().'dóttir'; + } + + /** + * Randomly return a icelandic Kennitala (Social Security number) format. + * + * @link http://en.wikipedia.org/wiki/Kennitala + * + * @return string + */ + public static function ssn() + { + // random birth date + $birthdate = new \DateTime('@' . mt_rand(0, time())); + + // last four buffer + $lastFour = null; + + // security variable reference + $ref = '32765432'; + + // valid flag + $valid = false; + + while (! $valid) { + // make two random numbers + $rand = static::randomDigit().static::randomDigit(); + + // 8 char string with birth date and two random numbers + $tmp = $birthdate->format('dmy').$rand; + + // loop through temp string + for ($i = 7, $sum = 0; $i >= 0; $i--) { + // calculate security variable + $sum += ($tmp[$i] * $ref[$i]); + } + + // subtract 11 if not 11 + $chk = ($sum % 11 === 0) ? 0 : (11 - ($sum % 11)); + + if ($chk < 10) { + $lastFour = $rand.$chk.substr($birthdate->format('Y'), 1, 1); + + $valid = true; + } + } + + return sprintf('%s-%s', $birthdate->format('dmy'), $lastFour); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php new file mode 100644 index 0000000..de91f74 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php @@ -0,0 +1,20 @@ + + */ +class PhoneNumber extends \Faker\Provider\PhoneNumber +{ + /** + * @var array Icelandic phone number formats. + */ + protected static $formats = array( + '+354 ### ####', + '+354 #######', + '+354#######', + '### ####', + '#######', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php new file mode 100644 index 0000000..1eee3b6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php @@ -0,0 +1,139 @@ + 'Argovia'), + array('AI' => 'Appenzello Interno'), + array('AR' => 'Appenzello Esterno'), + array('BE' => 'Berna'), + array('BL' => 'Basilea Campagna'), + array('BS' => 'Basilea Città'), + array('FR' => 'Friburgo'), + array('GE' => 'Ginevra'), + array('GL' => 'Glarona'), + array('GR' => 'Grigioni'), + array('JU' => 'Giura'), + array('LU' => 'Lucerna'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidvaldo'), + array('OW' => 'Obvaldo'), + array('SG' => 'San Gallo'), + array('SH' => 'Sciaffusa'), + array('SO' => 'Soletta'), + array('SZ' => 'Svitto'), + array('TG' => 'Turgovia'), + array('TI' => 'Ticino'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Vallese'), + array('ZG' => 'Zugo'), + array('ZH' => 'Zurigo') + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetSuffix}} {{firstName}}', + '{{streetSuffix}} {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Via + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php new file mode 100644 index 0000000..9a42b1c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php new file mode 100644 index 0000000..937f375 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php @@ -0,0 +1,17 @@ +generator->parse($format)); + } + + /** + * @example 'yamada.jp' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php new file mode 100644 index 0000000..0db2db0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php @@ -0,0 +1,141 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @return string + * @example 'アキラ' + */ + public function firstKanaName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstKanaNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::firstKanaNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstKanaNameFormat)); + } + + /** + * @example 'アキラ' + */ + public static function firstKanaNameMale() + { + return static::randomElement(static::$firstKanaNameMale); + } + + /** + * @example 'アケミ' + */ + public static function firstKanaNameFemale() + { + return static::randomElement(static::$firstKanaNameFemale); + } + + /** + * @example 'アオタ' + */ + public static function lastKanaName() + { + return static::randomElement(static::$lastKanaName); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php new file mode 100644 index 0000000..9f03c56 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php new file mode 100644 index 0000000..1a1a4dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php @@ -0,0 +1,42 @@ + 'კვირა', + 'Monday' => 'ორშაბათი', + 'Tuesday' => 'სამშაბათი', + 'Wednesday' => 'ოთხშაბათი', + 'Thursday' => 'ხუთშაბათი', + 'Friday' => 'პარასკევი', + 'Saturday' => 'შაბათი', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => 'იანვარი', + 'February' => 'თებერვალი', + 'March' => 'მარტი', + 'April' => 'აპრილი', + 'May' => 'მაისი', + 'June' => 'ივნისი', + 'July' => 'ივლისი', + 'August' => 'აგვისტო', + 'September' => 'სექტემბერი', + 'October' => 'ოქტომბერი', + 'November' => 'ნოემბერი', + 'December' => 'დეკემბერი', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php new file mode 100644 index 0000000..01b15c7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php @@ -0,0 +1,15 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * National Business Identification Numbers + * + * @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en + * @param \DateTime $registrationDate + * @return string 12 digits, like 150140000019 + */ + public static function businessIdentificationNumber(\DateTime $registrationDate = null) + { + if (!$registrationDate) { + $registrationDate = \Faker\Provider\DateTime::dateTimeThisYear(); + } + + $dateAsString = $registrationDate->format('ym'); + $legalEntityType = (string) static::numberBetween(4, 6); + $legalEntityAdditionalType = (string) static::numberBetween(0, 3); + $randomDigits = (string) static::numerify('######'); + + return $dateAsString . $legalEntityType . $legalEntityAdditionalType . $randomDigits; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php new file mode 100644 index 0000000..75999c2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php @@ -0,0 +1,9 @@ + array( + self::CENTURY_19TH => self::MALE_CENTURY_19TH, + self::CENTURY_20TH => self::MALE_CENTURY_20TH, + self::CENTURY_21ST => self::MALE_CENTURY_21ST, + ), + self::GENDER_FEMALE => array( + self::CENTURY_19TH => self::FEMALE_CENTURY_19TH, + self::CENTURY_20TH => self::FEMALE_CENTURY_20TH, + self::CENTURY_21ST => self::FEMALE_CENTURY_21ST, + ), + ); + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $maleNameFormats = array( + '{{lastName}}ұлы {{firstNameMale}}', + ); + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $femaleNameFormats = array( + '{{lastName}}қызы {{firstNameFemale}}', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameMale = array( + 'Аылғазы', + 'Әбдіқадыр', + 'Бабағожа', + 'Ғайса', + 'Дәмен', + 'Егізбек', + 'Жазылбек', + 'Зұлпықар', + 'Игісін', + 'Кәдіржан', + 'Қадырқан', + 'Латиф', + 'Мағаз', + 'Нармағамбет', + 'Оңалбай', + 'Өндіріс', + 'Пердебек', + 'Рақат', + 'Сағындық', + 'Танабай', + 'Уайыс', + 'Ұйықбай', + 'Үрімбай', + 'Файзрахман', + 'Хангелді', + 'Шаттық', + 'Ыстамбақы', + 'Ібни', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameFemale = array( + 'Асылтас', + 'Әужа', + 'Бүлдіршін', + 'Гүлшаш', + 'Ғафура', + 'Ділдә', + 'Еркежан', + 'Жібек', + 'Зылиқа', + 'Ирада', + 'Күнсұлу', + 'Қырмызы', + 'Ләтипа', + 'Мүштәри', + 'Нұршара', + 'Орынша', + 'Өрзия', + 'Перизат', + 'Рухия', + 'Сындыбала', + 'Тұрсынай', + 'Уәсима', + 'Ұрқия', + 'Үрия', + 'Фируза', + 'Хафиза', + 'Шырынгүл', + 'Ырысты', + 'Іңкәр', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $lastName = array( + 'Адырбай', + 'Әжібай', + 'Байбөрі', + 'Ғизат', + 'Ділдабек', + 'Ешмұхамбет', + 'Жігер', + 'Зікірия', + 'Иса', + 'Кунту', + 'Қыдыр', + 'Лұқпан', + 'Мышырбай', + 'Нысынбай', + 'Ошақбай', + 'Өтетілеу', + 'Пірәлі', + 'Рүстем', + 'Сырмұхамбет', + 'Тілеміс', + 'Уәлі', + 'Ұлықбек', + 'Үстем', + 'Фахир', + 'Хұсайын', + 'Шілдебай', + 'Ыстамбақы', + 'Ісмет', + ); + + /** + * @param integer $year + * + * @return integer|null + */ + private static function getCenturyByYear($year) + { + if ($year >= 2000 && $year <= DateTime::year()) { + return self::CENTURY_21ST; + } elseif ($year >= 1900) { + return self::CENTURY_20TH; + } elseif ($year >= 1800) { + return self::CENTURY_19TH; + } + } + + /** + * National Individual Identification Numbers + * + * @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en + * @link https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80 + * + * @param \DateTime $birthDate + * @param integer $gender + * + * @return string 12 digits, like 780322300455 + */ + public static function individualIdentificationNumber(\DateTime $birthDate = null, $gender = self::GENDER_MALE) + { + if (!$birthDate) { + $birthDate = DateTime::dateTimeBetween(); + } + + do { + $population = mt_rand(1000, 2000); + $century = self::getCenturyByYear((int) $birthDate->format('Y')); + + $iin = $birthDate->format('ymd'); + $iin .= (string) self::$genderCenturyMap[$gender][$century]; + $iin .= (string) $population; + $checksum = self::checkSum($iin); + } while ($checksum === 10); + + return $iin . (string) $checksum; + } + + /** + * @param string $iinValue + * + * @return integer + */ + public static function checkSum($iinValue) + { + $controlDigit = self::getControlDigit($iinValue, self::$firstSequenceBitWeights); + + if ($controlDigit === 10) { + return self::getControlDigit($iinValue, self::$secondSequenceBitWeights); + } + + return $controlDigit; + } + + /** + * @param string $iinValue + * @param array $sequence + * + * @return integer + */ + protected static function getControlDigit($iinValue, $sequence) + { + $sum = 0; + + for ($i = 0; $i <= 10; $i++) { + $sum += (int) $iinValue[$i] * $sequence[$i]; + } + + return $sum % 11; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php new file mode 100644 index 0000000..edb38dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php @@ -0,0 +1,16 @@ +generator->parse($format)); + } + + /** + * @example 'kim.kr' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php new file mode 100644 index 0000000..92d858f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php @@ -0,0 +1,55 @@ +generator->parse($format)); + } + + + + public function cellPhoneNumber() + { + $format = self::randomElement(array_slice(static::$formats, 6, 1)); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php new file mode 100644 index 0000000..5f5148e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php @@ -0,0 +1,1723 @@ +에 나오는 요귀의 불빛 모양으로 푸르무레 하게 허공을 비추오. 동경의 불바다는 내 마음을 더욱 음침하게 하였소. +이 때에 뒤에서, +"모시모시(여보세요)." +하는 소리가 들렸소. 그것은 흰 저고리를 입은 호텔 보이였소. +"왜?" +하고 나는 고개만 돌렸소. +"손님이 오셨습니다." +"손님?" +하고 나는 보이에게로 한 걸음 가까이 갔소. 나를 찾을 손님이 어디 있나 하고 나는 놀란 것이오. +"따님께서 오셨습니다. 방으로 모셨습니다." +하고 보이는 들어가 버리고 말았소. +"따님?" +하고 나는 더욱 놀랐소. 순임이가 서울서 나를 따라왔나? 그것은 안 될 말이오. 순임이가 내 뒤를 따라 떠났더라도 아무리 빨리 와도 내일이 아니면 못 왔을 것이오. 그러면 누군가. 정임인가. 정임이가 병원에서 뛰어온 것인가. +나는 두근거리는 가슴을 억지로 진정하면서 내 방문을 열었소. +그것은 정임이었소. 정임은 내가 쓰다가 둔 편지를 보고 있다가 벌떡 일어나 내게 달려들어 안겨 버렸소. 나는 얼빠진 듯이 정임이가 하라는 대로 내버려두었소. 그 편지는 부치려고 쓴 것도 아닌데 그 편지를 정임이가 본 것이 안되었다고 생각하였소. +형! 나를 책망하시오. 심히 부끄러운 말이지마는 나는 정임을 힘껏 껴안아 주고 싶었소. 나는 몇 번이나 정임의 등을 굽어 보면서 내 팔에 힘을 넣으려고 하였소. 정임은 심히 귀여웠소. 정임이가 그처럼 나를 사모하는 것이 심히 기뻤소. 나는 감정이 재우쳐서 눈이 안 보이고 정신이 몽롱하여짐을 깨달았소. 나는 아프고 쓰린 듯한 기쁨을 깨달았소. 영어로 엑스터시라든지, 한문으로 무아의 경지란 이런 것이 아닌가 하였소. 나는 사십 평생에 이러한 경험을 처음 한 것이오. +형! 형이 아시다시피 나는 내 아내 이외에 젊은 여성에게 이렇게 안겨 본 일이 없소. 물론 안아 본 일도 없소. +그러나 형! 나는 나를 눌렀소. 내 타오르는 애욕을 차디찬 이지의 입김으로 불어서 끄려고 애를 썼소. +"글쎄 웬일이냐. 앓는 것이 이 밤중에 비를 맞고 왜 나온단 말이냐. 철없는 것 같으니." +하고 나는 아버지의 위엄으로 정임의 두 어깨를 붙들어 암체어에 앉혔소. 그리고 나도 테이블을 하나 세워 두고 맞은편에 앉았소. +정임은 부끄러운 듯이 두 손으로 낯을 가리우고 제 무릎에 엎드려 울기를 시작하오. +정임은 누런 갈색의 외투를 입었소. 무엇을 타고 왔는지 모르지마는 구두에는 꽤 많이 물이 묻고 모자에는 빗방울 얼룩이 보이오. +"네가 이러다가 다시 병이 더치면 어찌한단 말이냐. 아이가 왜 그렇게 철이 없니?" +하고 나는 더욱 냉정한 어조로 책망하고 데스크 위에 놓인 내 편지 초를 집어 박박 찢어 버렸소. 종이 찢는 소리에 정임은 잠깐 고개를 들어서 처음에는 내 손을 보고 다음에는 내 얼굴을 보았소. 그러나 나는 모르는 체하고 도로 교의에 돌아와 앉아서 가만히 눈을 감았소. 그리고 도무지 흥분되지 아니한 모양을 꾸몄소. +형! 어떻게나 힘드는 일이오? 참으면 참을수록 내 이빨이 마주 부딪고, 얼굴의 근육은 씰룩거리고 손은 불끈불끈 쥐어지오. +"정말 내일 가세요?" +하고 아마 오 분 동안이나 침묵을 지키다가 정임이가 고개를 들고 물었소. +"그럼, 가야지." +하고 나는 빙그레 웃어 보였소. +"저도 데리고 가세요!" +하는 정임의 말은 마치 서릿발이 날리는 칼날과 같았소. 나는 깜짝 놀라서 정임을 바라보았소. 그의 눈은 빛나고 입은 꼭 다물고 얼굴의 근육은 팽팽하게 켕겼소. 정임의 얼굴에는 찬바람이 도는 무서운 기운이 있었소. +나는 즉각적으로 죽기를 결심한 여자의 모양이라고 생각하였소. 열정으로 불덩어리가 되었던 정임은 내가 보이는 냉랭한 태도로 말미암아 갑자기 얼어 버린 것 같았소. +"어디를?" +하고 나는 정임의 `저도 데리고 가세요.' 하는 담대한 말에 놀라면서 물었소. +"어디든지, 아버지 가시는 데면 어디든지 저를 데리고 가세요. 저는 아버지를 떠나서는 혼자서는 못 살 것을 지나간 반 달 동안에 잘 알았습니다. 아까 아버지 오셨다 가신 뒤에 생각해 보니깐 암만해도 아버지는 다시 저에게 와 보시지 아니하고 가실 것만 같애요. 그리고 저로 해서 아버지께서는 무슨 큰 타격을 당하신 것만 같으셔요. 처음 뵈올 적에 벌써 가슴이 뜨끔했습니다. 그리고 여행을 떠나신다는 말씀을 듣고는 반드시 무슨 큰일이 나셨느니라고만 생각했습니다. 그리고 저어, 저로 해서 그러신 것만 같고, 저를 버리시고 혼자 가시려는 것만 같고, 그래서 달려왔더니 여기 써 놓으신 편지를 보고 그 편지에 다른 말씀은 어찌 됐든지, 네 일기를 보았다 하신 말씀을 보고는 다 알았습니다. 저와 한 방에 있는 애가 암만해도 어머니 스파인가봐요. 제가 입원하기 전에도 제 눈치를 슬슬 보고 또 책상 서랍도 뒤지는 눈치가 보이길래 일기책은 늘 쇠 잠그는 서랍에 넣어 두었는데 아마 제가 정신 없이 앓고 누웠는 동안에 제 핸드백에서 쇳대를 훔쳐 갔던가봐요. 그래서는 그 일기책을 꺼내서 서울로 보냈나봐요. 그걸루 해서 아버지께서는 불명예스러운 누명을 쓰시고 학교일도 내놓으시게 되고 집도 떠나시게 되셨나봐요. 다시는 집에 안 돌아오실 양으로 결심을 하셨나봐요. 아까 병원에서도 하시는 말씀이 모두 유언하시는 것만 같아서 퍽 의심을 가졌었는데 지금 그 쓰시던 편지를 보고는 다 알았습니다. 그렇지만 그렇지만." +하고 웅변으로 내려 말하던 정임은 갑자기 복받치는 열정을 이기지 못하는 듯이, 한 번 한숨을 지우고, +"그렇지만 저는 아버지를 따라가요. 절루 해서 아버지께서는 집도 잃으시고 명예도 잃으시고 사업도 잃으시고 인생의 모든 것을 다 잃으셨으니 저는 아버지를 따라가요. 어디를 가시든지 저는 어린 딸로 아버지를 따라다니다가 아버지께서 먼저 돌아가시면 저도 따라 죽어서 아버지 발 밑에 묻힐 테야요. 제가 먼저 죽거든 제가 병이 있으니깐 물론 제가 먼저 죽지요. 죽어도 좋습니다. 병원에서 앓다가 혼자 죽는 건 싫어요. 아버지 곁에서 죽으면 아버지께서, 오 내 딸 정임아 하시고 귀해 주시고 불쌍히 여겨 주시겠지요. 그리고 제 몸을 어디든지 땅에 묻으시고 `사랑하는 내 딸 정임의 무덤'이라고 패라도 손수 쓰셔서 세워 주시지 않겠습니까." +하고 정임은 비쭉비쭉하다가 그만 무릎 위에 엎더져 울고 마오. +나는 다만 죽은 사람 모양으로 반쯤 눈을 감고 앉아 있었소. 가슴 속에는 정임의 곁에서 지지 않는 열정을 품으면서도 정임의 말대로 정임을 데리고 아무도 모르는 곳으로 가 버리고 싶으면서도 나는 이 열정의 불길을 내 입김으로 꺼 버리지 아니하면 아니 되는 것이었소. +"아아, 제가 왜 났어요? 왜 하나님께서 저를 세상에 보내셨어요? 아버지의 일생을 파멸시키려 난 것이지요? 제가 지금 죽어 버려서 아버지의 명예를 회복할 수 있다면 저는 죽어 버릴 터이야요. 기쁘게 죽어 버리겠습니다. 제가 여덟 살부터 오늘날까지 받은 은혜를 제 목숨 하나로 갚을 수가 있다면 저는 지금으로 죽어 버리겠습니다. 그렇지만 그렇지만……. +그렇지만 그렇지만 저는 다만 얼마라도 다만 하루라도 아버지 곁에서 살고 싶어요 다만 하루만이라도, 아버지! 제가 왜 이렇습니까, 네? 제가 어려서 이렇습니까. 미친 년이 되어서 이렇습니까. 아버지께서는 아실 테니 말씀해 주세요. 하루만이라도 아버지를 모시고 아버지 곁에서 살았으면 죽어도 한이 없겠습니다. 제 생각이 잘못이야요? 제 생각이 죄야요? 왜 죄입니까? 아버지, 저를 버리시고 혼자 가시지 마세요, 네? `정임아, 너를 데리고 가마.' 하고 약속해 주세요, 네." +정임은 아주 담대하게 제가 하고자 하는 말을 다 하오. 그 얌전한, 수삽한정임의 속에 어디 그러한 용기가 있었던가, 참 이상한 일이오. 나는 귀여운 어린 계집애 정임의 속에 엉큼한 여자가 들어앉은 것을 발견하였소. 그가 몇 가지 재료(내가 여행을 떠난다는 것과 제 일기를 보았다는 것)를 종합하여 나와 저와의 새에, 또 그 때문에 어떠한 일이 일어난 것을 추측하는 그 상상력도 놀랍거니와 그렇게 내 앞에서는 별로 입도 벌리지 아니하던 그가 이처럼 담대하게 제 속에 있는 말을 거리낌없이 다 해 버리는 용기를 아니 놀랄 수 없었소. 내가, 사내요 어른인 내가 도리어 정임에게 리드를 받고 놀림을 받음을 깨달았소. +그러나 정임을 위해서든지, 중년 남자의 위신을 위해서든지 나는 의지력으로, 도덕력으로, 정임을 누르고 훈계하지 아니하면 아니 되겠다고 생각하였소. +"정임아." +하고 나는 비로소 입을 열어서 불렀소. 내 어성은 장중하였소. 나는 할 수 있는 위엄을 다하여 `정임아.' 하고 부른 것이오. +"정임아, 네 속은 다 알았다. 네 마음 네 뜻은 그만하면 다 알았다. 네가 나를 그처럼 생각해 주는 것을 고맙게 생각한다. 기쁘게도 생각한다. 그러나 정임아." +하고 나는 일층 태도와 소리를 엄숙하게 하여, +"네가 청하는 말은 절대로 들을 수 없는 말이다. 내가 너를 친딸같이 사랑하기 때문에 나는 너를 데리고 가지 못하는 것이다. 나는 세상에서 죽고 조선에서 죽더라도 너는 죽어서 아니 된다. 차마 너까지는 죽이고 싶지 아니하단 말이다. 내가 어디 가서 없어져 버리면 세상은 네게 씌운 누명이 애매한 줄을 알게 될 것이 아니냐. 그리되면 너는 조선의 좋은 일꾼이 되어서 일도 많이 하고 또 사랑하는 남편을 맞아서 행복된 생활도 할 수 있을 것이 아니냐. 그것이 내가 네게 바라는 것이다. 내가 어디 가 있든지, 내가 살아 있는 동안 나는 네가 잘되는 것만, 행복되게 사는 것만 바라보고 혼자 기뻐할 것이 아니냐. +네가 다 옳게 알았다. 나는 네 말대로 조선을 영원히 떠나기로 하였다. 그렇지마는 나는 이렇게 된 것을 조금도 슬퍼하지 아니한다. 너를 위해서 내가 무슨 희생을 한다고 하면 내게는 그것이 큰 기쁨이다. 그뿐 아니라, 나는 인제는 세상이 싫어졌다. 더 살기가 싫어졌다. 내가 십여 년 동안 전생명을 바쳐서 교육한 학생들에게까지 배척을 받을 때에는 나는 지금까지 살아온 것을 생각만 하여도 진저리가 난다. 그렇지마는 나는 이것이 다 내가 부족한 때문인 줄을 잘 안다. 나는 조선을 원망한다든가, 내 동포를 원망한다든가, 그럴 생각은 없다. 원망을 한다면 나 자신의 부족을 원망할 뿐이다. 내가 원체 교육을 한다든지 남의 지도자가 된다든지 할 자격이 없음을 원망한다면 원망할까, 내가 어떻게 조선이나 조선 사람을 원망하느냐. 그러니까 인제 내게 남은 일은 나를 조선에서 없애 버리는 것이다. 감히 십여 년 간 교육가라고 자처해 오던 거짓되고 외람된 생활을 끊어 버리는 것이다. 남편 노릇도 못 하고 아버지 노릇도 못 하는 사람이 남의 스승은 어떻게 되고 지도자는 어떻게 되느냐. 하니까 나는 이제 세상을 떠나 버리는 것이 조금도 슬프지 아니하고 도리어 몸이 가뜬하고 유쾌해지는 것 같다. +오직 하나 마음에 걸리는 것은 내 선배요 사랑하는 동지이던 남 선생의 유일한 혈육이던 네게다가 누명을 씌우고 가는 것이다." +"그게 어디 아버지 잘못입니까?" +하고 정임은 입술을 깨물었소. +"모두 제가 철이 없어서 저 때문에……." +하고 정임은 몸을 떨고 울었소. +"아니! 그렇게 생각하지 마라. 내가 지금 세상을 버릴 때에 무슨 기쁨이 한 가지 남는 것이 있다고 하면 너 하나가, 이 세상에서 오직 너 하나가 나를 따라 주는 것이다. 아마 너도 나를 잘못 알고 따라 주는 것이겠지마는 세상이 다 나를 버리고, 처자까지도 다 나를 버릴 때에 오직 너 하나가 나를 소중히 알아 주니 어찌 고맙지 않겠느냐. 그러니까 정임아 너는 몸을 조심하여서 건강을 회복하여서 오래 잘 살고, 그리고 나를 생각해 다오." +하고 나도 울었소. +형! 내가 정임에게 이런 말을 한 것이 잘못이지요. 그러나 나는 그 때에 이런 말을 아니 할 수 없었소. 왜 그런고 하니, 그것이 내 진정이니까. 나도 학교 선생으로, 교장으로, 또 주제넘게 지사로의 일생을 보내노라고 마치 오직 얼음 같은 의지력만 가진 사람 모양으로 사십 평생을 살아 왔지마는 내 속에도 열정은 있었던 것이오. 다만 그 열정을 누르고 죽이고 있었을 뿐이오. 물론 나는 아마 일생에 이 열정의 고삐를 놓아 줄 날이 없겠지요. 만일 내가 이 열정의 고삐를 놓아서 자유로 달리게 한다고 하면 나는 이 경우에 정임을 안고, 내 열정으로 정임을 태워 버렸을는지도 모르오. 그러나 나는 정임이가 열정으로 탈수록 나는 내 열정의 고삐를 두 손으로 꽉 붙들고 이를 악물고 매달릴 결심을 한 것이오. +열한 시! +"정임아. 인제 병원으로 가거라." +하고 나는 엄연하게 명령하였소. +"내일 저를 보시고 떠나시지요?" +하고 정임은 눈물을 씻고 물었소. +"그럼, J조교수도 만나고 너도 보고 떠나지." +하고 나는 거짓말을 하였소. 이 경우에 내가 거짓말쟁이라는 큰 죄인이 되는 것이 정임에게 대하여 정임을 위하여 가장 옳은 일이라고 생각한 까닭이오. +정임은, 무서운 직각력과 상상력을 가진 정임은 내 말의 진실성을 의심하는 듯이 나를 뚫어지게 바라보았소. 나는 차마 정임의 시선을 마주 보지 못하여 외면하여 버렸소. +정임은 수건으로 눈물을 씻고 체경 앞에 가서 화장을 고치고 그리고, +"저는 가요." +하고 내 앞에 허리를 굽혀서 작별 인사를 하였소. +"오, 가 자거라." +하고 나는 극히 범연하게 대답하였소. 나는 자리옷을 입었기 때문에 현관까지 작별할 수도 없어서 보이를 불러 자동차를 하나 준비하라고 명하고 내 방에서 작별할 생각을 하였소. +"내일 병원에 오세요?" +하고 정임은 고개를 숙이고 낙루하였소. +"오, 가마." +하고 나는 또 거짓말을 하였소. 세상을 버리기로 결심한 사람의 거짓말은 하나님께서도 용서하시겠지요. 설사 내가 거짓말을 한 죄로 지옥에 간다 하더라도 이 경우에 정임을 위하여 거짓말을 아니 할 수가 없지 않소? 내가 거짓말을 아니 하면 정임은 아니 갈 것이 분명하였소. +"전 가요." +하고 정임은 또 한 번 절을 하였으나 소리를 내어서 울었소. +"울지 마라! 몸 상한다." +하고 나는 정임에게 대한 최후의 친절을 정임의 곁에 한 걸음 가까이 가서 어깨를 또닥또닥하여 주고, 외투를 입혀 주었소. +"안녕히 주무세요." +하고 정임은 문을 열고 나가 버렸소. +정임의 걸어가는 소리가 차차 멀어졌소. +나는 얼빠진 사람 모양으로 그 자리에 우두커니 서 있었소. +창에 부딪히는 빗발 소리가 들리고 자동차 소리가 먼 나라에서 오는 것같이 들리오. 이것이 정임이가 타고 가는 자동차 소리인가. 나는 정임을 따라가서 붙들어 오고 싶었소. 내 몸과 마음은 정임을 따라서 허공에 떠가는 것 같았소. +아아 이렇게 나는 정임을 곁에 두고 싶을까. 이렇게 내가 정임의 곁에 있고 싶을까. 그러하건마는 나는 정임을 떼어 버리고 가지 아니하면 아니 된다! 그것은 애끓는 일이다. 기막히는 일이다! 그러나 내 도덕적 책임은 엄정하게 그렇게 명령하지 않느냐. 나는 이 도덕적 책임의 명령 그것은 더위가 없는 명령이다 을 털끝만치라도 휘어서는 아니 된다. +그러나 정임이가 호텔 현관까지 자동차를 타기 전에 한 번만 더 바라보는 것도 못 할 일일까. 한 번만, 잠깐만 더 바라보는 것도 못 할 일일까. 잠깐만 일 분만 아니 일 초만 한 시그마라는 극히 짧은 동안만 바라보는 것도 못 할 일일까. 아니, 정임을 한 시그마 동안만 더 보고 싶다 나는 이렇게 생각하고 벌떡 일어나서 도어의 핸들에 손을 대었소. +`안 된다! 옳잖다!' +하고 나는 내 소파에 돌아와서 털썩 몸을 던졌소. +`최후의 순간이 아니냐. 최후의 순간에 용감히 이겨야 할 것이 아니냐. 아서라! 아서라!' +하고 나는 혼자 주먹을 불끈불끈 쥐었소. +이 때에 짜박짜박 하고 걸어오는 소리가 들리오. 내 가슴은 쌍방망이로 두들기는 것같이 뛰었소. +`설마 정임일까.' +하면서도 나는 숨을 죽이고 귀를 기울였소. +그 발자국 소리는 분명 내 문 밖에 와서 그쳤소. 그리고는 소리가 없었소. +`내 귀의 환각인가.' +하고 나는 한숨을 내쉬었소. +그러나 다음 순간 또 두어 번 문을 두드리는 소리가 들렸소. +"이에스." +하고 나는 대답하고 문을 바라보았소. +문이 열렸소. +들어오는 이는 정임이었소. +"웬일이냐." +하고 나는 엄숙한 태도를 지었소. 그것으로 일 초의 일천분지 일이라도 다시 한 번 보고 싶던 정임을 보고 기쁨을 카무플라주한 것이오. +정임은 서슴지 않고 내 뒤에 와서 내 교의에 몸을 기대며, +"암만해도 오늘이 마지막인 것만 같아서, 다시 뵈올 기약은 없는 것만 같아서 가다가 도로 왔습니다. 한 번만 더 뵙고 갈 양으로요. 그래 도로 와서도 들어올까 말까 하고 주저주저하다가 이것이 마지막인데 하고 용기를 내어서 들어왔습니다. 내일 저를 보시고 가신다는 것이 부러 하신 말씀만 같고, 마지막 뵈옵고, 뵈온대도 그래도 한 번 더 뵈옵기만 해도……." +하고 정임의 말은 끝을 아물지 못하였소. 그는 내 등 뒤에 서 있기 때문에 그가 어떠한 표정을 하고 있는지는 볼 수가 없었소. 나는 다만 아버지의 위엄으로 정면을 바라보고 있었을 뿐이오. +`정임아, 나도 네가 보고 싶었다. 네 뒤를 따라가고 싶었다. 내 몸과 마음은 네 뒤를 따라서 허공으로 날았다. 나는 너를 한 초라도 한 초의 천분지 일 동안이라도 한 번 더 보고 싶었다. 정임아, 내 진정은 너를 언제든지 내 곁에 두고 싶다. 정임아, 지금 내 생명이 가진 것은 오직 너뿐이다.' +이런 말이라도 하고 싶었소. 그러나 이런 말을 하여서는 아니 되오! 만일 내가 이런 말을 하여 준다면 정임이가 기뻐하겠지요. 그러나 나는 정임이에게 이런 기쁨을 주어서는 아니 되오! +나는 어디까지든지 아버지의 위엄, 아버지의 냉정함을 아니 지켜서는 아니 되오. +그렇지마는 내 가슴에 타오르는 이름지을 수 없는 열정의 불길은 내 이성과 의지력을 태워 버리려 하오. 나는 눈이 아뜩아뜩함을 깨닫소. 나는 내 생명의 불길이 깜박깜박함을 깨닫소. +그렇지마는! 아아 그렇지마는 나는 이 도덕적 책임의 무상 명령의 발령자인 쓴 잔을 마시지 아니하여서는 아니 되는 것이오. +`산! 바위!' +나는 정신을 가다듬어서 이것을 염하였소. +그러나 열정의 파도가 치는 곳에 산은 움직이지 아니하오? 바위는 흔들리지 아니하오? 태산과 반석이 그 흰 불길에 타서 재가 되지는 아니하오? 인생의 모든 힘 가운데 열정보다 더 폭력적인 것이 어디 있소? 아마도 우주의 모든 힘 가운데 사람의 열정과 같이 폭력적, 불가항력적인 것은 없으리라. 뇌성, 벽력, 글쎄 그것에나 비길까. 차라리 천체와 천체가 수학적으로 계산할 수 없는 비상한 속력을 가지고 마주 달려들어서 우리의 귀로 들을 수 없는 큰 소리와 우리가 굳다고 일컫는 금강석이라도 증기를 만들고야 말 만한 열을 발하는 충돌의 순간에나 비길까. 형. 사람이라는 존재가 우주의 모든 존재 중에 가장 비상한 존재인 것 모양으로 사람의 열정의 힘은 우주의 모든 신비한 힘 가운데 가장 신비한 힘이 아니겠소? 대체 우주의 모든 힘은 그것이 아무리 큰 힘이라고 하더라도 저 자신을 깨뜨리는 것은 없소. 그렇지마는 사람이라는 존재의 열정은 능히 제 생명을 깨뜨려 가루를 만들고 제 생명을 살라서 소지를 올리지 아니하오? 여보, 대체 이에서 더 폭력이요, 신비적인 것이 어디 있단 말이오. +이 때 내 상태, 어깨 뒤에서 열정으로 타고 섰는 정임을 느끼는 내 상태는 바야흐로 대폭발, 대충돌을 기다리는 아슬아슬한 때가 아니었소. 만일 조금만이라도 내가 내 열정의 고삐에 늦춤을 준다고 하면 무서운 대폭발이 일어났을 것이오. +"정임아!" +하고 나는 충분히 마음을 진정해 가지고 고개를 옆으로 돌려 정임의 얼굴을 찾았소. +"네에." +하고 정임은 입을 약간 내 귀 가까이로 가져와서 그 씨근거리는 소리가 분명히 내 귀에 들리고 그 후끈후끈하는 뜨거운 입김이 내 목과 뺨에 감각되었소. +억지로 진정하였던 내 가슴은 다시 설레기를 시작하였소. 그 불규칙한 숨소리와 뜨거운 입김 때문이었을까. +"시간 늦는다. 어서 가거라. 이 아버지는 언제까지든지 너를 사랑하는 딸 로 소중히 소중히 가슴에 품고 있으마. 또 후일에 다시 만날 때도 있을지 아느냐. 설사 다시 만날 때가 없다기로니 그것이 무엇이 그리 대수냐. 나이 많은 사람은 먼저 죽고 젊은 사람은 오래 살아서 인생의 일을 많이 하는 것이 순서가 아니냐. 너는 몸이 아직 약하니 마음을 잘 안정해서 어서 건강을 회복하여라. 그리고 굳세게 굳세게, 힘있게 힘있게 살아 다오. 조선은 사람을 구한다. 나 같은 사람은 인제 조선서 더 일할 자격을 잃어버린 사람이지마는 네야 어떠냐. 설사 누가 무슨 말을 해서 학교에서 학비를 아니 준다거든 내가 네게 준 재산을 가지고 네 마음대로 공부를 하려무나. 네가 그렇게 해 주어야 나를 위하는 것이다. 자 인제 가거라. 네 앞길이 양양하지 아니하냐. 자 인제 가거라. 나는 내일 아침 동경을 떠날란다. 자 어서." +하고 나는 화평하게 웃는 낯으로 일어섰소. +정임은 울먹울먹하고 고개를 숙이오. +밖에서는 바람이 점점 강해져서 소리를 하고 유리창을 흔드오. +"그럼, 전 가요." +하고 정임은 고개를 들었소. +"그래. 어서 가거라. 벌써 열한시 반이다. 병원 문은 아니 닫니!" +정임은 대답이 없소. +"어서!" +하고 나는 보이를 불러 자동차를 하나 준비하라고 일렀소. +"갈랍니다." +하고 정임은 고개를 숙여서 내게 인사를 하고 문을 향하여 한 걸음 걷다가 잠깐 주저하더니, 다시 돌아서서, +"저를 한 번만 안아 주셔요. 아버지가 어린 딸을 안듯이 한 번만 안아 주셔요." +하고 내 앞으로 가까이 와 서오. +나는 팔을 벌려 주었소. 정임은 내 가슴을 향하고 몸을 던졌소. 그리고 제 이뺨 저뺨을 내 가슴에 대고 비볐소. 나는 두 팔을 정임의 어깨 위에 가벼이 놓았소. +이러한 지 몇 분이 지났소. 아마 일 분도 다 못 되었는지 모르오. +정임은 내 가슴에서 고개를 들어 나를 뚫어지게 우러러보더니, 다시 내 가슴에 낯을 대더니 아마 내 심장이 무섭게 뛰는 소리를 정임은 들었을 것이오 정임은 다시 고개를 들고, +"어디를 가시든지 편지나 주셔요." +하고 굵은 눈물을 떨구고는 내게서 물러서서 또 한 번 절하고, +"안녕히 가셔요. 만주든지 아령이든지 조선 사람 많이 사는 곳에 가셔서 일하고 사셔요. 돌아가실 생각은 마셔요. 제가, 아버지 말씀대로 혼자 떨어져 있으니 아버지도 제 말씀대로 돌아가실 생각은 마셔요, 네, 그렇다고 대답하셔요!" +하고는 또 한 번 내 가슴에 몸을 기대오. +죽기를 결심한 나는 `오냐, 그러마.' 하는 대답을 할 수는 없었소. 그래서, +"오, 내 살도록 힘쓰마." +하는 약속을 주어서 정임을 돌려보냈소. +정임의 발자국 소리가 안 들리게 된 때에 나는 빠른 걸음으로 옥상 정원으로 나갔소. 비가 막 뿌리오. +나는 정임이가 타고 나가는 자동차라도 볼 양으로 호텔 현관 앞이 보이는 꼭대기로 올라갔소. 현관을 떠난 자동차 하나가 전찻길로 나서서는 북을 향하고 달아나서 순식간에 그 꽁무니에 달린 붉은 불조차 스러져 버리고 말았소. +나는 미친 사람 모양으로, +"정임아, 정임아!" +하고 수없이 불렀소. 나는 사 층이나 되는 이 꼭대기에서 뛰어내려서 정임이가 타고 간 자동차의 뒤를 따르고 싶었소. +"아아 영원한 인생의 이별!" +나는 그 옥상에 얼마나 오래 섰던지를 모르오. 내 머리와 낯과 배스로브에서는 물이 흐르오. 방에 들어오니 정임이가 끼치고 간 향기와 추억만 남았소. +나는 방 안 구석구석에 정임의 모양이 보이는 것을 깨달았소. 특별히 정임이가 고개를 숙이고 서 있던 내 교의 뒤에는 분명히 갈색 외투를 입은 정임의 모양이 완연하오. +"정임아!" +하고 나는 그 곳으로 따라가오. 그러나 가면 거기는 정임은 없소. +나는 교의에 앉소. 그러면 정임의 씨근씨근하는 숨소리와 더운 입김이 분명 내 오른편에 감각이 되오. 아아 무서운 환각이여! +나는 자리에 눕소. 그리고 정임의 환각을 피하려고 불을 끄오. 그러면 정임이가 내게 안기던 자리쯤에 환하게 정임의 모양이 나타나오. +나는 불을 켜오. 또 불을 끄오. +날이 밝자 나는 비가 갠 것을 다행으로 비행장에 달려가서 비행기를 얻어 탔소. +나는 다시 조선의 하늘을 통과하기가 싫어서 북강에서 비행기에서 내려서 문사에 와서 대련으로 가는 배를 탔소. +나는 대련에서 내려서 하룻밤을 여관에서 자고는 곧 장춘 가는 급행을 탔소. 물론 아무에게도 엽서 한 장 한 일 없었소. 그것은 인연을 끊은 세상에 대하여 연연한 마음을 가지는 것을 부끄럽게 생각한 까닭이오. +차가 옛날에는 우리 조상네가 살고 문화를 짓던 옛 터전인 만주의 벌판을 달릴 때에는 감회도 없지 아니하였소. 그러나 나는 지금 그런 한가한 감상을 쓸 겨를이 없소. +내가 믿고 가는 곳은 하얼빈에 있는 어떤 친구요. 그는 R라는 사람으로서 경술년에 A씨 등의 망명객을 따라 나갔다가 아라사에서 무관 학교를 졸업하고 아라사 사관으로서 구주 대전에도 출정을 하였다가, 혁명 후에도 이내 적위군에 머물러서 지금까지 소비에트 장교로 있는 사람이오. 지금은 육군 소장이라던가. +나는 하얼빈에 그 사람을 찾아가는 것이오. 그 사람을 찾아야 아라사에 들어갈 여행권을 얻을 것이요, 여행권을 얻어야 내가 평소에 이상하게도 그리워하던 바이칼 호를 볼 것이오. +하얼빈에 내린 것은 해가 뉘엿뉘엿 넘어가는 석양이었소. +나는 안중근이 이등박문(伊藤博文:이토 히로부미)을 쏜 곳이 어딘가 하고 벌판과 같이 넓은 플랫폼에 내렸소. 과연 국제 도시라 서양 사람, 중국 사람, 일본 사람이 각기 제 말로 지껄이오. 아아 조선 사람도 있을 것이오마는 다들 양복을 입거나 청복을 입거나 하고 또 사람이 많은 곳에서는 말도 잘 하지 아니하여 아무쪼록 조선 사람인 것을 표시하지 아니하는 판이라 그 골격과 표정을 살피기 전에는 어느 것이 조선 사람인지 알 길이 없소. 아마 허름하게 차리고 기운 없이, 비창한 빛을 띠고 사람의 눈을 슬슬 피하는 저 순하게 생긴 사람들이 조선 사람이겠지요. 언제나 한 번 가는 곳마다 동양이든지, 서양이든지, +`나는 조선 사람이오!' +하고 뽐내고 다닐 날이 있을까 하면 눈물이 나오. 더구나, 하얼빈과 같은 각색 인종이 모여서 생존 경쟁을 하는 마당에 서서 이런 비감이 간절하오. 아아 이 불쌍한 유랑의 무리 중에 나도 하나를 더 보태는가 하면 눈물을 씻지 아니할 수 없었소. +나는 역에서 나와서 어떤 아라사 병정 하나를 붙들고 R의 아라사 이름을 불렀소. 그리고 아느냐고 영어로 물었소. +그 병정은 내 말을 잘못 알아들었는지, 또는 R를 모르는지 무엇이라고 아라사말로 지껄이는 모양이나 나는 물론 그것을 알아들을 수가 없었소. 그러나 나는 그 병정의 표정에서 내게 호의를 가진 것을 짐작하고 한 번 더 분명히, +"요십 알렉산드로비치 리가이." +라고 불러 보았소. +그 병정은 빙그레 웃고 고개를 흔드오. 이 두 외국 사람의 이상한 교섭에 흥미를 가지고 여러 아라사 병정과 동양 사람들이 십여 인이나 우리 주위에 모여드오. +그 병정이 나를 바라보고 또 한 번 그 이름을 불러 보라는 모양 같기로 나는 이번에는 R의 아라사 이름에 `제너럴'이라는 말을 붙여 불러 보았소. +그랬더니 어떤 다른 병정이 뛰어들며, +"게네라우 리가이!" +하고 안다는 표정을 하오. `게네라우'라는 것이 아마 아라사말로 장군이란 말인가 하였소. +"예스. 예스." +하고 나는 기쁘게 대답하였소. 그리고는 아라사 병정들끼리 무에라고 지껄이더니, 그 중에 한 병정이 나서면서 고개를 끄덕끄덕하고, 제가 마차 하나를 불러서 나를 태우고 저도 타고 어디로 달려가오. +그 아라사 병정은 친절히 알지도 못하는 말로 이것저것을 가리키면서 설명을 하더니 내가 못 알아듣는 줄을 생각하고 내 어깨를 툭 치고 웃소. 어린애와 같이 순한 사람들이구나 하고 나는 고맙다는 표로 고개만 끄덕끄덕하였소. +어디로 어떻게 가는지 서양 시가로 달려가다가 어떤 큰 저택 앞에 이르러서 마차를 그 현관 앞으로 들이몰았소. +현관에서는 종졸이 나왔소. 내가 명함을 들여보냈더니 부관인 듯한 아라사 장교가 나와서 나를 으리으리한 응접실로 인도하였소. 얼마 있노라니 중년이 넘은 어떤 대장이 나오는데 군복에 칼끈만 늘였소. +"이게 누구요." +하고 그 대장은 달려들어서 나를 껴안았소. 이십오 년 만에 만나는 우리는 서로 알아본 것이오. +이윽고 나는 그의 부인과 자녀들도 만났소. 그들은 다 아라사 사람이오. +저녁이 끝난 뒤에 나는 R의 부인과 딸의 음악과 그림 구경과 기타의 관대를 받고 단둘이 이야기할 기회를 얻었소. 경술년 당시 이야기도 나오고, A씨의 이야기도 나오고, R의 신세 타령도 나오고, 내 이십오 년 간의 생활 이야기도 나오고, 소비에트 혁명 이야기도 나오고, 하얼빈 이야기도 나오고, 우리네가 어려서 서로 사귀던 회구담도 나오고 이야기가 그칠 바를 몰랐소. "조선은 그립지 않은가." +하는 내 말에 쾌활하던 R는 고개를 숙이고 추연한 빛을 보였소. +나는 R의 추연한 태도를 아마 고국을 그리워하는 것으로만 여겼소. 그래서 나는 그리 침음하는 것을 보고, +"얼마나 고국이 그립겠나. 나는 고국을 떠난 지가 일 주일도 안 되건마는 못 견디게 그리운데." +하고 동정하는 말을 하였소. +했더니, 이 말 보시오. 그는 침음을 깨뜨리고 고개를 번쩍 들며, +"아니! 나는 고국이 조금도 그립지 아니하이. 내가 지금 생각한 것은 자네 말을 듣고 고국이 그리운가 그리워할 것이 있는가를 생각해 본 것일세. 그랬더니 아무리 생각하여도 나는 고국이 그립다는 생각을 가질 수가 없어. 그야 어려서 자라날 때에 보던 강산이라든지 내 기억에 남은 아는 사람들이라든지, 보고 싶다 하는 생각도 없지 아니하지마는 그것이 고국이 그리운 것이라고 할 수가 있을까. 그 밖에는 나는 아무리 생각하여도 고국이 그리운 것을 찾을 길이 없네. 나도 지금 자네를 보고 또 자네 말을 듣고 오래 잊어버렸던 고국을 좀 그립게, 그립다 하게 생각하려고 해 보았지마는 도무지 나는 고국이 그립다는 생각이 나지 않네." +이 말에 나는 깜짝 놀랐소. 몸서리치게 무서웠소. 나는 해외에 오래 표랑하는 사람은 으레 고국을 그리워할 것으로 믿고 있었소. 그런데 이 사람이, 일찍은 고국을 사랑하여 목숨까지도 바치려던 이 사람이 도무지 이처럼 고국을 잊어버린다는 것은 놀라운 정도를 지나서 괘씸하기 그지없었소. 나도 비록 조선을 떠난다고, 영원히 버린다고 나서기는 했지마는 나로는 죽기 전에는 아니 비록 죽더라도 잊어버리지 못할 고국을 잊어버린 R의 심사가 난측하고 원망스러웠소. +"고국이 그립지가 않아?" +하고 R에게 묻는 내 어성에는 격분한 빛이 있었소. +"이상하게 생각하시겠지. 하지만 고국에 무슨 그리울 것이 있단 말인가. 그 빈대 끓는 오막살이가 그립단 말인가. 나무 한 개 없는 산이 그립단 말인가. 물보다도 모래가 많은 다 늙어빠진 개천이 그립단 말인가. 그 무기력하고 가난한, 시기 많고 싸우고 하는 그 백성을 그리워한단 말인가. 그렇지 아니하면 무슨 그리워할 음악이 있단 말인가, 미술이 있단 말인가, 문학이 있단 말인가, 사상이 있단 말인가, 사모할 만한 인물이 있단 말인가! 날더러 고국의 무엇을 그리워하란 말인가. 나는 조국이 없는 사람일세. 내가 소비에트 군인으로 있으니 소비에트가 내 조국이겠지. 그러나 진심으로 내 조국이라는 생각은 나지 아니하네." +하고 저녁 먹을 때에 약간 붉었던 R의 얼굴은 이상한 흥분으로 더욱 붉어지오.유 정유 정 +R는 먹던 담배를 화나는 듯이 재떨이에 집어던지며, +"내가 하얼빈에 온 지가 인제 겨우 삼사 년밖에 안 되지마는 조선 사람 때문에 나는 견딜 수가 없어. 와서 달라는 것도 달라는 것이지마는 조선 사람이 또 어찌하였느니 또 어찌하였느니 하는 불명예한 말을 들을 때에는 나는 금시에 죽어 버리고 싶단 말일세. 내게 가장 불쾌한 것이 있다고 하면 그것은 고국이라는 기억과 조선 사람의 존잴세. 내가 만일 어느 나라의 독재자가 된다고 하면 나는 첫째로 조선인 입국 금지를 단행하려네. 만일 조선이라는 것을 잊어버릴 약이 있다고 하면 나는 생명과 바꾸어서라도 사 먹고 싶어." +하고 R는 약간 흥분된 어조를 늦추어서, +"나도 모스크바에 있다가 처음 원동에 나왔을 적에는 길을 다녀도 혹시 동포가 눈에 뜨이지나 아니하나 하고 찾았네. 그래서 어디서든지 동포를 만나면 반가이 손을 잡았지. 했지만 점점 그들은 오직 귀찮은 존재에 지나지 못하다는 것을 알았단 말일세. 인제는 조선 사람이라고만 하면 만나기가 무섭고 끔찍끔찍하고 진저리가 나는 걸 어떡허나. 자네 명함이 들어온 때에도 조선 사람인가 하고 가슴이 뜨끔했네." +하고 R는 웃지도 아니하오. 그의 얼굴에는, 군인다운 기운찬 얼굴에는 증오와 분노의 빛이 넘쳤소. +"나도 자네 집에 환영받는 나그네는 아닐세그려." +하고 나는 이 견디기 어려운 불쾌하고 무서운 공기를 완화하기 위하여 농담삼아 한 마디를 던지고 웃었소. +나는 R의 말이 과격함에 놀랐지마는, 또 생각하면 R가 한 말 가운데는 들을 만한 이유도 없지 아니하오. 그것을 생각할 때에 나는 R를 괘씸하게 생각하기 전에 내가 버린다는 조선을 위하여서 가슴이 아팠소. 그렇지만 이제 나 따위가 가슴을 아파한대야 무슨 소용이 있소. 조선에 남아 계신 형이나 R의 말을 참고삼아 쓰시기 바라오. 어쨌으나 나는 R에게서 목적한 여행권을 얻었소. R에게는 다만, +`나는 피곤한 몸을 좀 정양하고 싶다. 나는 내가 평소에 즐겨하는 바이칼 호반에서 눈과 얼음의 한겨울을 지내고 싶다.' +는 것을 여행의 이유로 삼았소. +R는 나의 초췌한 모양을 짐작하고 내 핑계를 그럴듯하게 아는 모양이었소. 그리고 나더러, `이왕 정양하려거든 카프카 지방으로 가거라. 거기는 기후 풍경도 좋고 또 요양원의 설비도 있다.'는 것을 말하였소. 나도 톨스토이의 소설에서, 기타의 여행기 등속에서 이 지방에 관한 말을 못 들은 것이 아니나 지금 내 처지에는 그런 따뜻하고 경치 좋은 지방을 가릴 여유도 없고 또 그러한 지방보다도 눈과 얼음과 바람의 시베리아의 겨울이 합당한 듯하였소. +그러나 나는 R의 호의를 굳이 사양할 필요도 없어서 그가 써 주는 대로 소개장을 다 받아 넣었소. 그는 나를 처남 매부 간이라고 소개해 주었소. +나는 모스크바 가는 다음 급행을 기다리는 사흘 동안 R의 집의 손이 되어서 R부처의 친절한 대우를 받았소. +그 후에는 나는 R와 조선에 관한 토론을 한 일은 없지마는 R가 이름지어 말을 할 때에는 조선을 잊었노라, 그리워할 것이 없노라, 하지마는 무의식적으로 말을 할 때에는 조선을 못 잊고 또 조선을 여러 점으로 그리워하는 양을 보았소. 나는 그것으로써 만족하게 여겼소. +나는 금요일 오후 세시 모스크바 가는 급행으로 하얼빈을 떠났소. 역두에는 R와 R의 가족이 나와서 꽃과 과일과 여러 가지 선물로 나를 전송하였소. R와 R의 가족은 나를 정말 형제의 예로 대우하여 차가 떠나려 할 때에 포옹과 키스로 작별하여 주었소. +이 날은 퍽 따뜻하고 일기가 좋은 날이었소. 하늘에 구름 한 점, 땅에 바람 한 점 없이 마치 늦은 봄날과 같이 따뜻한 날이었소. +차는 떠났소. 판다는 둥 안 판다는 둥 말썽 많은 동중로(지금은 북만 철로라고 하오.)의 국제 열차에 몸을 의탁한 것이오. +송화강(松花江:쑹화 강)의 철교를 건너오. 아아 그리도 낯익은 송화강! 송화강이 왜 낯이 익소. 이 송화강은 불함산(장백산)에 근원을 발하여 광막한 북만주의 사람도 없는 벌판을 혼자 소리도 없이 흘러가는 것이 내 신세와 같소. 이 북만주의 벌판을 만든 자가 송화강이지마는 나는 그만한 힘이 없는 것이 부끄러울 뿐이오. 이 광막한 북만의 벌판을 내 손으로 개척하여서 조선 사람의 낙원을 만들자 하고 뽐내어 볼까. 그것은 형이 하시오. 내 어린것이 자라거든 그놈에게나 그러한 생각을 넣어 주시오. +동양의 국제적 괴물인 하얼빈 시가도 까맣게 안개에서 스러져 버리고 말았소. 그러나 그 시가를 싼 까만 기운이 국제적 풍운을 포장한 것이라고 할까요. +가도가도 벌판. 서리맞은 마른 풀바다. 실개천 하나도 없는 메마른 사막. 어디를 보아도 산 하나 없으니 하늘과 땅이 착 달라붙은 듯한 천지. 구름 한 점 없건만도 그 큰 태양 가지고도 미처 다 비추지 못하여 지평선 호를 그린 지평선 위에는 항상 황혼이 떠도는 듯한 세계. 이 속으로 내가 몸을 담은 열차는 서쪽으로 서쪽으로 해가 가는 걸음을 따라서 달리고 있소. 열차가 달리는 바퀴 소리도 반향할 곳이 없어 힘없는 한숨같이 스러지고 마오. +기쁨 가진 사람이 지루해서 못 견딜 이 풍경은 나같이 수심 가진 사람에게는 가장 공상의 말을 달리기에 합당한 곳이오. +이 곳에도 산도 있고 냇물도 있고 삼림도 있고 꽃도 피고 날짐승, 길짐승이 날고 기던 때도 있었겠지요. 그러던 것이 몇만 년 지나는 동안에 산은 낮아지고 골은 높아져서 마침내 이 꼴이 된 것인가 하오. 만일 큰 힘이 있어 이 광야를 파낸다 하면 물 흐르고 고기 놀던 강과, 울고 웃던 생물이 살던 자취가 있을 것이오. 아아 이 모든 기억을 꽉 품고 죽은 듯이 잠잠한 광야에! +내가 탄 차가 F역에 도착하였을 때에는 북만주 광야의 석양의 아름다움은 그 극도에 달한 것 같았소. 둥긋한 지평선 위에 거의 걸린 커다란 해! 아마 그 신비하고 장엄함이 내 경험으로는 이 곳에서밖에는 볼 수 없는 것이라고생각하오. 이글이글 이글이글 그러면서도 둥글다는 체모를 변치 아니하는 그 지는 해! +게다가 먼 지평선으로부터 기어드는 황혼은 인제는 대지를 거의 다 덮어 버려서 마른 풀로 된 지면은 가뭇가뭇한 빛을 띠고 사막의 가는 모래를 머금은 지는 해의 광선을 반사하여서 대기는 짙은 자줏빛을 바탕으로 한 가지각색의 명암을 가진, 오색이 영롱한, 도무지 내가 일찍 경험해 보지 못한 색채의 세계를 이루었소. 아 좋다! +그 속에 수은같이 빛나는, 수없는 작고 큰 호수들의 빛! 그 속으로 날아오는 수없고 이름 모를 새들의 떼도 이 세상의 것이라고는 생각하지 아니하오. +나는 거의 무의식적으로 차에서 뛰어내렸소. 거의 떠날 시간이 다 되어서 짐의 일부분은 미처 가지지도 못하고 뛰어내렸소. 반쯤 미친 것이오. +정거장 앞 조그마한 아라사 사람의 여관에다가 짐을 맡겨 버리고 나는 단장을 끌고 철도 선로를 뛰어 건너서 호수의 수은빛 나는 곳을 찾아서 지향 없이 걸었소. +한 호수를 가서 보면 또 저 편 호수가 더 아름다워 보이오. 원컨대 저 지는 해가 다 지기 전에 이 광야에 있는 호수를 다 돌아보고 싶소. +내가 호숫 가에 섰을 때에 그 거울같이 잔잔한 호수면에 비치는 내 그림자의 외로움이여, 그러나 아름다움이여! 그 호수는 영원한 우주의 신비를 품고 하늘이 오면 하늘을, 새가 오면 새를, 구름이 오면 구름을, 그리고 내가 오면 나를 비추지 아니하오. 나는 호수가 되고 싶소. 그러나 형! 나는 이 호수면에서 얼마나 정임의 얼굴을 찾았겠소. 그것은 물리학적으로 불가능한 일이겠지요. 동경의 병실에 누워 있는 정임의 모양이 몽고 사막의 호수면에 비칠 리야 있겠소. 없겠지마는 나는 호수마다 정임의 그림자를 찾았소. 그러나 보이는 것은 외로운 내 그림자뿐이오. +`가자. 끝없는 사막으로 한없이 가자. 가다가 내 기운이 진하는 자리에 나는 내 손으로 모래를 파고 그 속에 내 몸을 묻고 죽어 버리자. 살아서 다시 볼 수 없는 정임의 「이데아」를 안고 이 깨끗한 광야에서 죽어 버리 자.' +하고 나는 지는 해를 향하고 한정 없이 걸었소. 사막이 받았던 따뜻한 기운은 아직도 다 식지는 아니하였소. 사막에는 바람 한 점도 없소. 소리 하나도 없소. 발자국 밑에서 우는 마른 풀과 모래의 바스락거리는 소리가 들릴 뿐이오. +나는 허리를 지평선에 걸었소. 그 신비한 광선은 내 가슴으로부터 위에만을 비추고 있소. +문득 나는 해를 따라가는 별 두 개를 보았소. 하나는 앞을 서고 하나는 뒤를 섰소. 앞의 별은 좀 크고 뒤의 별은 좀 작소. 이런 별들은 산 많은 나라 다시 말하면 서쪽 지평선을 보기 어려운 나라에서만 생장한 나로서는 보지 못하던 별이오. 나는 그 별의 이름을 모르오. `두 별'이오. +해가 지평선에서 뚝 떨어지자 대기의 자줏빛은 남빛으로 변하였소. 오직 해가 금시 들어간 자리에만 주홍빛의 여광이 있을 뿐이오. 내 눈앞에서는 남빛 안개가 피어오르는 듯하였소. 앞에 보이는 호수만이 유난히 빛나오. 또 한 떼의 이름 모를 새들이 수면을 스치며 날 저문 것을 놀라는 듯이 어지러이 날아 지나가오. 그들은 소리도 아니 하오. 날개치는 소리도 아니 들리오. 그것들은 사막의 황혼의 허깨비인 것 같소. +나는 자꾸 걷소. 해를 따르던 나는 두 별을 따라서 자꾸 걷소. +별들은 진 해를 따라서 바삐 걷는 것도 같고, 헤매는 나를 어떤 나라로 끄는 것도 같소. +아니 두 별 중에 앞선 별이 한 번 반짝하고는 최후로 한 번 반짝하고는 지평선 밑에 숨어 버리고 마오. 뒤에 남은 외별의 외로움이여! 나는 울고 싶었소. 그러나 나는 하나만 남은 작은 별 외로운 작은 별을 따라서 더 빨리 걸음을 걸었소. 그 한 별마저 넘어가 버리면 나는 어찌하오. +내가 웬일이오. 나는 시인도 아니요, 예술가도 아니오. 나는 정으로 행동한 일은 없다고 믿는 사람이오. 그러나 형! 이 때에 미친 것이 아니요, 내 가슴에는 무엇인지 모를 것을 따를 요샛말로 이른바 동경으로 찼소. +`아아 저 작은 별!' +그것도 지평선에 닿았소. +`아아 저 작은 별. 저것마저 넘어가면 나는 어찌하나.' +인제는 어둡소. 광야의 황혼은 명색뿐이요, 순식간이요, 해지자 신비하다고 할 만한 극히 짧은 동안에 아름다운 황혼을 조금 보이고는 곧 칠과 같은 암흑이오. 호수의 물만이 어디서 은빛을 받았는지 뿌옇게 나만이 유일한 존재다, 나만이 유일한 빛이다 하는 듯이 인제는 수은빛이 아니라 남빛을 발하고 있을 뿐이오. +나는 그 중 빛을 많이 받은, 그 중 환해 보이는 호수면을 찾아 두리번거리며, 그러나 빠른 걸음으로 헤매었소. 그러나 내가 좀더 맑은 호수면을 찾는 동안에 이 광야의 어둠은 더욱더욱 짙어지오. +나는 어떤 조그마한 호숫 가에 펄썩 앉았소. 내 앞에는 짙은 남빛의 수면에 조그마한 거울만한 밝은 데가 있소. 마치 내 눈에서 무슨 빛이 나와서, 아마 정임을 그리워하는 빛이 나와서 그 수면에 반사하는 듯이. 나는 허겁지겁 그 빤한 수면을 들여다보았소. 혹시나 정임의 모양이 거기 나타나지나 아니할까 하고. 세상에는 그러한 기적도 있지 아니한가 하고. +물에는 정임의 얼굴이 어른거리는 것 같았소. 이따금 정임의 눈도 어른거리고 코도 번뜻거리고 입도 번뜻거리는 것 같소. 그러나 수면은 점점 어두워 가서 그 환영조차 더욱 희미해지오. +나는 호수면에 빤하던 한 조각조차 캄캄해지는 것을 보고 숨이 막힐 듯함을 깨달으면서 고개를 들었소. +고개를 들려고 할 때에, 형이여, 이상한 일도 다 있소. 그 수면에 정임의 모양이, 얼굴만 아니라, 그 몸 온통이 그 어깨, 가슴, 팔, 다리까지도, 그 눈과 입까지도, 그 얼굴의 흰 것과 입술이 불그레한 것까지도, 마치 환한 대낮에 실물을 대한 모양으로 소상하게 나타났소. +"정임이!" +하고 나는 소리를 지르며 물로 뛰어들려 하였소. 그러나 형, 그 순간에 정임의 모양은 사라져 버리고 말았소. +나는 이 어둠 속에 어디 정임이가 나를 따라온 것같이 생각했소. 혹시나 정임이가 죽어서 그 몸은 동경의 대학 병원에 벗어 내어던지고 혼이 빠져 나와서 물에 비치었던 것이 아닐까, 나는 가슴이 울렁거림을 진정치 못하면서 호숫 가에서 벌떡 일어나서 어둠 속에 정임을 만져보려는 듯이, 어두워서 눈에 보지는 못하더라도 자꾸 헤매노라면 몸에 부딪히기라도 할 것 같아서 함부로 헤매었소. 그리고는 눈앞에 번뜻거리는 정임의 환영을 팔을 벌려서 안고 소리를 내어서 불렀소. +"정임이, 정임이." +하고 나는 수없이 정임을 부르면서 헤매었소. +그러나 형, 이것도 죄지요. 이것도 하나님께서 금하시는 일이지요. 그러길래 광야에 아주 어둠이 덮이고 새까만 하늘에 별이 총총하게 나고는 영 정임의 헛그림자조차 아니 보이지요. 나는 죄를 피해서 정임을 떠나서 멀리 온 것이니 정임의 헛그림자를 따라다니는 것도 옳지 않지요. +그렇지만 내가 이렇게 혼자서 정임을 생각만 하는 것이야 무슨 죄 될 것이 있을까요. 내가 정임을 만 리나 떠나서 이렇게 헛그림자나 그리며 그리워하는 것이야 무슨 죄가 될까요. 설사 죄가 되기로서니 낸들 이것까지야 어찌하오. 내가 내 혼을 죽여 버리기 전에야 내 힘으로 어찌하오. 설사 죄가 되어서 내가 지옥의 꺼지지 않는 유황불 속에서 영원한 형벌을 받게 되기로서니 그것을 어찌하오. 형, 이것, 이것도 말아야 옳은가요. 정임의 헛그림자까지도 끊어 버려야 옳은가요. +이 때요. 바로 이 때요. 내 앞 수십 보나 될까(캄캄한 밤이라 먼지 가까운지 분명히 알 수 없지마는) 하는 곳에 난데없는 등불 하나가 나서오. 나는 깜짝 놀라서 우뚝 섰소. 이 무인지경, 이 밤중에 갑자기 보이는 등불 그것은 마치 이 세상 같지 아니하였소. +저 등불이 어떤 등불일까, 그 등불이 몇 걸음 가까이 오니, 그 등불 뒤에 사람의 다리가 보이오. +"누구요?" +하는 것은 귀에 익은 조선말이오. 어떻게 이 몽고의 광야에서 조선말을 들을까 하고 나는 등불을 처음 볼 때보다 더욱 놀랐소. +"나는 지나가던 사람이오." +하고 나도 등불을 향하여 마주 걸어갔소. +그 사람은 등불을 들어서 내 얼굴을 비추어 보더니, +"당신 조선 사람이오?" +하고 묻소. +"네, 나는 조선 사람이오. 당신도 음성을 들으니 조선 사람인데, 어떻게 이런 광야에, 아닌 밤중에, 여기 계시단 말이오." +하고 나는 놀라는 표정 그대로 대답하였소. +"나는 이 근방에 사는 사람이니까 여기 오는 것도 있을 일이지마는 당신이야말로 이 아닌 밤중에." +하고 육혈포를 집어넣고, 손을 내밀어서 내게 악수를 구하오. +나는 반갑게 그의 손을 잡았소. 그러나 나는 `죽을 지경에 어떻게 오셨단 말이오.' 하고, 그가 내가 무슨 악의를 가진 흉한이 아닌 줄을 알고 손에 빼어들었던 육혈포로 시기를 잠깐이라도 노린 것을 불쾌하게 생각하였던 것이오. +그도 내 이름도 묻지 아니하고 또 나도 그의 이름을 묻지 아니하고 나는 그에게 끌려서 그가 인도하는 곳으로 갔소. 그 곳이란 것은 아까 등불이 처음 나타나던 곳인 듯한데, 거기서 또 한 번 놀란 것은 어떤 부인이 있는 것이오. 남자는 아라사식 양복을 입었으나 부인은 중국 옷 비슷한 옷을 입었소. 남자는 나를 끌어서 그 부인에게 인사하게 하고, +"이는 내 아내요." +하고 또 그 아내라는 부인에게는, +"이 이는 조선 양반이오. 성함이 뉘시죠?" +하고 그는 나를 바라보오. 나는, +"최석입니다." +하고 바로 대답하였소. +"최석 씨?" +하고 그 남자는 소개하던 것도 잊어버리고 내 얼굴을 들여다보오. +"네, 최석입니다." +"아 ●●학교 교장으로 계신 최석 씨." +하고 그 남자는 더욱 놀라오. +"네, 어떻게 내 이름을 아세요?" +하고 나도 그가 혹시 아는 사람이나 아닌가 하고 등불 빛에 얼굴을 들여다 보았으나 도무지 그 얼굴이 본 기억이 없소. +"최 선생을 내가 압니다. 남 선생한테 말씀을 많이 들었지요. 그런데 남 선생도 돌아가신 지가 벌써 몇 핸가." +하고 감개무량한 듯이 그 아내를 돌아보오. +"십오 년이지요." +하고 곁에 섰던 부인이 말하오. +"벌써 십오 년인가." +하고 그 남자는 나를 보고, +"정임이 잘 자랍니까? 벌써 이십이 넘었지." +하고 또 부인을 돌아보오. +"스물세 살이지." +하고 부인이 확실치 아니한 듯이 대답하오. +"네, 스물세 살입니다. 지금 동경에 있습니다. 병이 나서 입원한 것을 보고 왔는데." +하고 나는 번개같이 정임의 병실과 정임의 호텔 장면 등을 생각하고 가슴이 설렘을 깨달았소. 의외인 곳에서 의외인 사람들을 만나서 정임의 말을 하게 된 것을 기뻐하였소. +"무슨 병입니까. 정임이가 본래 몸이 약해서." +하고 부인이 직접 내게 묻소. +"네. 몸이 좀 약합니다. 병이 좀 나은 것을 보고 떠났습니다마는 염려가 됩니다." +하고 나는 무의식중에 고개를 동경이 있는 방향으로 돌렸소. 마치 고개를 동으로 돌리면 정임이가 보이기나 할 것같이. +"자, 우리 집으로 갑시다." +하고 나는 아직 그의 성명도 모르는 남자는, 그의 아내를 재촉하더니, +"우리가 조선 동포를 만난 것이 십여 년 만이오. 그런데 최 선생, 이것을 좀 보시고 가시지요." +하고 그는 빙그레 웃으면서 나를 서너 걸음 끌고 가오. 거기는 조그마한 무덤이 있고 그 앞에는 석 자 높이나 되는 목패를 세웠는데 그 목패에는 `두 별 무덤'이라는 넉 자를 썼소. +내가 이상한 눈으로 그 무덤과 목패를 보고 있는 것을 보고 그는, +"이게 무슨 무덤인지 아십니까?" +하고 유쾌하게 묻소. +"두 별 무덤이라니 무슨 뜻인가요?" +하고 나도 그의 유쾌한 표정에 전염이 되어서 웃고 물었소. +"이것은 우리 둘의 무덤이외다." +하고 그는 아내의 어깨를 치며 유쾌하게 웃었소. 부인은 부끄러운 듯이 웃고 고개를 숙이오. +도무지 모두 꿈 같고 환영 같소. +"자 갑시다. 자세한 말은 우리 집에 가서 합시다." +하고 서너 걸음 어떤 방향으로 걸어가니 거기는 말을 세 필이나 맨 마차가 있소. 몽고 사람들이 가족을 싣고 수초를 따라 돌아다니는 그러한 마차요. 삿자리로 홍예형의 지붕을 만들고 그 속에 들어가 앉게 되었소. 그의 부인과 나와는 이 지붕 속에 들어앉고 그는 손수 어자대에 앉아서 입으로 쮸쮸쮸쮸 하고 말을 모오. 등불도 꺼 버리고 캄캄한 속으로 달리오. +"불이 있으면 군대에서 의심을 하지요. 도적놈이 엿보지요. 게다가 불이 있으면 도리어 앞이 안 보인단 말요. 쯧쯧쯧쯧!" +하는 소리가 들리오. +대체 이 사람은 무슨 사람인가. 또 이 부인은 무슨 사람인가 하고 나는 어두운 속에서 혼자 생각하였소. 다만 잠시 본 인상으로 보아서 그들은 행복된 부부인 것 같았소. 그들이 무엇 하러 이 아닌 밤중에 광야에 나왔던가. 또 그 이상야릇한 두 별 무덤이란 무엇인가. +나는 불현듯 집을 생각하였소. 내 아내와 어린것들을 생각하였소. 가정과 사회에서 쫓겨난 내가 아니오. 쫓겨난 자의 생각은 언제나 슬픔뿐이었소. +나는 내 아내를 원망치 아니하오. 그는 결코 악한 여자가 아니오. 다만 보통 여자요. 그는 질투 때문에 이성의 힘을 잃은 것이오. 여자가 질투 때문에 이성을 잃는 것이 천직이 아닐까요. 그가 나를 사랑하길래 나를 위해서 질투를 가지는 것이 아니오. +설사 질투가 그로 하여금 칼을 들어 내 가슴을 찌르게 하였다 하더라도 나는 감사한 생각을 가지고 눈을 감을 것이오. 사랑하는 자는 질투한다고 하오. 질투를 누르는 것도 아름다운 일이지마는 질투에 타는 것도 아름다운 일이 아닐까요. +덜크럭덜크럭 하고 차바퀴가 철로길을 넘어가는 소리가 나더니 이윽고 마차는 섰소. +앞에 빨갛게 불이 비치오. +"자 이게 우리 집이오." +하고 그가 마차에서 뛰어내리는 양이 보이오. 내려 보니까 달이 올라오오. 굉장히 큰 달이, 붉은 달이 지평선으로서 넘석하고 올라오오. +달빛에 비추인 바를 보면 네모나게 담 담이라기보다는 성을 둘러쌓은 달 뜨는 곳으로 열린 대문을 들어서서 넓은 마당에 내린 것을 발견하였소. +"아버지!" +"엄마!" +하고 아이들이 뛰어나오오. 말만큼이나 큰 개가 네 놈이나 꼬리를 치고 나오오. 그놈들이 주인집 마차 소리를 알아듣고 짖지 아니한 모양이오. +큰 아이는 계집애로 여남은 살, 작은 아이는 사내로 육칠 세, 모두 중국 옷을 입었소. +우리는 방으로 들어갔소. 방은 아라사식 절반, 중국식 절반으로 세간이 놓여 있고 벽에는 조선 지도와 단군의 초상이 걸려 있소. +그들 부처는 지도와 단군 초상 앞에 허리를 굽혀 배례하오. 나도 무의식적으로 그대로 하였소. +그는 차를 마시며 이렇게 말하오. +"우리는 자식들을 이 흥안령 가까운 무변 광야에서 기르는 것으로 낙을 삼고 있지요. 조선 사람들은 하도 마음이 작아서 걱정이니 이런 호호탕탕한 넓은 벌판에서 길러나면 마음이 좀 커질까 하지요. 또 흥안령 밑에서 지나 중원을 통일한 제왕이 많이 났으니 혹시나 그 정기가 남아 있을까 하지요. 우리 부처의 자손이 몇 대를 두고 퍼지는 동안에는 행여나 마음 큰 인물이 하나 둘 날는지 알겠어요, 하하하하." +하고 그는 제 말을 제가 비웃는 듯이 한바탕 웃고 나서, +"그러나 이건 내 진정이외다. 우리도 이렇게 고국을 떠나 있지마는 그래도 고국 소식이 궁금해서 신문 하나는 늘 보지요. 하지만 어디 시원한 소식이 있어요. 그저 조리복소니가 되어가는 것이 아니면 조그마한 생각을 가지고, 눈곱만한 야심을 가지고, 서 푼어치 안 되는 이상을 가지고 찧고 까불고 싸우고 하는 것밖에 안 보이니 이거 어디 살 수가 있나. 그래서 나는 마음 큰 자손을 낳아서 길러 볼까 하고 이를테면 새 민족을 하나 만들어 볼까 하고, 둘째 단군, 둘째 아브라함이나 하나 낳아 볼까 하고 하하하하앗하." +하고 유쾌하게, 그러나 비통하게 웃소. +나는 저녁을 굶어서 배가 고프고, 밤길을 걸어서 몸이 곤한 것도 잊고 그의 말을 들었소. +부인이 김이 무럭무럭 나는 호떡을 큰 뚝배기에 담고 김치를 작은 뚝배기에 담고, 또 돼지고기 삶은 것을 한 접시 담아다가 탁자 위에 놓소. +건넌방이라고 할 만한 방에서 젖먹이 우는 소리가 들리오. 부인은 삼십이나 되었을까, 남편은 서른댓 되었을 듯한 키가 훨쩍 크고 눈과 코가 크고 손도 큰 건장한 대장부요, 음성이 부드러운 것이 체격에 어울리지 아니하나 그것이 아마 그의 정신 생활이 높은 표겠지요. +"신문에서 최 선생이 학교를 고만두시게 되었다는 말도 보았지요. 그러나 나는 그것이 다 최 선생에게 대한 중상인 줄을 짐작하였고, 또 오늘 이렇게 만나 보니까 더구나 그것이 다 중상인 줄을 알지요." +하고 그는 확신 있는 어조로 말하오. +"고맙습니다." +나는 이렇게밖에 대답할 말이 없었소. +"아, 머, 고맙다고 하실 것도 없지요." +하고 그는 머리를 뒤로 젖히고 한참이나 생각을 하더니 우선 껄껄 한바탕 웃고 나서, +"내가 최 선생이 당하신 경우와 꼭 같은 경우를 당하였거든요. 이를테면 과부 설움은 동무 과부가 안다는 것이지요." +하고 그는 자기의 내력을 말하기 시작하오. +"내 집은 본래 서울입니다. 내가 어렸을 적에 내 선친께서 시국에 대해서 불평을 품고 당신 삼 형제의 가족을 끌고 재산을 모두 팔아 가지고 간도에를 건너오셨지요. 간도에 맨 먼저 ●●학교를 세운 이가 내 선친이지요." +여기까지 하는 말을 듣고 나는 그가 누구인지를 알았소. 그는 R씨라고 간도 개척자요, 간도에 조선인 문화를 세운 이로 유명한 이의 아들인 것이 분명하오. 나는 그의 이름이 누구인지도 물어 볼 것 없이 알았소. +"아 그러십니까. 네, 그러세요." +하고 나는 감탄하였소. +"네, 내 선친을 혹 아실는지요. 선친의 말씀이 노 그러신단 말씀야요. 조선 사람은 속이 좁아서 못쓴다고 <정감록>에도 그런 말이 있다고 조선은 산이 많고 들이 좁아서 사람의 마음이 작아서 큰일하기가 어렵고, 큰사람이 나기가 어렵다고. 웬만치 큰사람이 나면 서로 시기해서 큰일할 새가 없이 한다고 그렇게 <정감록>에도 있다더군요. 그래서 선친께서 자손에게나 희망을 붙이고 간도로 오신 모양이지요. 거기서 자라났다는 것이 내 꼴입니다마는, 아하하. +내가 자라서 아버지께서 세우신 K여학교의 교사로 있을 때 일입니다. 지금 내 아내는 그 때 학생으로 있었구. 그러자 내 아버지께서 재산이 다 없어져서 학교를 독담하실 수가 없고, 또 얼마 아니해서 아버지께서 돌아가시고 보니 학교에는 세력 다툼이 생겨서 아버지의 후계자로 추정되는 나를 배척하게 되었단 말씀이오. 거기서 나를 배척하는 자료를 삼은 것이 나와 지금 내 아내가 된 학생의 관계란 것인데 이것은 전연 무근지설인 것은 말할 것도 없소. 나도 총각이요, 그는 처녀니까 혼인을 하자면 못 할 것도 없지마는 그것이 사제 관계라면 중대 문제거든. 그래서 나는 단연히 사직을 하고 내가 사직한 것은 제 죄를 승인한 것이라 하여서 그 학생 지금 내 아내도 출교 처분을 당한 것이오. 그러고 보니, 그 여자의 아버지 내 장인이지요 그 여자의 아버지는 나를 죽일 놈같이 원망을 하고 그 딸을 죽일 년이라고 감금을 하고 어쨌으나 조그마한 간도 사회에서 큰 파문을 일으켰단 말이오. +이 문제를 더 크게 만든 것은 지금 내 아내인, 그 딸의 자백이오. 무어라고 했는고 하니, 나는 그 사람을 사랑하오, 그 사람한테가 아니면 시집을 안 가오, 하고 뻗댔단 말요. +나는 이 여자가 이렇게 나를 생각하는가 할 때 의분심이 나서 나는 어떻게 해서든지 이 여자와 혼인하리라고 결심을 하였소. 나는 마침내 정식으로 K장로라는 내 장인에게 청혼을 하였으나 단박에 거절을 당하고 말았지요. K장로는 그 딸을 간도에 두는 것이 옳지 않다고 해서 서울로 보내기로 하였단 말을 들었소. 그래서 나는 최후의 결심으로 그 여자 지금 내 아내 된 사람을 데리고 간도에서 도망하였소. 하하하하. 밤중에 단둘이서. +지금 같으면야 사제간에 결혼을 하기로 그리 큰 문제가 될 것이 없지마는 그 때에 어디 그랬나요. 사제간에 혼인이란 것은 부녀간에 혼인한다는 것과 같이 생각하였지요. 더구나 그 때 간도 사회에는 청교도적 사상과 열렬한 애국심이 있어서 도덕 표준이 여간 높지 아니하였지요. 그런 시대니까 내가 내 제자인 여학생을 데리고 달아난다는 것은 살인 강도를 하는 이상으로 무서운 일이었지요. 지금도 나는 그렇게 생각합니다마는. +그래서 우리 두 사람은 우리 두 사람이라는 것보다도 내 생각에는 어찌하였으나 나를 위해서 제 목숨을 버리려는 그에게 사실 나도 마음 속으로는 그를 사랑하였지요. 다만 사제간이니까 영원히 달할 수는 없는 사랑이라고 단념하였을 뿐이지요. 그러니까 비록 부처 생활은 못 하더라도 내가 그의 사랑을 안다는 것과 나도 그를 이만큼 사랑한다는 것만을 보여 주자는 것이지요. +때는 마침 가을이지마는, 몸에 지닌 돈도 얼마 없고 천신만고로 길림까지를 나와 가지고는 배를 타고 송화강을 내려서 하얼빈에 가 가지고 거 기서 간신히 치타까지의 여비와 여행권을 얻어 가지고 차를 타고 떠나지 않았어요. 그것이 바로 십여 년 전 오늘이란 말이오." +이 때에 부인이 옥수수로 만든 국수와 감자 삶은 것을 가지고 들어오오. +나는 R의 말을 듣던 끝이라 유심히 부인을 바라보았소. 그는 중키나 되는 둥근 얼굴이 혈색이 좋고 통통하여 미인이라기보다는 씩씩한 여자요. 그런 중에 조선 여자만이 가지는 아담하고 점잖은 맛이 있소. +"앉으시지요. 지금 두 분께서 처음 사랑하시던 말씀을 듣고 있습니다." +하고 나는 부인에게 교의를 권하였소. +"아이, 그런 말씀은 왜 하시오." +하고 부인은 갑자기 십 년이나 어려지는 모양으로 수삽한 빛을 보이고 고개를 숙이고 달아나오. +"그래서요. 그래 오늘이 기념일이외다그려." +하고 나도 웃었소. +"그렇지요. 우리는 해마다 오늘이 오면 우리 무덤에 성묘를 가서 하룻밤을 새우지요. 오늘은 손님이 오셔서 중간에 돌아왔지만, 하하하하." +하고 그는 유쾌하게 웃소. +"성묘라니?" +하고 나는 물었소. +"아까 보신 두 별 무덤 말이오. 그것이 우리 내외의 무덤이지요. 하하하하." +"…………." +나는 영문을 모르고 가만히 앉았소. +"내 이야기를 들으시지요. 그래 둘이서 차를 타고 오지 않았겠어요. 물론 여전히 선생님과 제자지요. 그렇지만 워낙 여러 날 단둘이서 같이 고생을 하고 여행을 했으니 사랑의 불길이 탈 것이야 물론 아니겠어요. 다만 사제라는 굳은 의리가 그것을 겉에 나오지 못하도록 누른 것이지요. ……그런데 꼭 오늘같이 좋은 날인데 여기는 대개 일기가 일정합니다. 좀체로 비가 오는 일도 없고 흐리는 날도 없지요. 헌데 F역에를 오니까 참 석양 경치가 좋단 말이오. 그 때에 불현듯, 에라 여기서 내려서 이 석양 속에 저 호숫 가에 둘이서 헤매다가 깨끗이 사제의 몸으로 이 깨끗한 광야에 묻혀 버리자 하는 생각이 나겠지요. 그래 그 때 말을 내 아내 그 때에는 아직 아내가 아니지요 내 아내에게 그런 말을 하였더니 참 좋다고 박장을 하고 내 어깨에 매달리는구려. 그래서 우리 둘은 차가 거의 떠날 임박해서 차에서 뛰어내렸지요." +하고 그는 그때 광경을 눈앞에 그리는 모양으로 말을 끊고 우두커니 허공을 바라보오. 그러나 그의 입 언저리에는 유쾌한 회고에서 나오는 웃음이었소. +"이야기 다 끝났어요?" +하고 부인이 크바스라는 청량 음료를 들고 들어오오. +"아니오. 이제부터가 정통이니 당신도 거기 앉으시오. 지금 차에서 내린 데까지 왔는데 당신도 앉아서 한 파트를 맡으시오." +하고 R는 부인의 손을 잡아서 자리에 앉히오. 부인도 웃으면서 앉소. +"최 선생 처지가 꼭 나와 같단 말요. 정임의 처지가 당신과 같고." +하고 그는 말을 계속하오. +"그래 차에서 내려서 나는 이 양반하고 물을 찾아 헤매었지요. 아따, 석양이 어떻게 좋은지 이 양반은 박장을 하고 노래를 부르고 우리 둘은 마치 유쾌하게 산보하는 사람 같았지요." +"참 좋았어요. 그 때에는 참 좋았어요. 그 석양에 비친 광야와 호수라는 건 어떻게 좋은지 그 수은 같은 물 속에 텀벙 뛰어들고 싶었어요. 그 후엔 해마다 보아도 그만 못해." +하고 부인이 참견을 하오. +아이들은 다 자는 모양이오. +"그래 지향없이 헤매는데 해는 뉘엿뉘엿 넘어가구, 어스름은 기어들고 그 때 마침 하늘에는 별 둘이 나타났단 말이야. 그것을 이 여학생이 먼저 보고서 갑자기 추연해지면서 선생님 저 별 보셔요, 앞선 큰 별은 선생님이 구 따라가는 작은 별은 저야요, 하겠지요. 그 말이, 또 그 태도가 어떻게 가련한지. 그래서 나는 하늘을 바라보니깐 과연 별 두 개가 지는 해를 따르는 듯이 따라간다 말요. 말을 듣고 보니 과연 우리 신세와도 같지 않아요? +그리고는 이 사람이 또 이럽니다그려 `선생님, 앞선 큰 별은 아무리 따라도 저 작은 별은 영원히 따라잡지 못하겠지요. 영원히 영원히 따라가다가 따라가다가 못 해서 마침내는 저 작은 별은 죽어서 검은 재가 되고 말겠지요? 저 작은 별이 제 신세와 어쩌면 그리 같을까.' 하고 한탄을 하겠지요. 그 때에 한탄을 하고 눈물을 흘리고 섰는 어린 처녀의 석양빛에 비췬 모양을 상상해 보세요, 하하하하. 그 때에는 당신도 미인이었소. 하하하하." +하고 내외가 유쾌하게 웃는 것을 보니 나는 더욱 적막하여짐을 깨달았소. 어쩌면 그 석양, 그 두 별이 이들에게와 내게 꼭 같은 인상을 주었을까 하니 참으로 이상하다 하였소. +"그래 인제." +하고 R는 다시 이야기를 계속하오. +"그래 인제 둘이서 그야말로 감개무량하게 두 별을 바라보며 걸었지요. 그러다가 해가 넘어가고 앞선 큰 별이 넘어가고 그리고는 혼자서 깜빡깜빡하고 가던 작은 별이 넘어가니 우리는 그만 땅에 주저앉았소. 거기가 어딘고 하니 그 두 별 무덤이 있는 곳이지요. `선생님 저를 여기다가 파묻어 주시고 가셔요. 선생님 손수 저를 여기다가 묻어 놓고 가 주셔요.' 하고 이 사람이 조르지요." +하는 것을 부인은, +"내가 언제." +하고 남편을 흘겨보오. +"그럼 무에라고 했소? 어디 본인이 한 번 옮겨 보오." +하고 R가 말을 끊소. +"간도를 떠난 지가 한 달이 되도록 단둘이 다녀도 요만큼도 귀해 주는 점이 안 뵈니 그럼 파묻어 달라고 안 해요?" +하고 부인은 웃소. +"흥흥." +하고 R는 부인의 말에 웃고 나서, +"그 자리에 묻어 달란 말을 들으니까, 어떻게 측은한지, 그럼 나도 함께 묻히자고 그랬지요. 나는 그 때에 참말 그 자리에 함께 묻히고 싶었어요. 그래서 나는 손으로 곧 구덩이를 팠지요. 떡가루 같은 모래판이니까 파기는 힘이 아니 들겠지요. 이이도 물끄러미 내가 땅을 파는 것을 보고 섰더니만 자기도 파기를 시작하겠지요." +하고 내외가 다 웃소. +"그래 순식간에……." +하고 R는 이야기를 계속하오. +"순식간에 둘이 드러누울 만한 구덩이를 아마 두 자 깊이나 되게, 네모나게 파 놓고는 내가 들어가 누워 보고 그러고는 또 파고 하여 아주 편안한 구덩이를 파고 나서는 나는 아주 세상을 하직할 셈으로 사방을 둘러보 고 사방이래야 컴컴한 어둠밖에 없지만 사방을 둘러보고, 이를테면 세상과 작별을 하고 드러누웠지요. 지금 이렇게 회고담을 할 때에는 우습기도 하지마는 그 때에는 참으로 종교적이라 할 만한 엄숙이었소. 그때 우리 둘의 처지는 앞도 절벽, 뒤도 절벽이어서 죽는 길밖에 없었지요. 또 그뿐 아니라 인생의 가장 깨끗하고 가장 사랑의 맑은 정이 타고 가장 기쁘고도 슬프고도 이를테면 모든 감정이 절정에 달하고, 그러한 순간에 목숨을 끊어 버리는 것이 가장 좋은 일이요, 가장 마땅한 일같이 생각하였지요. 광야에 아름다운 황혼이 순간에 스러지는 모양으로 우리 두 생명의 아름다움도 순간에 스러지자는 우리는 철학자도 시인도 아니지마는 우리들의 환경이 우리 둘에게 그러한 생각을 넣어 준 것이지요. +그래서 내가 가만히 드러누워 있는 것을 저이가 물끄러미 보고 있더니 자기도 내 곁에 들어와 눕겠지요. 그런 뒤에는 황혼에 남은 빛도 다 스러지고 아주 캄캄한 암흑 세계가 되어 버렸지요. 하늘에 어떻게 그렇게 별이 많은지. 가만히 하늘을 바라보노라면 참 별이 많아요. 우주란 참 커요. 그런데 이 끝없이 큰 우주에 한없이 많은 별들이 다 제자리를 지키고 제 길을 지켜서 서로 부딪지도 아니하고 끝없이 긴 시간에 질서를 유지하고 있는 것을 보면 우주에는 어떤 주재하는 뜻, 섭리하는 뜻이 있다 하는 생각이 나겠지요. 나도 예수교인의 가정에서 자라났지마는 이 때처럼 하나님이라 할까 이름은 무엇이라고 하든지 간에 우주의 섭리자의 존재를 강렬하게 의식한 일은 없었지요. +그렇지만 `사람의 마음에 비기면 저까짓 별들이 다 무엇이오?' 하고 그때 겨우 열여덟 살밖에 안 된 이이가 내 귀에 입을 대고 말할 때에는 나도 참으로 놀랐습니다. 나이는 나보다 오륙 년 상관밖에 안 되지마는 이십 세 내외에 오륙 년 상관이 적은 것인가요? 게다가 나는 선생이요 자기는 학생이니까 어린애로만 알았던 것이 그런 말을 하니 놀랍지 않아요? 어째서 사람의 마음이 하늘보다도 더 이상할까 하고 내가 물으니까, 그 대답이 `나는 무엇이라고 설명할 수가 없지마는 내 마음 속에 일어나는 것이 하늘이나 땅에 일어나는 모든 것보다도 더 아름답고 더 알 수 없고 더 뜨겁고 그런 것 같아요.' 그러겠지요. 생명이란 모든 아름다운 것 중에 가장 아름다운 것이라는 것을 나는 깨달았어요. 그 말에, `그렇다 하면 이 아름답고 신비한 생명을 내는 우주는 더 아름다운 것이 아니오?' 하고 내가 반문하니까, 당신(부인을 향하여) 말이, `전 모르겠어요, 어쨌으나 전 행복합니다. 저는 이 행복을 깨뜨리고 싶지 않습니다. 놓쳐 버리고 싶지 않습니다. 이 행복 선생님 곁에 있는 이 행복을 꽉 안고 죽고 싶어요.' 그러지 않았소?" +"누가 그랬어요? 아이 난 다 잊어버렸어요." +하고 부인은 차를 따르오. R는 인제는 하하하 하는 웃음조차 잊어버리고, 부인에게 농담을 붙이는 것조차 잊어버리고, 그야말로 종교적 엄숙 그대로말을 이어, +"`자 저는 약을 먹어요.' 하고 손을 입으로 가져가는 동작이 감행되겠지요. 약이란 것은 하얼빈에서 준비한 아편이지요. 하얼빈서 치타까지 가는 동안에 흥안령이나 어느 삼림지대나 어디서나 죽을 자리를 찾자고 준비한 것이니까. 나는 입 근처로 가는 그의 손을 붙들었어요. 붙들면서 나는 `잠깐만 기다리오. 오늘 밤 안으로 그 약을 먹으면 고만이 아니오? 이 행복된 순간을 잠깐이라도 늘립시다. 달 올라올 때까지만.' 나는 이렇게 말했지요. `선생님도 행복되셔요? 선생님은 불행이시지. 저 때문에 불행이시지. 저만 이곳에 묻어 주시구는 선생님은 세상에 돌아가 사셔요, 오래오래 사셔요, 일 많이 하고 사셔요.' 하고 울지 않겠어요. 나는 그 때에 내 아내가 하던 말을 한 마디도 잊지 아니합니다. 그 말을 듣던 때의 내 인상은 아마 일생 두고 잊히지 아니하겠지요. +나는 자백합니다. 그 순간에 나는 처음으로 내 아내를 안고 키스를 하였지요. 내 속에 눌리고 눌리고 쌓이고 하였던 열정이 그만 일시에 폭발되었던 것이오. 아아 이것이 최초의 것이요, 동시에 최후의 것이로구나 할 때에 내 눈에서는 끓는 듯한 눈물이 흘렀소이다. 두 사람의 심장이 뛰는 소리, 두 사람의 풀무 불길 같은 숨소리. +이윽고 달이 떠올라 왔습니다. 가이없는 벌판이니까 달이 뜨니까 갑자기 천지가 환해지고 우리 둘이 손으로 파서 쌓아 놓은 흙무더기가 이 산 없는 세상에 산이나 되는 것같이 조그마한 검은 그림자를 지고 있겠지요. `자 우리 달빛을 띠고 좀 돌아다닐까.' 하고 나는 아내를 안아 일으켰지요. 내 팔에 안겨서 고개를 뒤로 젖힌 내 아내의 얼굴이 달빛에 비친 양을 나는 잘 기억합니다. 실신한 듯한, 만족한 듯한, 그리고도 절망한 듯한 그 표정을 무엇으로 그릴지 모릅니다. 그림도 그릴 줄 모르고 조각도 할 줄 모르고 글도 쓸 줄 모르는 내가 그것을 어떻게 그립니까. 그저 가슴 속에 품고 이렇게 오늘의 내 아내를 바라볼 뿐이지요. +나는 내 아내를 팔에 걸고 네, 걸었다고 하는 것이 가장 합당하지 요 이렇게 팔에다 걸고 달빛을 받은 황량한 벌판, 아무리 하여도 환하게 밝아지지는 아니하는 벌판을 헤매었습니다. 이따금 내 아내가, `어서 죽고 싶어요, 전 죽고만 싶어요.' 하는 말에는 대답도 아니 하고. 죽고 싶다는 그 말은 물론 진정일 것이지요. 아무리 맑은 일기라 하더라도 오후가 되면 흐려지는 법이니까 오래 살아가는 동안에 늘 한 모양으로 이 순간같이 깨끗하고 뜨거운 기분으로 갈 수는 없지 않아요? 불쾌한 일도 생기고, 보기 흉한 일도 생길는지 모르거든. 그러니까 이 완전한 깨끗과 완전한 사랑과 완전한 행복 속에 죽어 버리자는 뜻을 나는 잘 알지요. 더구나 우리들이 살아 남는대야 앞길이 기구하지 평탄할 리는 없지 아니해요? 그래서 나는 `죽지, 우리 이 달밤에 실컷 돌아다니다가, 더 돌아다니기가 싫거든 그 구덩에 돌아가서 약을 먹읍시다.' 이렇게 말하고 우리 둘은 헤맸지요. 낮에 보면 어디까지나 평평한 벌판인 것만 같지마는 달밤에 보면 이 사막에도 아직 채 스러지지 아니한 산의 형적이 남아 있어서 군데군데 거뭇거뭇한 그림자가 있겠지요. 그 그림자 속에는 걸어 들어가면 어떤 데는 우리 허리만큼 그림자에 가리우고 어떤 데는 우리 둘을 다 가리워 버리는 데도 있단 말야요. 죽음의 그림자라는 생각이 나면 그래도 몸에 소름이 끼쳐요. +차차 달이 높아지고 추위가 심해져서 바람결이 지나갈 때에는 눈에서 눈물이 날 지경이지요. 원체 대기 중에 수분이 적으니까 서리도 많지 않지마는, 그래도 대기 중에 있는 수분은 다 얼어 버려서 얼음가루가 되었는 게지요. 공중에는 반짝반짝하는 수정가루 같은 것이 보입니다. 낮에는 땀이 흐르리만큼 덥던 사막도 밤이 되면 이렇게 기온이 내려가지요. 춥다고 생각은 하면서도 춥다는 말은 아니 하고 우리는 어떤 때에는 달을 따라서, 어떤 때에는 달을 등지고, 어떤 때에는 호수에 비친 달을 굽어보고, 이 모양으로 한없이 말도 없이 돌아다녔지요. 이 세상 생명의 마지막 순간을 힘껏 의식하려는 듯이. +마침내 `나는 더 못 걸어요.' 하고 이이가 내 어깨에 매달려 버리고 말았지요." +하고 R가 부인을 돌아보니 부인은 편물하던 손을 쉬고, +"다리가 아픈 줄은 모르겠는데 다리가 이리 뉘구 저리 뉘구 해서 걸음을 걸을 수가 없었어요. 춥기는 하구." +하고 소리를 내어서 웃소. +"그럴 만도 하지." +하고 R는 긴장한 표정을 약간 풀고 앉은 자세를 잠깐 고치며, +"그 후에 그 날 밤 돌아다닌 곳을 더듬어 보니까, 자세히는 알 수 없지마는 삼십 리는 더 되는 것 같거든. 다리가 아프지 아니할 리가 있나." +하고 차를 한 모금 마시고 나서 말을 계속하오. +"그래서 나는 내 외투를 벗어서, 이이(부인)를 싸서 어린애 안듯이 안고 걸었지요. 외투로 쌌으니 자기도 춥지 않구, 나는 또 무거운 짐을 안았으니 땀이 날 지경이구, 그뿐 아니라 내가 제게 주는 최후의 서비스라 하니 기쁘고, 말하자면 일거 삼득이지요. 하하하하. 지난 일이니 웃지마는 그 때 사정을 생각해 보세요, 어떠했겠나." +하고 R는 약간 처참한 빛을 띠면서, +"그러니 그 구덩이를 어디 찾을 수가 있나. 얼마를 찾아 돌아다니다가 아무 데서나 죽을 생각도 해 보았지마는 몸뚱이를 그냥 벌판에 내놓고 죽고 싶지는 아니하고 또 그 구덩이가 우리 두 사람에게 특별한 의미가 있는 것 같아서 기어코 그것을 찾아 내고야 말았지요. 그 때는 벌써 새벽이 가까웠던 모양이오. 열 시나 넘어서 뜬 하현달이 낮이 기울었으니 그렇지 않겠어요. 그 구덩이에 와서 우리는 한 번 더 하늘과 달과 별과, 그리고 마음 속에 떠오른 사람들과 하직하고 약 먹을 준비를 했지요. +약을 검은 고약과 같은 아편을 맛이 쓰다는 아편을 물도 없이 먹으려 들었지요. +우리 둘은 아까 모양으로 가지런히 누워서 하늘을 바라보았는데 달이 밝으니까 보이던 별들 중에 숨은 별이 많고 또 별들의 위치 우리에게 낯익은 북두칠성 자리도 변했을 것 아니야요. 이상한 생각이 나요. 우리가 벌판으로 헤매는 동안에 천지가 모두 변한 것 같아요. 사실 변하였지요. 그 변한 것이 우스워서 나는 껄껄 웃었지요. 워낙 내가 웃음이 좀 헤프지만 이 때처럼 헤프게 실컷 웃어 본 일은 없습니다. +왜 웃느냐고 아내가 좀 성을 낸 듯이 묻기로, `천지와 인생이 변하는 것이 우스워서 웃었소.' 그랬지요. 그랬더니, `천지와 인생은 변할는지 몰라도 내 마음은 안 변해요!' 하고 소리를 지르겠지요. 퍽 분개했던 모양이야." +하고 R는 그 아내를 보오. +"그럼 분개 안 해요? 남은 죽을 결심을 하고 발발 떨구 있는데 곁에서 껄껄거리고 웃으니, 어째 분하지가 않아요. 나는 분해서 달아나려고 했어요." +하고 부인은 아직도 분함이 남은 것같이 말하오. +"그래 달아나지 않았소?" +하고 R는 부인이 벌떡 일어나서 비틀거리고 달아나는 흉내를 팔과 다리로 내고 나서, +"이래서 죽는 시간이 지체가 되었지요. 그래서 내가 빌고 달래고 해서 가까스로 안정을 시키고 나니 손에 쥐었던 아편이 땀에 푹 젖었겠지요. 내가 웃은 것은 죽기 전 한 번 천지와 인생을 웃어 버린 것인데 그렇게 야단이니…… 하하하하." +R는 식은 차를 한 모금 더 마시며, +"참 목도 마르기도 하더니. 입에는 침 한 방울 없고. 그러나 못물을 먹을 생각도 없고. 나중에는 말을 하려고 해도 혀가 안 돌아가겠지요. +이러는 동안에 달빛이 희미해지길래 웬일인가 하고 고개를 번쩍 들었더니 해가 떠오릅니다그려. 어떻게 붉고 둥글고 씩씩한지. `저 해 보오.' 하고 나는 기계적으로 벌떡 일어나서 구덩이에서 뛰어나왔지요." +하고 빙그레 웃소. R의 빙그레 웃는 양이 참 좋았소. +"내가 뛰어나오는 것을 보고 이이도 뿌시시 일어났지요. 그 해! 그 해의 새 빛을 받는 하늘과 땅의 빛! 나는 그것을 형용할 말을 가지지 못합니다. 다만 힘껏 소리치고 싶고 기운껏 달음박질치고 싶은 생각이 날 뿐이어요. +`우리 삽시다, 죽지 말고 삽시다, 살아서 새 세상을 하나 만들어 봅시다.' 이렇게 말하였지요. 하니까 이이가 처음에는 깜짝 놀라는 것 같아요. 그러나 마침내 아내도 죽을 뜻을 변하였지요. 그래서 남 선생을 청하여다가 그 말씀을 여쭈었더니 남 선생께서 고개를 끄덕끄덕하시고 우리 둘의 혼인 주례를 하셨지요. 그 후 십여 년에 우리는 밭 갈고 아이 기르고 이런 생활을 하고 있는데 언제나 여기 새 민족이 생기고 누가 새 단군이 될는지요. 하하하하, 아하하하. 피곤하시겠습니다. 이야기가 너무 길어서." +하고 R는 말을 끊소. +나는 R부처가 만류하는 것도 다 뿌리치고 여관으로 돌아왔소. R와 함께 달빛 속, 개 짖는 소리 속을 지나서 아라사 사람의 조그마한 여관으로 돌아왔소. 여관 주인도 R를 아는 모양이어서 반갑게 인사하고 또 내게 대한 부탁도 하는 모양인가 보오. +R는 내 방에 올라와서 내일 하루 지날 일도 이야기하고 또 남 선생과 정임에게 관한 이야기도 하였으나, 나는 그가 무슨 이야기를 하는지 잘 들을 만한 마음의 여유도 없어서 마음 없는 대답을 할 뿐이었소. +R가 돌아간 뒤에 나는 옷도 벗지 아니하고 침대에 드러누웠소. 페치카를 때기는 한 모양이나 방이 써늘하기 그지없소. +`그 두 별 무덤이 정말 R와 그 여학생과 두 사람이 영원히 달치 못할 꿈을 안은 채로 깨끗하게 죽어서 묻힌 무덤이었으면 얼마나 좋을까. 만일 그렇다 하면 내일 한 번 더 가서 보토라도 하고 오련마는.' +하고 나는 R부처의 생활에 대하여 일종의 불만과 환멸을 느꼈소. +그리고 내가 정임을 여기나 시베리아나 어떤 곳으로 불러다가 만일 R와 같은 흉내를 낸다 하면, 하고 생각해 보고는 나는 진저리를 쳤소. 나는 내머리 속에 다시 그러한 생각이 한 조각이라도 들어올 것을 두려워하였소. +급행을 기다리자면 또 사흘을 기다리지 아니하면 아니 되기로 나는 이튿날 새벽에 떠나는 구간차를 타고 F역을 떠나 버렸소. R에게는 고맙다는 편지 한 장만을 써 놓고. 나는 R를 더 보기를 원치 아니하였소. 그것은 반드시 R를 죄인으로 보아서 그런 것은 아니오마는 그저 나는 다시 R를 대면하기를 원치 아니한 것이오. +나는 차가 R의 집 앞을 지날 때에도 R의 집에 대하여서는 외면하였소. +이 모양으로 나는 흥안령을 넘고, 하일라르의 솔밭을 지나서 마침내 이 곳에 온 것이오. +형! 나는 인제는 이 편지를 끝내오. 더 쓸 말도 없거니와 인제는 이것을 쓰기도 싫증이 났소. +이 편지를 쓰기 시작할 때에는 바이칼에 물결이 흉용하더니 이 편지를 끝내는 지금에는 가의 가까운 물에는 얼음이 얼었소. 그리고 저 멀리 푸른 물이 늠실늠실 하얗게 눈 덮인 산 빛과 어울리게 되었소. +사흘이나 이어서 오던 눈이 밤새에 개고 오늘 아침에는 칼날 같은 바람이 눈을 날리고 있소. +나는 이 얼음 위로 걸어서 저 푸른 물 있는 곳까지 가고 싶은 유혹을 금할 수 없소. 더구나 이 편지도 다 쓰고 나니, 인제는 내가 이 세상에서 할 마지막 일까지 다 한 것 같소. +내가 이 앞에 어디로 가서 어찌 될는지는 나도 모르지마는 희미한 소원을 말하면 눈 덮인 시베리아의 인적 없는 삼림 지대로 한정 없이 헤매다가 기운 진하는 곳에서 이 목숨을 마치고 싶소. +최석 군은 `끝'이라는 글자를 썼다가 지워 버리고 딴 종이에다가 이런 말을 썼다 +다 쓰고 나니 이런 편지도 다 부질없는 일이오. 내가 이런 말을 한대야 세상이 믿어 줄 리도 없지 않소. 말이란 소용 없는 것이오. 내가 아무리 내 아내에게 말을 했어도 아니 믿었거든 내 아내도 내 말을 아니 믿었거든 하물며 세상이 내 말을 믿을 리가 있소. 믿지 아니할 뿐 아니라 내 말 중에서 자기네 목적에 필요한 부분만은 믿고, 또 자기네 목적에 필요한 부분은 마음대로 고치고 뒤집고 보태고 할 것이니까, 나는 이 편지를 쓴 것이 한 무익하고 어리석은 일인 줄을 깨달았소. +형이야 이 편지를 아니 보기로니 나를 안 믿겠소? 그 중에는 혹 형이 지금까지 모르던 자료도 없지 아니하니, 형만 혼자 보시고 형만 혼자 내 사정을 알아 주시면 다행이겠소. 세상에 한 믿는 친구를 가지는 것이 저마다 하는 일이겠소? +나는 이 쓸데없는 편지를 몇 번이나 불살라 버리려고 하였으나 그래도 거기도 일종의 애착심이 생기고 미련이 생기는구려. 형 한 분이라도 보여 드리고 싶은 마음이 생기는구려. 내가 S형무소에 입감해 있을 적에 형무소 벽에 죄수가 손톱으로 성명을 새긴 것을 보았소. 뒤에 물었더니 그것은 흔히 사형수가 하는 짓이라고. 사형수가 교수대에 끌려 나가기 바로 전에 흔히 손톱으로 담벼락이나 마룻바닥에 제 이름을 새기는 일이 있다고 하는 말을 들었소. 내가 형에게 쓰는 이 편지도 그 심리와 비슷한 것일까요? +형! 나는 보통 사람보다는, 정보다는 지로, 상식보다는 이론으로, 이해보다는 의리로 살아 왔다고 자신하오. 이를테면 논리학적으로 윤리학적으로 살아온 것이라고 할까. 나는 엄격한 교사요, 교장이었소. 내게는 의지력과 이지력밖에 없는 것 같았소. 그러한 생활을 수십 년 해 오지 아니하였소? 나는 이 앞에 몇십 년을 더 살더라도 내 이 성격이나 생활 태도에는 변함이 없으리라고 자신하였소. 불혹지년이 지났으니 그렇게 생각하였을 것이 아니오? +그런데 형! 참 이상한 일이 있소. 그것은 내가 지금까지 처해 있던 환경을벗어나서 호호 탕탕하게 넓은 세계에 알몸을 내어던짐을 당하니 내 마음 속에는 무서운 여러 가지 변화가 일어나는구려. 나는 이 말도 형에게 아니 하려고 생각하였소. 노여워하지 마시오, 내게까지도 숨기느냐고. 그런 것이 아니오, 형은커녕 나 자신에게까지도 숨기려고 하였던 것이오. 혹시 그런 기다리지 아니 하였던 원, 그런 생각이 내 마음의 하늘에 일어나리라고 상상도 아니하였던, 그런 생각이 일어날 때에는 나는 스스로 놀라고 스스로 슬퍼하였소. 그래서 스스로 숨기기로 하였소. +그 숨긴다는 것이 무엇이냐 하면 그것은 열정이요, 정의 불길이요, 정의 광풍이요, 정의 물결이오. 만일 내 의식이 세계를 평화로운 풀 있고, 꽃 있고, 나무 있는 벌판이라고 하면 거기 난데없는 미친 짐승들이 불을 뿜고 소리를 지르고 싸우고, 영각을 하고 날쳐서, 이 동산의 평화의 화초를 다 짓밟아 버리고 마는 그러한 모양과 같소. +형! 그 이상야릇한 짐승들이 여태껏, 사십 년 간을 어느 구석에 숨어 있었소? 그러다가 인제 뛰어나와 각각 제 권리를 주장하오? +지금 내 가슴 속은 끓소. 내 몸은 바짝 여위었소. 그것은 생리학적으로나 심리학적으로나 타는 것이요, 연소하는 것이오. 그래서 다만 내 몸의 지방만이 타는 것이 아니라, 골수까지 타고, 몸이 탈 뿐이 아니라 생명 그 물건이 타고 있는 것이오. 그러면 어찌할까. +지위, 명성, 습관, 시대 사조 등등으로 일생에 눌리고 눌렸던 내 자아의 일부분이 혁명을 일으킨 것이오? 한 번도 자유로 권세를 부려 보지 못한 본능과 감정들이 내 생명이 끝나기 전에 한 번 날뛰어 보려는 것이오. 이것이 선이오? 악이오? +그들은 내가 지금까지 옳다고 여기고 신성하다고 여기던 모든 권위를 모조리 둘러엎으려고 드오. 그러나 형! 나는 도저히 이 혁명을 용인할 수가 없소. 나는 죽기까지 버티기로 결정을 하였소. 내 속에서 두 세력이 싸우다가 싸우다가 승부가 결정이 못 된다면 나는 승부의 결정을 기다리지 아니하고 살기를 그만두려오. +나는 눈 덮인 삼림 속으로 들어가려오. 나는 V라는 대삼림 지대가 어디인 줄도 알고 거기를 가려면 어느 정거장에서 내릴 것도 다 알아 놓았소. +만일 단순히 죽는다 하면 구태여 멀리 찾아갈 필요도 없지마는 그래도 나 혼자로는 내 사상과 감정의 청산을 하고 싶소. 살 수 있는 날까지 세상을 떠난 곳에서 살다가 완전한 해결을 얻는 날 나는 혹은 승리의, 혹은 패배의 종막을 닫칠 것이오. 만일 해결이 안 되면 안 되는 대로 그치면 그만이지요. +나는 이 붓을 놓기 전에 어젯밤에 꾼 꿈 이야기 하나는 하려오. 꿈이 하도 수상해서 마치 내 전도에 대한 신의 계시와도 같기로 하는 말이오. 그 꿈은 이러하였소. +내가 꽁이깨(꼬이까라는 아라사말로 침대라는 말이 조선 동포의 입으로 변한 말이오.) 짐을 지고 삽을 메고 눈이 덮인 삼림 속을 혼자 걸었소. 이 꽁이깨 짐이란 것은 금점꾼들이 그 여행 중에 소용품, 마른 빵, 소금, 내복 등속을 침대 매트리스에 넣어서 지고 다니는 것이오. 이 짐하고 삽 한 개, 도끼 한 개, 그것이 시베리아로 금을 찾아 헤매는 조선 동포들의 행색이오. 내가 이르쿠츠크에서 이러한 동포를 만났던 것이 꿈으로 되어 나온 모양이오. +나는 꿈에는 세상을 다 잊어버린, 아주 깨끗하고 침착한 사람으로 이 꽁이깨 짐을 지고 삽을 메고 밤인지 낮인지 알 수 없으나 땅은 눈빛으로 희고, 하늘은 구름빛으로 회색인 삼림 지대를 허덕허덕 걸었소. 길도 없는 데를, 인적도 없는 데를. +꿈에도 내 몸은 퍽 피곤해서 쉴 자리를 찾는 마음이었소. +나는 마침내 어떤 언덕 밑 한 군데를 골랐소. 그리고 상시에 이야기에서 들은 대로 삽으로 내가 누울 자리만한 눈을 치고, 그리고는 도끼로 곁에 선 나무 몇 개를 찍어 누이고 거기다가 불을 놓고 그 불김에 녹은 땅을 두어 자나 파내고 그 속에 드러누웠소. 훈훈한 것이 아주 편안하였소. +하늘에는 별이 반짝거렸소. F역에서 보던 바와 같이 큰 별 작은 별도 보이고 평시에 보지 못하던 붉은 별, 푸른 별 들도 보였소. 나는 이 이상한 하늘, 이상한 별들이 있는 하늘을 보고 드러누워 있노라니까 문득 어디서 발자국 소리가 들렸소. 퉁퉁퉁퉁 우루루루…… 나는 벌떡 일어나려 하였으나 몸이 천 근이나 되어서 움직일 수가 없었소. 가까스로 고개를 조금 들고 보니 뿔이 길다랗고 눈이 불같이 붉은 사슴의 떼가 무엇에 놀랐는지 껑충껑충 뛰어 지나가오. 이것은 아마 크로포트킨의 <상호 부조론> 속에 말한 시베리아의 사슴의 떼가 꿈이 되어 나온 모양이오. +그러더니 그 사슴의 떼가 다 지나간 뒤에, 그 사슴의 떼가 오던 방향으로서 정임이가 걸어오는 것이 아니라 스르륵 하고 미끄러져 오오. 마치 인형을 밀어 주는 것같이. +"정임아!" +하고 나는 소리를 치고 몸을 일으키려 하였소. +정임의 모양은 나를 잠깐 보고는 미끄러지는 듯이 흘러가 버리오. +나는 정임아, 정임아를 부르고 팔다리를 부둥거렸소. 그러다가 마침내 내 몸이 번쩍 일으켜짐을 깨달았소. 나는 정임의 뒤를 따랐소. +나는 눈 위로 삼림 속으로 정임의 그림자를 따랐소. 보일 듯 안 보일 듯, 잡힐 듯 안 잡힐 듯, 나는 무거운 다리를 끌고 정임을 따랐소. +정임은 이 추운 날이언만 눈과 같이 흰 옷을 입었소. 그 옷은 옛날 로마 여인의 옷과 같이 바람결에 펄렁거렸소. +"오지 마세요. 저를 따라오지 못하십니다." +하고 정임은 눈보라 속에 가리워 버리고 말았소. 암만 불러도 대답이 없고 눈보라가 다 지나간 뒤에도 붉은 별, 푸른 별과 뿔 긴 사슴의 떼뿐이오. 정임은 보이지 아니하였소. 나는 미칠 듯이 정임을 찾고 부르다가 잠을 깨었소. +꿈은 이것뿐이오. 꿈을 깨어서 창 밖을 바라보니 얼음과 눈에 덮인 바이칼호 위에는 새벽의 겨울 달이 비치어 있었소. 저 멀리 검푸르게 보이는 것이 채 얼어붙지 아니한 물이겠지요. 오늘 밤에 바람이 없고 기온이 내리면 그것마저 얼어붙을는지 모르지요. 벌써 살얼음이 잡혔는지도 모르지요. 아아, 그 속은 얼마나 깊을까. 나는 바이칼의 물 속이 관심이 되어서 못 견디겠소. +형! 나는 자백하지 아니할 수 없소. 이 꿈은 내 마음의 어떤 부분을 설명한 것이라고. 그러나 형! 나는 이것을 부정하려오. 굳세게 부정하려오. 나는 이 꿈을 부정하려오. 억지로라도 부정하려오. 나는 결코 내 속에 일어난 혁명을 용인하지 아니하려오. 나는 그것을 혁명으로 인정하지 아니하려오. 아니오! 아니오! 그것은 반란이오! 내 인격의 통일에 대한 반란이오. 단연코 무단적으로 진정하지 아니하면 아니 될 반란이오. 보시오! 나는 굳게 서서 한 걸음도 뒤로 물러서지 아니할 것이오. 만일에 형이 광야에 구르는 내 시체나 해골을 본다든지, 또는 무슨 인연으로 내 무덤을 발견하는 날이 있다고 하면 그 때에 형은 내가 이 모든 반란을 진정한 개선의 군주로 죽은 것을 알아 주시오. +인제 바이칼에 겨울의 석양이 비치었소. 눈을 인 나지막한 산들이 지는 햇빛에 자줏빛을 발하고 있소. 극히 깨끗하고 싸늘한 광경이오. 아디유! +이 편지를 우편에 부치고는 나는 최후의 방랑의 길을 떠나오. 찾을 수도 없고, 편지 받을 수도 없는 곳으로. +부디 평안히 계시오. 일 많이 하시오. 부인께 문안 드리오. 내 가족과 정임의 일 맡기오. 아디유! +이것으로 최석 군의 편지는 끝났다. +나는 이 편지를 받고 울었다. 이것이 일 편의 소설이라 하더라도 슬픈 일이어든, 하물며 내가 가장 믿고 사랑하는 친구의 일임에야. +이 편지를 받고 나는 곧 최석 군의 집을 찾았다. 주인을 잃은 이 집에서는아이들이 마당에서 떠들고 있었다. +"삼청동 아자씨 오셨수. 어머니, 삼청동 아자씨." +하고 최석 군의 작은딸이 나를 보고 뛰어들어갔다. +최석의 부인이 나와 나를 맞았다. +부인은 머리도 빗지 아니하고, 얼굴에는 조금도 화장을 아니하고, 매무시도 흘러내릴 지경으로 정돈되지 못하였다. 일 주일이나 못 만난 동안에 부인의 모양은 더욱 초췌하였다. +"노석헌테서 무슨 기별이나 있습니까." +하고 나는 무슨 말로 말을 시작할지 몰라서 이런 말을 하였다. +"아니오. 왜 그이가 집에 편지하나요?" +하고 부인은 성난 빛을 보이며, +"집을 떠난 지가 근 사십 일이 되건만 엽서 한 장 있나요. 집안 식구가 다 죽기로 눈이나 깜짝할 인가요. 그저 정임이헌테만 미쳐서 죽을지 살지를 모르지요." +하고 울먹울먹한다. +"잘못 아십니다. 부인께서 노석의 마음을 잘못 아십니다. 그런 것이 아닙니다." +하고 나는 확신 있는 듯이 말을 시작하였다. +"노석의 생각을 부인께서 오해하신 줄은 벌써부터 알았지마는 오늘 노석의 편지를 받아보고 더욱 분명히 알았습니다." +하고 나는 부인의 표정의 변화를 엿보았다. +"편지가 왔어요?" +하고 부인은 놀라면서, +"지금 어디 있어요? 일본 있지요?" +하고 질투의 불길을 눈으로 토하였다. +"일본이 아닙니다. 노석은 지금 아라사에 있습니다." +"아라사요?" +하고 부인은 놀라는 빛을 보이더니, +"그럼 정임이를 데리고 아주 아라사로 가케오치를 하였군요." +하고 히스테리컬한 웃음을 보이고는 몸을 한 번 떨었다. +부인은 남편과 정임의 관계를 말할 때마다 이렇게 경련적인 웃음을 웃고 몸을 떠는 것이 버릇이었다. +"아닙니다. 노석은 혼자 가 있습니다. 그렇게 오해를 마세요." +하고 나는 보에 싼 최석의 편지를 내어서 부인의 앞으로 밀어 놓으며, +"이것을 보시면 다 아실 줄 압니다. 어쨌으나 노석은 결코 정임이를 데리고 간 것이 아니요, 도리어 정임이를 멀리 떠나서 간 것입니다. 그러나 그보다도 중대 문제가 있습니다. 노석은 이 편지를 보면 죽을 결심을 한 모양입니다." +하고 부인의 주의를 질투로부터 그 남편에게 대한 동정에 끌어 보려 하였다. +"흥. 왜요? 시체 정사를 하나요? 좋겠습니다. 머리가 허연 것이 딸자식 같은 계집애허구 정사를 한다면 그 꼴 좋겠습니다. 죽으라지요. 죽으래요. 죽는 것이 낫지요. 그리구 살아서 무엇 해요?" +내 뜻은 틀려 버렸다. 부인의 표정과 말에서는 더욱더욱 독한 질투의 안개와 싸늘한 얼음가루가 날았다. +나는 부인의 이 태도에 반감을 느꼈다. 아무리 질투의 감정이 강하다 하기로, 사람의 생명이 제 남편의 생명이 위태함에도 불구하고 오직 제 질투의 감정에만 충실하려 하는 그 태도가 불쾌하였다. 그래서 나는, +"나는 그만큼 말씀해 드렸으니 더 할 말씀은 없습니다. 아무려나 좀더 냉정하게 생각해 보세요. 그리고 이것을 읽어 보세요." +하고 일어나서 집으로 돌아와 버리고 말았다. +도무지 불쾌하기 그지없는 날이다. 최석의 태도까지도 불쾌하다. 달아나긴 왜 달아나? 죽기는 왜 죽어? 못난 것! 기운 없는 것! 하고 나는 최석이가 곁에 섰기나 한 것처럼 눈을 흘기고 중얼거렸다. +최석의 말대로 최석의 부인은 악한 사람이 아니요, 그저 보통인 여성일는지 모른다. 그렇다 하면 여자의 마음이란 너무도 질투의 종이 아닐까. 설사 남편 되는 최석의 사랑이 아내로부터 정임에게로 옮아 갔다고 하더라도 그것을 질투로 회복하려는 것은 어리석은 일이다. 이미 사랑이 떠난 남편을 네 마음대로 가거라 하고 자발적으로 내어버릴 것이지마는 그것을 못 할 사정이 있다고 하면 모르는 체하고 내버려 둘 것이 아닌가. 그래도 이것은 우리네 남자의 이론이요, 여자로는 이런 경우에 질투라는 반응밖에 없도록 생긴 것일까 나는 이런 생각을 하고 있었다. +시계가 아홉시를 친다. +남대문 밖 정거장을 떠나는 열차의 기적 소리가 들린다. +나는 만주를 생각하고, 시베리아를 생각하고 최석을 생각하였다. 마음으로는 정임을 사랑하면서 그 사랑을 발표할 수 없어서 시베리아의 눈 덮인 삼림 속으로 방황하는 최석의 모양이 최석의 꿈 이야기에 있는 대로 눈앞에 선하게 떠나온다. +`사랑은 목숨을 빼앗는다.' +하고 나는 사랑일래 일어나는 인생의 비극을 생각하였다. 그러나 최석의 경우는 보통 있는 공식과는 달라서 사랑을 죽이기 위해서 제 목숨을 죽이는 것이었다. 그렇다 하더라도, +`사랑은 목숨을 빼앗는다.' +는 데에는 다름이 없다. +나는 불쾌도 하고 몸도 으스스하여 얼른 자리에 누웠다. 며느리가 들어온 뒤부터 사랑 생활을 하는 지가 벌써 오 년이나 되었다. 우리 부처란 인제는 한 역사적 존재요, 윤리적 관계에 불과하였다. 오래 사귄 친구와 같은 익숙함이 있고, 집에 없지 못할 사람이라는 필요감도 있지마는 젊은 부처가 가지는 듯한 그런 정은 벌써 없는 지 오래였다. 아내도 나를 대하면 본체만체, 나도 아내를 대하면 본체만체, 무슨 필요가 있어서 말을 붙이더라도 아무쪼록 듣기 싫기를 원하는 듯이 톡톡 내던졌다. 아내도 근래에 와서는 옷도 아무렇게나, 머리도 아무렇게나, 어디 출입할 때밖에는 도무지 화장을 아니 하였다. +그러나 그렇다고 우리 부처의 새가 좋지 못한 것도 아니었다. 서로 소중히 여기는 마음도 있었다. 아내가 안에 있다고 생각하면 마음이 든든하고 또 아내의 말에 의하건대 내가 사랑에 있거니 하면 마음이 든든하다고 한다. +우리 부처의 관계는 이러한 관계다. +나는 한 방에서 혼자 잠을 자는 것이 습관이 되어서 누가 곁에 있으면 잠이 잘 들지 아니하였다. 혹시 어린것들이 매를 얻어맞고 사랑으로 피난을 와서 울다가 내 자리에서 잠이 들면 귀엽기는 귀여워도 잠자리는 편안치 아니하였다. 나는 책을 보고 글을 쓰고 공상을 하고 있으면 족하였다. 내게는 아무 애욕적 요구도 없었다. 이것은 내 정력이 쇠모한 까닭인지 모른다. +그러나 최석의 편지를 본 그 날 밤에는 도무지 잠이 잘 들지 아니하였다. 최석의 편지가 최석의 고민이 내 졸던 의식에 무슨 자극을 준 듯하였다. 적막한 듯하였다. 허전한 듯하였다. 무엇인지 모르나 그리운 것이 있는 것 같았다. +"어, 이거 안되었군." +하고 나는 벌떡 일어나 담배를 피워 물었다. +"나으리 주무셔 곕시오?" +하고 아범이 전보를 가지고 왔다. +"명조 경성 착 남정임" +이라는 것이었다. +"정임이가 와?" +하고 나는 전보를 다시 읽었다. +최석의 그 편지를 보면 최석 부인에게는 어떤 반응이 일어나고 정임에게는 어떤 반응이 일어날까, 하고 생각하면 자못 마음이 편하지 못하였다. +이튿날 아침에 나는 부산서 오는 차를 맞으려고 정거장에를 나갔다. +차는 제 시간에 들어왔다. 남정임은 슈트케이스 하나를 들고 차에서 내렸다. 검은 외투에 검은 모자를 쓴 그의 얼굴은 더욱 해쓱해 보였다. +"선생님!" +하고 정임은 나를 보고 손에 들었던 짐을 땅바닥에 내려놓고, 내 앞으로 왔다. +"풍랑이나 없었나?" +하고 나는 내 손에 잡힌 정임의 손이 싸늘한 것을 근심하였다. +"네. 아주 잔잔했습니다. 저같이 약한 사람도 밖에 나와서 바다 경치를 구경하였습니다." +하고 정임은 사교적인 웃음을 웃었다. 그러나 그의 눈에는 눈물이 있는 것 같았다. +"최 선생님 어디 계신지 아세요?" +하고 정임은 나를 따라 서면서 물었다. +"나도 지금까지 몰랐는데 어제 편지를 하나 받았지." +하는 것이 내 대답이었다. +"네? 편지 받으셨어요? 어디 계십니까?" +하고 정임은 걸음을 멈추었다. +"나도 몰라." +하고 나도 정임과 같이 걸음을 멈추고, +"그 편지를 쓴 곳도 알고 부친 곳도 알지마는 지금 어디로 갔는지 그것은 모르지. 찾을 생각도 말고 편지할 생각도 말라고 했으니까." +하고 사실대로 대답하였다. +"어디야요? 그 편지 부치신 곳이 어디야요? 저 이 차로 따라갈 테야요." +하고 정임은 조급하였다. +"갈 때에는 가더라도 이 차에야 갈 수가 있나." +하고 나는 겨우 정임을 끌고 들어왔다. +정임을 집으로 데리고 와서 대강 말을 하고, 이튿날 새벽 차로 떠난다는 것을, +"가만 있어. 어떻게 계획을 세워 가지고 해야지." +하여 가까스로 붙들어 놓았다. +아침을 먹고 나서 최석 집에를 가 보려고 할 즈음에 순임이가 와서 마루 끝에 선 채로, +"선생님, 어머니가 잠깐만 오십시사구요." +하였다. +"정임이가 왔다." +하고 내가 그러니까, +"정임이가요?" +하고 순임은 깜짝 놀라면서, +"정임이는 아버지 계신 데를 알아요?" +하고 물었다. +"정임이도 모른단다. 너 아버지는 시베리아에 계시고 정임이는 동경 있다가 왔는데 알 리가 있니?" +하고 나는 순임의 생각을 깨뜨리려 하였다. 순임은, +"정임이가 어디 있어요?" +하고 방들 있는 곳을 둘러보며, +"언제 왔어요?" +하고는 그제야 정임에게 대한 반가운 정이 발하는 듯이, +"정임아!" +하고 불러 본다. +"언니요? 여기 있수." +하고 정임이가 머릿방 문을 열고 옷을 갈아입던 채로 고개를 내어민다. +순임은 구두를 차내버리듯이 벗어 놓고 정임의 방으로 뛰어들어간다. +나는 최석의 집에를 가느라고 외투를 입고 모자를 쓰고 정임의 방문을 열어 보았다. 두 처녀는 울고 있었다. +"정임이도 가지. 아주머니 뵈러 안 가?" +하고 나는 정임을 재촉하였다. +"선생님 먼저 가 계셔요." +하고 순임이가 눈물을 씻고 일어나면서, +"이따가 제가 정임이허구 갑니다." +하고 내게 눈을 끔쩍거려 보였다. 갑자기 정임이가 가면 어머니와 정임이와 사이에 어떠한 파란이 일어나지나 아니할까 하고 순임이가 염려하는 것이었다. 순임도 인제는 노성하여졌다고 나는 생각하였다. +"선생님 이 편지가 다 참말일까요?" +하고 나를 보는 길로 최석 부인이 물었다. 최석 부인은 히스테리를 일으킨 사람 모양으로 머리와 손을 떨었다. +나는 참말이냐 하는 것이 무엇을 가리키는 말인지 분명하지 아니하여서, +"노석이 거짓말할 사람입니까?" +하고 대체론으로 대답하였다. +"앉으십쇼. 앉으시란 말씀도 안 하고." +하고 부인은 침착한 모양을 보이려고 빙그레 웃었으나, 그것은 실패였다. +"그게 참말일까요? 정임이가 아기를 뗀 것이 아니라, 폐가 나빠서 피를 토하고 입원하였다는 것이?" +하고 부인은 중대하다는 표정을 가지고 묻는다. +"그럼 그것이 참말이 아니구요. 아직도 그런 의심을 가지고 계십니까. 정임이와 한 방에 있는 학생이 모함한 것이라고 안 그랬어요? 그게 말이 됩니까." +하고 언성을 높여서 대답하였다. +"그럼 왜 정임이가 호텔에서 왜 아버지한테 한 번 안아 달라고 그래요? 그 편지에 쓴 대로 한 번 안아만 보았을까요?" +이것은 부인의 둘째 물음이었다. +"나는 그뿐이라고 믿습니다. 그것이 도리어 깨끗하다는 표라고 믿습니다. 안 그렇습니까?" +하고 나는 딱하다는 표정을 하였다. +"글쎄요." +하고 부인은 한참이나 생각하고 있다가, +"정말 애 아버지가 혼자 달아났을까요? 정임이를 데리고 가케오치한 것이 아닐까요? 꼭 그랬을 것만 같은데." +하고 부인은 괴로운 표정을 감추려는 듯이 고개를 숙인다. +나는 남편에게 대한 아내의 의심이 어떻게 깊은가에 아니 놀랄 수가 없어서, +"허." +하고 한 마디 웃고, +"그렇게 수십 년 동안 부부 생활을 하시고도 그렇게 노석의 인격을 몰라 주십니까. 나는 부인께서 하시는 말씀이 부러 하시는 농담으로밖에 아니 들립니다. 정임이가 지금 서울 있습니다." +하고 또 한 번 웃었다. 정말 기막힌 웃음이었다. +"정임이가 서울 있어요?" +하고 부인은 펄쩍 뛰면서, +"어디 있다가 언제 왔습니까? 그게 정말입니까?" +하고 의아한 빛을 보인다. 꼭 최석이하고 함께 달아났을 정임이가 서울에 있을 리가 없는 것이었다. +"동경서 오늘 아침에 왔습니다. 지금 우리 집에서 순임이허구 이야기를 하고 있으니까 조금 있으면 뵈오러 올 것입니다." +하고 나는 정임이가 분명히 서울 있는 것을 일일이 증거를 들어서 증명하였다. 그리고 우스운 것을 속으로 참았다. 그러나 다음 순간에는 이 병들고 늙은 아내의 질투와 의심으로 괴로워서 덜덜덜덜 떨고 앉았는 것을 가엾게 생각하였다. +정임이가 지금 서울에 있는 것이 더 의심할 여지가 없는 사실임이 판명되매, 부인은 도리어 낙망하는 듯하였다. 그가 제 마음대로 그려 놓고 믿고 하던 모든 철학의 계통이 무너진 것이었다. +한참이나 흩어진 정신을 못 수습하는 듯이 앉아 있더니 아주 기운 없는 어조로, +"선생님 애 아버지가 정말 죽을까요? 정말 영영 집에를 안 돌아올까요?" +하고 묻는다. 그 눈에는 벌써 눈물이 어리었다. +"글쎄요. 내 생각 같아서는 다시는 집에 돌아오지 아니할 것 같습니다. 또 그만치 망신을 했으니, 이제 무슨 낯으로 돌아옵니까. 내라도 다시 집에 돌아올 생각은 아니 내겠습니다." +하고 나는 의식적으로 악의를 가지고 부인의 가슴에 칼을 하나 박았다. +그 칼은 분명히 부인의 가슴에 아프게 박힌 모양이었다. +"선생님. 어떡하면 좋습니까. 애 아버지가 죽지 않게 해 주세요. 그렇지 않아도 순임이년이 제가 걔 아버지를 달아나게나 한 것처럼 원망을 하는데요. 그러다가 정녕 죽으면 어떻게 합니까. 제일 딴 자식들의 원망을 들을까봐 겁이 납니다. 선생님, 어떻게 애 아버지를 붙들어다 주세요." +하고 마침내 참을 수 없이 울었다. 말은 비록 자식들의 원망이 두렵다고 하지마는 질투의 감정이 스러질 때에 그에게는 남편에게 대한 아내의 애정이 막혔던 물과 같이 터져 나온 것이라고 나는 해석하였다. +"글쎄, 어디 있는 줄 알고 찾습니까. 노석의 성미에 한번 아니 한다고 했으면 다시 편지할 리는 만무하다고 믿습니다." +하여 나는 부인의 가슴에 둘째 칼날을 박았다. +나는 비록 최석의 부인이 청하지 아니하더라도 최석을 찾으러 떠나지 아니하면 아니 될 의무를 진다. 산 최석을 못 찾더라도 최석의 시체라도, 무덤이라도, 죽은 자리라도, 마지막 있던 곳이라도 찾아보지 아니하면 아니 될 의무를 깨닫는다. +그러나 시국이 변하여 그 때에는 아라사에 가는 것은 여간 곤란한 일이 아니었다. 그 때에는 북만의 풍운이 급박하여 만주리를 통과하기는 사실상 불가능에 가까웠다. 마점산(馬占山) 일파의 군대가 흥안령, 하일라르 등지에 웅거하여 언제 대충돌이 폭발될는지 모르던 때였다. 이 때문에 시베리아에 들어가기는 거의 절망 상태라고 하겠고, 또 관헌도 아라사에 들어가는 여행권을 잘 교부할 것 같지 아니하였다. +부인은 울고, 나는 이런 생각 저런 생각 하고 있는 동안에 문 밖에는 순임이, 정임이가 들어오는 소리가 들렸다. +"아이, 정임이냐." +하고 부인은 반갑게 허리 굽혀 인사하는 정임의 어깨에 손을 대고, +"자 앉아라. 그래 인제 병이 좀 나으냐…… 수척했구나. 더 노성해지구 반 년도 못 되었는데." +하고 정임에게 대하여 애정을 표하는 것을 보고 나는 의외지마는 다행으로 생각하였다. 나는 정임이가 오면 보기 싫은 한 신을 연출하지 않나 하고 근심하였던 것이다. +"희 잘 자라요?" +하고 정임은 한참이나 있다가 비로소 입을 열었다. +"응, 잘 있단다. 컸나 가 보아라." +하고 부인은 더욱 반가운 표정을 보인다. +"어느 방이야?" +하고 정임은 선물 보퉁이를 들고 순임과 함께 나가 버린다. 여자인 정임은 희와 순임과 부인과 또 순임의 다른 동생에게 선물 사 오는 것을 잊어버리지 아니하였다. +정임과 순임은 한 이삼 분 있다가 돌아왔다. 밖에서 희가 무엇이라고 지절대는 소리가 들린다. 아마 정임이가 사다 준 선물을 받고 좋아하는 모양이다. +정임은 들고 온 보퉁이에서 여자용 배스로브 하나를 내어서 부인에게주며, +"맞으실까?" +하였다. +"아이 그건 무어라고 사 왔니?" +하고 부인은 좋아라고 입어 보고, 이리 보고 저리 보고 하면서, +"난 이런 거 처음 입어 본다." +하고 자꾸 끈을 동여맨다. +"정임이가 난 파자마를 사다 주었어." +하고 순임은 따로 쌌던 굵은 줄 있는 융 파자마를 내어서 경매장 사람 모양으로 흔들어 보이며, +"어머니 그 배스로브 나 주우. 어머닌 늙은이가 그건 입어서 무엇 하우?" +하고 부인이 입은 배스로브를 벗겨서 제가 입고 두 호주머니에 손을 넣고 어기죽어기죽하고 서양 부인네 흉내를 낸다. +"저런 말괄량이가 너도 정임이처럼 좀 얌전해 보아라." +하고 부인은 순임을 향하여 눈을 흘긴다. +이 모양으로 부인과 정임과의 대면은 가장 원만하게 되었다. +그러나 부인은 정임에게 최석의 편지를 보이기를 원치 아니하였다. 편지가 왔다는 말조차 입 밖에 내지 아니하였다. 그러나 순임이가 정임에게 대하여 표하는 애정은 여간 깊지 아니하였다. 그 둘은 하루 종일 같이 있었다. 정임은 그 날 저녁에 나를 보고, +"순임이헌테 최 선생님 편지 사연은 다 들었어요. 순임이가 그 편지를 훔쳐다가 얼른얼른 몇 군데 읽어도 보았습니다. 순임이가 저를 퍽 동정하면서 절더러 최 선생을 따라가 보라고 그래요. 혼자 가기가 어려우면 자기허구 같이 가자고. 가서 최 선생을 데리고 오자고. 어머니가 못 가게 하거든 몰래 둘이 도망해 가자고. 그래서 그러자고 그랬습니다. 안됐지요. 선생님?" +하고 저희끼리 작정은 다 해 놓고는 슬쩍 내 의향을 물었다. +"젊은 여자 단둘이서 먼 여행을 어떻게 한단 말이냐? 게다가 지금 북만주 형세가 대단히 위급한 모양인데. 또 정임이는 그 건강 가지고 어디를 가, 이 추운 겨울에?" +하고 나는 이런 말이 다 쓸데없는 말인 줄 알면서도 어른으로서 한 마디 안 할 수 없어서 하였다. 정임은 더 제 뜻을 주장하지도 아니하였다. +그 날 저녁에 정임은 순임의 집에서 잤는지 집에 오지를 아니하였다. +나는 이 일을 어찌하면 좋은가, 이 두 여자의 행동을 어찌하면 좋은가 하고 혼자 끙끙 생각하고 있었다. +이튿날 나는 궁금해서 최석의 집에를 갔더니 부인이, +"우리 순임이 댁에 갔어요?" +하고 의외의 질문을 하였다. +"아니오." +하고 나는 놀랐다. +"그럼, 이것들이 어딜 갔어요? 난 정임이허구 댁에서 잔 줄만 알았는데." +하고 부인은 무슨 불길한 것이나 본 듯이 몸을 떤다. 히스테리가 일어난 것이었다. +나는 입맛을 다시었다. 분명히 이 두 여자가 시베리아를 향하고 떠났구나 하였다. +그 날은 소식이 없이 지났다. 그 이튿날도 소식이 없이 지났다. +최석 부인은 딸까지 잃어버리고 미친 듯이 울고 애통하다가 머리를 싸매고 누워 버리고 말았다. +정임이와 순임이가 없어진 지 사흘 만에 아침 우편에 편지 한 장을 받았다. 그 봉투는 봉천 야마도 호텔 것이었다. 그 속에는 편지 두 장이 들어 있었다. 한 장은 , +선생님! 저는 아버지를 위하여, 정임을 위하여 정임과 같이 집을 떠났습니다. +어머님께서 슬퍼하실 줄은 알지마는 저희들이 다행히 아버지를 찾아서 모시고 오면 어머니께서도 기뻐하실 것을 믿습니다. 저희들이 가지 아니하고는 아버지는 살아서 돌아오실 것 같지 아니합니다. 아버지를 이처럼 불행하시게 한 죄는 절반은 어머니께 있고, 절반은 제게 있습니다. 저는 아버지 일을 생각하면 가슴이 미어지고 이가 갈립니다. 저는 아무리 해서라도 아버지를 찾아내어야겠습니다. +저는 정임을 무한히 동정합니다. 저는 어려서 정임을 미워하고 아버지를 미워하였지마는 지금은 아버지의 마음과 정임의 마음을 알아볼 만치 자랐습니다. +선생님! 저희들은 둘이 손을 잡고 어디를 가서든지 아버지를 찾아내겠습니다. 하나님의 사자가 낮에는 구름이 되고 밤에는 별이 되어서 반드시 저희들의 앞길을 인도할 줄 믿습니다. +선생님, 저희 어린것들의 뜻을 불쌍히 여기셔서 돈 천 원만 전보로 보내 주시기를 바랍니다. +만일 만주리로 가는 길이 끊어지면 몽고로 자동차로라도 가려고 합니다. 아버지 편지에 적힌 F역의 R씨를 찾고, 그리고 바이칼 호반의 바이칼리스코에를 찾아, 이 모양으로 찾으면 반드시 아버지를 찾아 내고야 말 것을 믿습니다. +선생님, 돈 천 원만 봉천 야마도 호텔 최순임 이름으로 부쳐 주세요. 그리고 어머니헌테는 아직 말씀 말아 주세요. +선생님. 이렇게 걱정하시게 해서 미안합니다. 용서하세요. +순임 상서 +이렇게 써 있다. 또 한 장에는, +선생님! 저는 마침내 돌아오지 못할 길을 떠나나이다. 어디든지 최 선생님을 뵈옵는 곳에서 이 몸을 묻어 버리려 하나이다. 지금 또 몸에 열이 나는 모양이요, 혈담도 보이오나 최 선생을 뵈올 때까지는 아무리 하여서라도 이 목숨을 부지하려 하오며, 최 선생을 뵈옵고 제가 진 은혜를 감사하는 한 말씀만 사뢰면 고대 죽사와도 여한이 없을까 하나이다. +순임 언니가 제게 주시는 사랑과 동정은 오직 눈물과 감격밖에 더 표할 말씀이 없나이다. 순임 언니가 저를 보호하여 주니 마음이 든든하여이다……. +이라고 하였다. +편지를 보아야 별로 놀랄 것은 없었다. 다만 말괄량이로만 알았던 순임의 속에 어느새에 그러한 감정이 발달하였나 하는 것을 놀랄 뿐이었다. +그러나 걱정은 이것이다. 순임이나 정임이나 다 내가 감독해야 할 처지에 있거늘 그들이 만리 긴 여행을 떠난다고 하니 감독자인 내 태도를 어떻게 할까 하는 것이다. +나는 편지를 받는 길로 우선 돈 천 원을 은행에 가서 찾아다 놓았다. +암만해도 내가 서울에 가만히 앉아서 두 아이에게 돈만 부쳐 주는 것이 인정에 어그러지는 것 같아서 나는 여러 가지로 주선을 하여서 여행의 양해를 얻어 가지고 봉천을 향하여 떠났다. +내가 봉천에 도착한 것은 밤 열시가 지나서였다. 순임과 정임은 자리옷 바람으로 내 방으로 달려와서 반가워하였다. 그들이 반가워하는 양은 실로 눈물이 흐를 만하였다. +"아이구 선생님!" +"아이구 어쩌면!" +하는 것이 그들의 내게 대한 인사의 전부였다. +"정임이 어떠오?" +하고 나는 순임의 편지에 정임이가 열이 있단 말을 생각하였다. +"무어요. 괜찮습니다." +하고 정임은 웃었다. +전등빛에 보이는 정임의 얼굴은 그야말로 대리석으로 깎은 듯하였다. 여위고 핏기가 없는 것이 더욱 정임의 용모에 엄숙한 맛을 주었다. +"돈 가져오셨어요?" +하고 순임이가 어리광 절반으로 묻다가 내가 웃고 대답이 없음을 보고, +"우리를 붙들러 오셨어요?" +하고 성내는 양을 보인다. +"그래 둘이서들 간다니 어떻게 간단 말인가. 시베리아가 어떤 곳에 붙었는지 알지도 못하면서." +하고 나는 두 사람이 그리 슬퍼하지 아니하는 순간을 보는 것이 다행하여서 농담삼아 물었다. +"왜 몰라요? 시베리아가 저기 아니야요?" +하고 순임이가 산해관 쪽을 가리키며, +"우리도 지리에서 배워서 다 알아요. 어저께 하루 종일 지도를 사다 놓고 연구를 하였답니다. 봉천서 신경, 신경서 하얼빈, 하얼빈에서 만주리, 만주리에서 이르쿠츠크, 보세요, 잘 알지 않습니까. 또 만일 중동 철도가 불통이면 어떻게 가는고 하니 여기서 산해관을 가고, 산해관서 북경을 가지요. 그리고는 북경서 장가구를 가지 않습니까. 장가구서 자동차를 타고 몽고를 통과해서 가거든요. 잘 알지 않습니까." +하고 정임의 허리를 안으며, +"그렇지이?" +하고 자신 있는 듯이 웃는다. +"또 몽고로도 못 가게 되어서 구라파를 돌게 되면?" +하고 나는 교사가 생도에게 묻는 모양으로 물었다. +"네, 저 인도양으로 해서 지중해로 해서 프랑스로 해서 그렇게 가지요." +"허, 잘 아는구나." +하고 나는 웃었다. +"그렇게만 알아요? 또 해삼위로 해서 가는 길도 알아요. 저희를 어린애로 아시네." +"잘못했소." +"하하." +"후후." +사실 그들은 벌써 어린애들은 아니었다. 순임도 벌써 그 아버지의 말할 수 없는 사정에 동정할 나이가 되었다. 순임이가 기어다닌 것은 본 나로는 이것도 이상하게 보였다. 나는 벌써 나이 많았구나 하는 생각이 나지 아니할 수 없었다. +나는 잠 안 드는 하룻밤을 지내면서 옆방에서 정임이가 기침을 짓는 소리를 들었다. 그 소리는 내 가슴을 아프게 하였다. +이튿날 나는 두 사람에게 돈 천 원을 주어서 신경 가는 급행차를 태워 주었다. 대륙의 이 건조하고 추운 기후에 정임의 병든 폐가 견디어 날까 하고 마음이 놓이지 아니하였다. 그러나 나는 그들을 가라고 권할 수는 있어도 가지 말라고 붙들 수는 없었다. 다만 제 아버지, 제 애인을 죽기 전에 만날 수 있기만 빌 뿐이었다. +나는 두 아이를 북쪽으로 떠나 보내고 혼자 여관에 들어와서 도무지 정신을 진정하지 못하여 술을 먹고 잊으려 하였다. 그러다가 그 날 밤차로 서울로 돌아왔다. +이튿날 아침에 나는 최석 부인을 찾아서 순임과 정임이가 시베리아로 갔단 말을 전하였다. +그 때에 최 부인은 거의 아무 정신이 없는 듯하였다. 아무 말도 하지 아니하고 울고만 있었다. +얼마 있다가 부인은, +"그것들이 저희들끼리 가서 괜찮을까요?" +하는 한 마디를 할 뿐이었다. +며칠 후에 순임에게서 편지가 왔다. 그것은 하얼빈에서 부친 것이었다. +하얼빈을 오늘 떠납니다. 하얼빈에 와서 아버지 친구 되시는 R소장을 만나뵈옵고 아버지 일을 물어 보았습니다. 그리고 저희 둘이서 찾아 떠났다는 말씀을 하였더니 R소장이 대단히 동정하여서 여행권도 준비해 주시기로 저희는 아버지를 찾아서 오늘 오후 모스크바 가는 급행으로 떠납니다. 가다가 F역에 내리기는 어려울 듯합니다. 정임의 건강이 대단히 좋지 못합니다. 일기가 갑자기 추워지는 관계인지 정임의 신열이 오후면 삼십팔 도를 넘고 기침도 대단합니다. 저는 염려가 되어서 정임더러 하얼빈에서 입원하여 조리를 하라고 권하였지마는 도무지 듣지를 아니합니다. 어디까지든지 가는 대로 가다가 더 못 가게 되면 그 곳에서 죽는다고 합니다. +저는 그 동안 며칠 정임과 같이 있는 중에 정임이가 어떻게 아름답고 높고 굳세게 깨끗한 여자인 것을 발견하였습니다. 저는 지금까지 정임을 몰라본 것을 부끄럽게 생각합니다. 그리고 또 제 아버지께서 어떻게 갸륵한 어른이신 것을 인제야 깨달았습니다. 자식 된 저까지도 아버지와 정임과의 관계를 의심하였습니다. 의심하는 것보다는 세상에서 말하는 대로 믿고 있었습니다. 그러나 정임을 만나 보고 정임의 말을 듣고 아버지께서 선생님께 드린 편지가 모두 참인 것을 깨달았습니다. 아버지께서는 친구의 의지 없는 딸인 정임을 당신의 친혈육인 저와 꼭 같이 사랑하려고 하신 것이었습니다. 그것이 얼마나 갸륵한 일입니까. 그런데 제 어머니와 저는 그 갸륵하신 정신을 몰라보고 오해하였습니다. 어머니는 질투하시고 저는 시기하였습니다. 이것이 얼마나 아버지를 그렇게 갸륵하신 아버지를 몰라뵈온 것입니다. 이것이 얼마나 부끄럽고 원통한 일입니까. +선생님께서도 여러 번 아버지의 인격이 높다는 것을 저희 모녀에게 설명해 주셨습니다마는 마음이 막힌 저는 선생님의 말씀도 믿지 아니하였습니다. +선생님, 정임은 참으로 아버지를 사랑합니다. 정임에게는 이 세상에 아버지밖에는 사랑하는 아무것도 없이, 그렇게 외●으로, 그렇게 열렬하게 아버지를 사모하고 사랑합니다. 저는 잘 압니다. 정임이가 처음에는 아버지로 사랑하였던 것을, 그러나 어느 새에 정임의 아버지에게 대한 사랑이 무엇인지 모를 사랑으로 변한 것을, 그것이 연애냐 하고 물으면 정임은 아니라고 할 것입니다. 정임의 그 대답은 결코 거짓이 아닙니다. 정임은 숙성하지마는 아직도 극히 순결합니다. 정임은 부모를 잃은 후에 아버지밖에 사랑한 사람이 없습니다. 또 아버지에게밖에 사랑받던 일도 없습니다. 그러니깐 정임은 아버지를 그저 사랑합니다 전적으로 사랑합니다. 선생님, 정임의 사랑에는 아버지에 대한 자식의 사랑, 오라비에 대한 누이의 사랑, 사내 친구에 대한 여자 친구의 사랑, 애인에 대한 애인의 사랑, 이 밖에 존경하고 숭배하는 선생에 대한 제자의 사랑까지, 사랑의 모든 종류가 포함되어 있는 것을 저는 발견하였습니다. +선생님, 정임의 정상은 차마 볼 수가 없습니다. 아버지의 안부를 근심하는 양은 제 몇십 배나 되는지 모르게 간절합니다. 정임은 저 때문에 아버지가 불행하게 되셨다고 해서 차마 볼 수 없게 애통하고 있습니다. 진정을 말씀하오면 저는 지금 아버지보다도 어머니보다도 정임에게 가장 동정이 끌립니다. 선생님, 저는 아버지를 찾아가는 것이 아니라 정임을 돕기 위하여 간호하기 위하여 가는 것 같습니다. +선생님, 저는 아직 사랑이란 것이 무엇인지를 모릅니다. 그러나 정임을 보고 사랑이란 것이 어떻게 신비하고 열렬하고 놀라운 것인가를 안 것 같습니다. +순임의 편지는 계속된다. +선생님, 하얼빈에 오는 길에 송화강 굽이를 볼 때에는 정임이가 어떻게나 울었는지, 그것은 차마 볼 수가 없었습니다. 아버지께서 송화강을 보시고 감상이 깊으셨더란 것을 생각한 것입니다. 무인지경으로, 허옇게 눈이 덮인 벌판으로 흘러가는 송화강 굽이, 그것은 슬픈 풍경입니다. 아버지께서 여기를 지나실 때에는 마른 풀만 있는 광야였을 것이니 그 때에는 더욱 황량하였을 것이라고 정임은 말하고 웁니다. +정임은 제가 아버지를 아는 것보다 아버지를 잘 아는 것 같습니다. 평소에 아버지와는 그리 접촉이 없건마는 정임은 아버지의 의지력, 아버지의 숨은 열정, 아버지의 성미까지 잘 압니다. 저는 정임의 말을 듣고야 비로소 참 그래, 하는 감탄을 발한 일이 여러 번 있습니다. +정임의 말을 듣고야 비로소 아버지가 남보다 뛰어나신 인물인 것을 깨달았습니다. 아버지는 정의감이 굳세고 겉으로는 싸늘하도록 이지적이지마는 속에는 불 같은 열정이 있으시고, 아버지는 쇠 같은 의지력과 칼날 같은 판단력이 있어서 언제나 주저하심이 없고 또 흔들리심이 없다는 것, 아버지께서는 모든 것을 용서하고 모든 것을 호의로 해석하여서 누구를 미워하거나 원망하심이 없는 등, 정임은 아버지의 마음의 목록과 설명서를 따로 외우는 것처럼 아버지의 성격을 설명합니다. 듣고 보아서 비로소 아버지의 딸인 저는 내 아버지가 어떤 아버지인가를 알았습니다. +선생님, 이해가 사랑을 낳는단 말씀이 있지마는 저는 정임을 보아서 사랑이 이해를 낳는 것이 아닌가 합니다. +어쩌면 어머니와 저는 평생을 아버지를 모시고 있으면서도 아버지를 몰랐습니까. 이성이 무디고 양심이 흐려서 그랬습니까. 정임은 진실로 존경할 여자입니다. 제가 남자라 하더라도 정임을 아니 사랑하고는 못 견디겠습니다. +아버지는 분명 정임을 사랑하신 것입니다. 처음에는 친구의 딸로, 다음에는 친딸과 같이, 또 다음에는 무엇인지 모르게 뜨거운 사랑이 생겼으리라고 믿습니다. 그것을 아버지는 죽인 것입니다. 그것을 죽이려고 이 달할 수 없는 사랑을 죽이려고 시베리아로 달아나신 것입니다. 인제야 아버지께서 선생님께 하신 편지의 뜻이 알아진 것 같습니다. 백설이 덮인 시베리아의 삼림 속으로 혼자 헤매며 정임에게로 향하는 사랑을 죽이려고 무진 애를 쓰시는 그 심정이 알아지는 것 같습니다. +선생님 이것이 얼마나 비참한 일입니까. 저는 정임의 짐에 지니고 온 일기를 보다가 이러한 구절을 발견하였습니다. +선생님. 저는 세인트 오거스틴의 <참회록>을 절반이나 다 보고 나도 잠이 들지 아니합니다. 잠이 들기 전에 제가 항상 즐겨하는 아베마리아의 노래를 유성기로 듣고 나서 오늘 일기를 쓰려고 하니 슬픈 소리만 나옵니다. +사랑하는 어른이여. 저는 멀리서 당신을 존경하고 신뢰하는 마음에서만 살아야 할 것을 잘 압니다. 여기에서 영원한 정지를 하지 아니하면 아니 됩니다. 비록 제 생명이 괴로움으로 끊어지고 제 혼이 피어 보지 못하고 스러져 버리더라도 저는 이 멀리서 바라보는 존경과 신뢰의 심경에서 한 발자국이라도 옮기지 않아야 할 것을 잘 압니다. 나를 위하여 놓여진 생의 궤도는 나의 생명을 부인하는 억지의 길입니다. 제가 몇 년 전 기숙사 베드에서 이런 밤에 내다보면 즐겁고 아름답던 내 생의 꿈은 다 깨어졌습니다. +제 영혼의 한 조각이 먼 세상 알지 못할 세계로 떠다니고 있습니다. 잃어버린 마음 조각 어찌하다가 제가 이렇게 되었는지 모릅니다. +피어 오르는 생명의 광채를 스스로 사형에 처하지 아니하면 아니 될 때 어찌 슬픔이 없겠습니까. 이것은 현실로 사람의 생명을 죽이는 것보다 더 무서운 죄가 아니오리까. 나의 세계에서 처음이요 마지막으로 발견한 빛을 어둠 속에 소멸해 버리라는 이 일이 얼마나 떨리는 직무오리까. 이 허깨비의 형의 사람이 살기 위하여 내 손으로 칼을 들어 내 영혼의 환희를 쳐야 옳습니까. 저는 하나님을 원망합니다. +이렇게 씌어 있습니다. 선생님 이것이 얼마나 피 흐르는 고백입니까. +선생님, 저는 정임의 이 고백을 보고 무조건으로 정임의 사랑을 시인합니다. 선생님, 제 목숨을 바쳐서 하는 일에 누가 시비를 하겠습니까. 더구나 그 동기에 티끌만큼도 불순한 것이 없음에야 무조건으로 시인하지 아니하고 어찌합니까. +바라기는 정임의 병이 크게 되지 아니하고 아버지께서 무사히 계셔서 속히 만나뵙게 되는 것입니다마는 앞길이 망망하여 가슴이 두근거림을 금치 못합니다. 게다가 오늘은 함박눈이 퍼부어서 천지가 온통 회색으로 한 빛이 되었으니 더욱 전도가 막막합니다. 그러나 선생님 저는 앓는 정임을 데리고 용감하게 시베리아 길을 떠납니다. +한 일 주일 후에 또 편지 한 장이 왔다. 그것도 순임의 편지여서 이러한 말이 있었다. +……오늘 새벽에 흥안령을 지났습니다. 플랫폼의 한란계는 영하 이십삼 도를 가리켰습니다. 사람들의 얼굴은 솜털에 성에가 슬어서 남녀 노소 할 것 없이 하얗게 분을 바른 것 같습니다. 유리에 비친 내 얼굴도 그와 같이 흰 것을 보고 놀랐습니다. 숨을 들이쉴 때에는 코털이 얼어서 숨이 끊기고 바람결이 지나가면 눈물이 얼어서 눈썹이 마주 붙습니다. 사람들은 털과 가죽에 싸여서 곰같이 보입니다. +또 이런 말도 있었다. +아라사 계집애들이 우유병들을 품에 품고 서서 손님이 사기를 기다리고 있습니다. 저도 두 병을 사서 정임이와 나누어 먹었습니다. 우유는 따뜻합니다. 그것을 식히지 아니할 양으로 품에 품고 섰던 것입니다. +또 이러한 구절도 있었다. +정거장에 닿을 때마다 저희들은 밖을 내다봅니다. 행여나 아버지가 거기 계시지나 아니할까 하고요. 차가 어길 때에는 더구나 마음이 조입니다. 아버지가 그 차를 타고 지나가시지나 아니하는가 하고요. 그리고는 정임은 웁니다. 꼭 뵈올 어른을 놓쳐나 버린 듯이. +그리고는 이 주일 동안이나 소식이 없다가 편지 한 장이 왔다. 그것은 정임의 글씨였다. +선생님, 저는 지금 최 선생께서 계시던 바이칼 호반의 그 집에 와서 홀로 누웠습니다. 순임은 주인 노파와 함께 F역으로 최 선생을 찾아서 오늘 아침에 떠나고 병든 저만 혼자 누워서 얼음에 싸인 바이칼 호의 눈보라치는 바람 소리를 듣고 있습니다. 열은 삼십팔 도로부터 구 도 사이를 오르내리고 기침은 나고 몸의 괴로움을 견딜 수 없습니다. 그러하오나 선생님, 저는 하나님을 불러서 축원합니다. 이 실낱 같은 생명이 다 타 버리기 전에 최 선생의 낯을 다만 일 초 동안이라도 보여지이라고. 그러하오나 선생님, 이 축원이 이루어지겠습니까. +저는 한사코 F역까지 가려 하였사오나 순임 형이 울고 막사오며 또 주인 노파가 본래 미국 사람과 살던 사람으로 영어를 알아서 순임 형의 도움이 되겠기로 저는 이 곳에 누워 있습니다. 순임 형은 기어코 아버지를 찾아 모시고 오마고 약속하였사오나 이 넓은 시베리아에서 어디 가서 찾겠습니까. +선생님, 저는 죽음을 봅니다. 죽음이 바로 제 앞에 와서 선 것을 봅니다. 그의 손은 제 여윈 손을 잡으려고 들먹거림을 봅니다. +선생님, 죽은 뒤에도 의식이 남습니까. 만일 의식이 남는다 하면 죽은 뒤에도 이 아픔과 괴로움을 계속하지 아니하면 아니 됩니까. 죽은 뒤에는 오직 영원한 어둠과 잊어버림이 있습니까. 죽은 뒤에는 혹시나 생전에 먹었던 마음을 자유로 펼 도리가 있습니까. 이 세상에서 그립고 사모하던 이를 죽은 뒤에는 자유로 만나 보고 언제나 마음껏 같이할 수가 있습니까. 그런 일도 있습니까. 이런 일을 바라는 것도 죄가 됩니까. +정임의 편지는 더욱 절망적인 어조로 찬다. +저는 처음 병이 났을 때에는 죽는 것이 싫고 무서웠습니다. 그러나 지금은 죽는 것이 조금도 무섭지 아니합니다. 다만 차마 죽지 못하는 것이 한. +하고는 `다만 차마' 이하를 박박 지워 버렸다. 그리고는 새로 시작하여 나와내 가족에게 대한 문안을 하고는 끝을 막았다. +나는 이 편지를 받고 울었다. 무슨 큰 비극이 가까운 것을 예상하게 하였다. +그 후 한 십여 일이나 지나서 전보가 왔다. 그것은 영문으로 씌었는데, +"아버지 병이 급하다. 나로는 어쩔 수 없다. 돈 가지고 곧 오기를 바란다." +하고 그 끝에 B호텔이라고 주소를 적었다. 전보 발신국이 이르쿠츠크인 것을 보니 B호텔이라 함은 이르쿠츠크인 것이 분명하였다. +나는 최석 부인에게 최석이가 아직 살아 있다는 것을 전하고 곧 여행권 수속을 하였다. 절망으로 알았던 여행권은 사정이 사정인만큼 곧 발부되었다. +나는 비행기로 여의도를 떠났다. 백설에 개개한 땅을, 남빛으로 푸른 바다를 굽어보는 동안에 대련을 들러 거기서 다른 비행기를 갈아타고 봉천, 신경, 하얼빈을 거쳐, 치치하얼에 들렀다가 만주리로 급행하였다. +웅대한 대륙의 설경도 나에게 아무러한 인상도 주지 못하였다. 다만 푸른 하늘과 희고 평평한 땅과의 사이로 한량 없이 허공을 날아간다는 생각밖에 없었다. 그것은 사랑하는 두 친구가 목숨이 경각에 달린 것을 생각할 때에 마음에 아무 여유도 없는 까닭이었다. +만주리에서도 비행기를 타려 하였으나 소비에트 관헌이 허락을 아니 하여 열차로 갈 수밖에 없었다. +초조한 몇 밤을 지나고 이르쿠츠크에 내린 것이 오전 두시. 나는 B호텔로 이스보스치카라는 마차를 몰았다. 죽음과 같이 고요하게 눈 속에 자는 시간에는 여기저기 전등이 반짝거릴 뿐, 이따금 밤의 시가를 경계하는 병정들의 눈이 무섭게 빛나는 것이 보였다. +B호텔에서 미스 초이(최 양)를 찾았으나 순임은 없고 어떤 서양 노파가 나와서, +"유 미스터 Y?" +하고 의심스러운 눈으로 나를 보았다. +그렇다는 내 대답을 듣고는 노파는 반갑게 손을 내밀어서 내 손을 잡았다. +나는 넉넉하지 못한 영어로 그 노파에게서 최석이가 아직 살았다는 말과 정임의 소식은 들은 지 오래라는 말과 최석과 순임은 여기서 삼십 마일이나 떨어진 F역에서도 썰매로 더 가는 삼림 속에 있다는 말을 들었다. +나는 그 밤을 여기서 지내고 이튿날 아침에 떠나는 완행차로 그 노파와 함께 이르쿠츠크를 떠났다. +이 날도 천지는 오직 눈뿐이었다. 차는 가끔 삼림 중으로 가는 모양이나 모두 회색빛에 가리워서 분명히 보이지를 아니하였다. +F역이라는 것은 삼림 속에 있는 조그마한 정거장으로 집이라고는 정거장 집밖에 없었다. 역부 두엇이 털옷에 하얗게 눈을 뒤쓰고 졸리는 듯이 오락가락할 뿐이었다. +우리는 썰매 하나를 얻어 타고 어디가 길인지 분명치도 아니한 눈 속으로 말을 몰았다. +바람은 없는 듯하지마는 그래도 눈발을 한편으로 비끼는 모양이어서 아름드리 나무들의 한쪽은 하얗게 눈으로 쌓이고 한쪽은 검은 빛이 더욱 돋보였다. 백 척은 넘을 듯한 꼿꼿한 침엽수(전나무 따윈가)들이 어디까지든지, 하늘에서 곧 내려박은 못 모양으로, 수없이 서 있는 사이로 우리 썰매는 간다. 땅에 덮인 눈은 새로 피워 놓은 솜같이 희지마는 하늘에서 내리는 눈은 구름빛과 공기빛과 어울려서 밥 잦힐 때에 굴뚝에서 나오는 연기와 같이 연회색이다. +바람도 불지 아니하고 새도 날지 아니하건마는 나무 높은 가지에 쌓인 눈이 이따금 덩치로 떨어져서는 고요한 수풀 속에 작은 동요를 일으킨다. +우리 썰매가 가는 길이 자연스러운 복잡한 커브를 도는 것을 보면 필시 얼음 언 개천 위로 달리는 모양이었다. +한 시간이나 달린 뒤에 우리 썰매는 늦은 경사지를 올랐다. 말을 어거하는 아라사 사람은 쭈쭈쭈쭈, 후르르 하고 주문을 외우듯이 입으로 말을 재촉하고 고삐를 이리 들고 저리 들어 말에게 방향을 가리킬 뿐이요, 채찍은 보이기만하고 한 번도 쓰지 아니하였다. 그와 말과는 완전히 뜻과 정이 맞는 동지인 듯하였다. +처음에는 몰랐으나 차차 추워짐을 깨달았다. 발과 무르팍이 시렸다. +"얼마나 머오?" +하고 나는 오래간만에 입을 열어서 노파에게 물었다. 노파는 털수건으로 머리를 싸매고 깊숙한 눈만 남겨 가지고 실신한 사람 모양으로 허공만 바라보고 있다가, 내가 묻는 말에 비로소 잠이나 깬 듯이, +"멀지 않소. 인젠 한 십오 마일." +하고는 나를 바라보았다. 그 눈은 아마 웃는 모양이었다. +그 얼굴, 그 눈, 그 음성이 모두 이 노파가 인생 풍파의 슬픈 일 괴로운 일에 부대끼고 지친 것을 표하였다. 그리고 죽는 날까지 살아간다 하는 듯하였다. +경사지를 올라서서 보니 그것은 한 산등성이였다. 방향은 알 수 없으나 우리가 가는 방향에는 더 높은 등성이가 있는 모양이나 다른 곳은 다 이보다 낮은 것 같아서 하얀 눈바다가 끝없이 보이는 듯하였다. 그 눈보라는 들쑹날쑹이 있는 것을 보면 삼림의 꼭대기인 것이 분명하였다. 더구나 여기저기 뾰족뾰족 눈송이 붙을 수 없는 마른 나뭇가지가 거뭇거뭇 보이는 것을 보아서 그러하였다. 만일 눈이 걷혀 주었으면 얼마나 안계가 넓으랴, 최석 군이 고민하는 가슴을 안고 이리로 헤매었구나 하면서 나는 목을 둘러서 사방을 바라보았다. +우리는 그 등성이를 내려갔다. 말이 미처 발을 땅에 놓을 수가 없는 정도로 빨리 내려갔다. 여기는 산불이 났던 자리인 듯하여 거뭇거뭇 불탄 자국 있는 마른 나무들이 드문드문 서 있었다. 그 나무들은 찍어 가는 사람도 없으매 저절로 썩어서 없어지기를 기다릴 수밖에 없었다. 그들은 나서 아주 썩어 버리기까지 천 년 이상은 걸린다고 하니 또한 장한 일이다. +이 대삼림에 불이 붙는다 하면 그것은 장관일 것이다. 달밤에 높은 곳에서 이 경치를 내려다본다 하면 그도 장관일 것이요, 여름에 한창 기운을 펼 때도 장관일 것이다. 나는 오뉴월경에 시베리아를 여행하는 이들이 끝없는 꽃바다를 보았다는 기록을 생각하였다. +"저기요!" +하는 노파의 말에 나는 생각의 줄을 끊었다. 저기라고 가리키는 곳을 보니 거기는 집이라고 생각되는 물건이 나무 사이로 보였다. 창이 있으니 분명 집이었다. +우리 이스보스치카가 가까이 오는 것을 보았는지, 그 집 같은 물건의 문 같은 것이 열리며 검은 외투 입은 여자 하나가 팔을 허우적거리며 뛰어나온다. 아마 소리도 치는 모양이겠지마는 그 소리는 아니 들렸다. 나는 그것이 순임인 줄을 얼른 알았다. 또 순임이밖에 될 사람도 없었다. +순임은 한참 달음박질로 오다가 눈이 깊어서 걸음을 걷기가 힘이 드는지 멈칫 섰다. 그의 검은 외투는 어느덧 흰 점으로 얼려져 가지고 어깨는 희게 되는 것이 보였다. +순임의 갸름한 얼굴이 보였다. +"선생님!" +하고 순임도 나를 알아보고는 또 팔을 허우적거리며 소리를 질렀다. +나도 반가워서 모자를 벗어 둘렀다. +"아이 선생님!" +하고 순임은 내가 썰매에서 일어서기도 전에 내게 와서 매달리며 울었다. +"아버지 어떠시냐?" +하고 나는 순임의 등을 두드렸다. 나는 다리가 마비가 되어서 곧 일어설 수가 없었다. +"아버지 어떠시냐?" +하고 나는 한 번 더 물었다. +순임은 벌떡 일어나 두 주먹으로 흐르는 눈물을 쳐내 버리며, +"대단하셔요." +하고도 울음을 금치 못하였다. +노파는 벌써 썰매에서 내려서 기운 없는 걸음으로 비틀비틀 걷기를 시작하였다. +나는 순임을 따라서 언덕을 오르며, +"그래 무슨 병환이시냐?" +하고 물었다. +"몰라요. 신열이 대단하셔요." +"정신은 차리시든?" +"처음 제가 여기 왔을 적에는 그렇지 않더니 요새에는 가끔 혼수 상태에 빠지시는 모양이야요." +이만한 지식을 가지고 나는 최석이가 누워 있는 집 앞에 다다랐다. +이 집은 통나무를 댓 개 우물 정자로 가로놓고 지붕은 무엇으로 했는지 모르나 눈이 덮이고, 문 하나 창 하나를 내었는데 문은 나무껍질인 모양이나 창은 젖빛 나는 유리창인 줄 알았더니 뒤에 알아본즉 그것은 유리가 아니요, 양목을 바르고 물을 뿜어서 얼려 놓은 것이었다. 그리고 통나무와 통나무 틈바구니에는 쇠털과 같은 마른 풀을 꼭꼭 박아서 바람을 막았다. +문을 열고 들어서니 부엌에 들어서는 모양으로 쑥 빠졌는데 화끈화끈하는 것이 한증과 같다. 그렇지 않아도 침침한 날에 언 눈으로 광선 부족한 방에 들어오니, 캄캄 절벽이어서 아무것도 보이지 아니하였다. +순임이가 앞서서 양초에 불을 켠다. 촛불 빛은 방 한편 쪽 침대라고 할 만한 높은 곳에 담요를 덮고 누운 최석의 시체와 같은 흰 얼굴을 비춘다. +"아버지, 아버지 샌전 아저씨 오셨어요." +하고 순임은 최석의 귀에 입을 대고 가만히 불렀다. +그러나 대답이 없었다. +나는 최석의 이마를 만져 보았다. 축축하게 땀이 흘렀다. 그러나 그리 더운 줄은 몰랐다. +방 안의 공기는 숨이 막힐 듯하였다. 그 난방 장치는 삼굿의 원리를 이용한 것이었다. 돌멩이로 아궁이를 쌓고 그 위에 큰 돌멩이들을 많이 쌓고 거기다가 불을 때어서 달게 한 뒤에 거기 눈을 부어 뜨거운 증기를 발하는 것이었다. +이 건축법은 조선 동포들이 시베리아로 금광을 찾아다니면서 하는 법이란 말을 들었으나 최석이가 누구에게서 배워 가지고 어떤 모양으로 지었는지는 최석의 말을 듣기 전에는 알 수 없는 일이다. +나는 내 힘이 미치는 데까지 최석의 병 치료에 대한 손을 쓰고 어떻게 해서든지 이르쿠츠크의 병원으로 최석을 데려다가 입원시킬 도리를 궁리하였다. 그러나 냉정하게 생각하면 최석은 살아날 가망이 없는 것만 같았다. +내가 간 지 사흘 만에 최석은 처음으로 정신을 차려서 눈을 뜨고 나를 알아보았다. +그는 반가운 표정을 하고 빙그레 웃기까지 하였다. +"다 일없나?" +이런 말도 알아들을 수가 있었다. +그러나 심히 기운이 없는 모양이기로 나는 많이 말을 하지 아니하였다. +최석은 한참이나 눈을 감고 있더니, +"정임이 소식 들었나?" +하였다. +"괜찮대요." +하고 곁에서 순임이가 말하였다. +그리고는 또 혼몽하는 듯하였다. +그 날 또 한 번 최석은 정신을 차리고 순임더러는 저리로 가라는 뜻을 표하고 나더러 귀를 가까이 대라는 뜻을 보이기로 그대로 하였더니, +"내 가방 속에 일기가 있으니 그걸 자네만 보고는 불살라 버려. 내가 죽은 뒤에라도 그것이 세상 사람의 눈에 들면 안 되지. 순임이가 볼까 걱정이 되지마는 내가 몸을 꼼짝할 수가 있나." +하는 뜻을 말하였다. +"그러지." +하고 나는 고개를 끄덕여 보였다. +그러고 난 뒤에 나는 최석이가 시킨 대로 가방을 열고 책들을 뒤져서 그 일기책이라는 공책을 꺼내었다. +"순임이 너 이거 보았니?" +하고 나는 곁에서 내가 책 찾는 것을 보고 섰던 순임에게 물었다. +"아니오. 그게 무어여요?" +하고 순임은 내 손에 든 책을 빼앗으려는 듯이 손을 내밀었다. +나는 순임의 손이 닿지 않도록 책을 한편으로 비키며, +"이것이 네 아버지 일기인 모양인데 너는 보이지 말고 나만 보라고 하셨다. 네 아버지가 네가 이것을 보았을까 해서 염려를 하시는데 안 보았으면 다행이다." +하고 나는 그 책을 들고 밖으로 나왔다. +날이 밝다. 해는 중천에 있다. 중천이래야 저 남쪽 지평선 가까운 데다. 밤이 열여덟 시간, 낮이 대여섯 시간밖에 안 되는 북쪽 나라다. 멀건 햇빛이다. +나는 볕이 잘 드는 곳을 골라서 나무에 몸을 기대고 최석의 일기를 읽기 시작하였다. 읽은 중에서 몇 구절을 골라 볼까. +"집이 다 되었다. 이 집은 내가 생전 살고 그 속에서 이 세상을 마칠 집이다. 마음이 기쁘다. 시끄러운 세상은 여기서 멀지 아니하냐. 내가 여기 홀로 있기로 누가 찾을 사람도 없을 것이다. 내가 여기서 죽기로 누가 슬퍼해 줄 사람도 없을 것이다. 때로 곰이나 찾아올까. 지나가던 사슴이나 들여다볼까. +이것이 내 소원이 아니냐. 세상의 시끄러움을 떠나는 것이 내 소원이 아니냐. 이 속에서 나는 나를 이기기를 공부하자." +첫날은 이런 평범한 소리를 썼다. +그 이튿날에는. +"어떻게나 나는 약한 사람인고. 제 마음을 제가 지배하지 못하는 사람인고. 밤새도록 나는 정임을 생각하였다. 어두운 허공을 향하여 정임을 불렀다. 정임이가 나를 찾아서 동경을 떠나서 이리로 오지나 아니하나 하고 생각하였다. 어떻게나 부끄러운 일인고? 어떻게나 가증한 일인고? +나는 아내를 생각하려 하였다. 아이들을 생각하려 하였다. 아내와 아이들을 생각함으로 정임의 생각을 이기려 하였다. +최석아, 너는 남편이 아니냐. 아버지가 아니냐. 정임은 네 딸이 아니냐. 이런 생각을 하였다. +그래도 정임의 일류전은 아내와 아이들의 생각을 밀치고 달려오는 절대 위력을 가진 듯하였다. +아, 나는 어떻게나 파렴치한 사람인고. 나이 사십이 넘어 오십을 바라보는 놈이 아니냐. 사십에 불혹이라고 아니 하느냐. 교육가로 깨끗한 교인으로 일생을 살아 왔다고 자처하는 내가 아니냐 하고 나는 내 입으로 내 손가락을 물어서 두 군데나 피를 내었다." +최석의 둘째 날 일기는 계속된다. +"내 손가락에서 피가 날 때에 나는 유쾌하였다. 나는 승첩의 기쁨을 깨달았다. +그러나 아아 그러나 그 빨간, 참회의 핏방울 속에서도 애욕의 불길이 일지 아니하는가. 나는 마침내 제도할 수 없는 인생인가." +이 집에 든 지 둘째날에 벌써 이러한 비관적 말을 하였다. +또 며칠을 지난 뒤 일기에, +"나는 동경으로 돌아가고 싶다. 정임의 곁으로 가고 싶다. 시베리아의광야의 유혹도 아무 힘이 없다. 어젯밤은 삼림의 좋은 달을 보았으나 그 달을 아름답게 보려 하였으나 아무리 하여도 아름답게 보이지를 아니하였다. +하늘이나 달이나 삼림이나 모두 무의미한 존재다. 이처럼 무의미한 존재를 나는 경험한 일이 없다. 그것은 다만 기쁨을 자아내지 아니할 뿐더러 슬픔도 자아내지 못하였다. 그것은 잿더미였다. 아무도 듣는 이 없는 데서 내 진정을 말하라면 그것은 이 천지에 내게 의미 있는 것은 정임이밖에 없다는 것이다. +나는 정임의 곁에 있고 싶다. 정임을 내 곁에 두고 싶다. 왜? 그것은 나도 모른다. +만일 이 움 속에라도 정임이가 있다 하면 얼마나 이것이 즐거운 곳이 될까. +그러나 이것은 불가능한 일이다. 이 일이 있어서는 아니 된다. 나는 이 생각을 죽여야 한다. 다시 거두를 못 하도록 목숨을 끊어 버려야 한다. +이것을 나는 원한다. 원하지마는 내게는 그 힘이 없는 모양이다. +나는 종교를 생각하여 본다. 철학을 생각하여 본다. 인류를 생각하여 본다. 나라를 생각하여 본다. 이것을 가지고 내 애욕과 바꾸려고 애써 본다. 그렇지마는 내게 그러한 힘이 없다. 나는 완전히 헬플리스함을 깨닫는다. +아아 나는 어찌할꼬? +나는 못생긴 사람이다. 그까짓 것을 못 이겨? 그까짓 것을 못 이겨? +나는 예수의 광야에서의 유혹을 생각한다. 천하를 주마 하는 유혹을 생각한다. 나는 싯다르타 태자가 왕궁을 버리고 나온 것을 생각하고, 또 스토아 철학자의 의지력을 생각하였다. +그러나 나는 그러한 생각으로도 이 생각을 이길 수가 없는 것 같다. +나는 혁명가를 생각하였다. 모든 것 사랑도 목숨도 다 헌신짝같이 집어던지고 피 흐르는 마당으로 뛰어나가는 용사를 생각하였다. 나는 이끝없는 삼림 속으로 혁명의 용사 모양으로 달음박질치다가 기운이 진한 곳에서 죽어 버리는 것이 소원이었다. 그러나 거기까지도 이 생각은 따르지 아니할까. +나는 지금 곧 죽어 버릴까. 나는 육혈포를 손에 들어 보았다. 이 방아쇠를 한 번만 튕기면 내 생명은 없어지는 것이 아닌가. 그리 되면 모든 이 마음의 움직임은 소멸되는 것이 아닌가. 이것으로 만사가 해결되는 것이 아닌가. +아 하나님이시여, 힘을 주시옵소서. 천하를 이기는 힘보다도 나 자신을 이기는 힘을 주시옵소서. 이 죄인으로 하여금 하나님의 눈에 의롭고 깨끗한 사람으로 이 일생을 마치게 하여 주시옵소서, 이렇게 나는 기도를 한다. +그러나 하나님께서는 나를 버리셨다. 하나님께서는 내게 힘을 주시지 아니하시었다. 나를 이 비참한 자리에서 썩어져 죽게 하시었다." +최석은 어떤 날 일기에 또 이런 것도 썼다. 그것은 예전 내게 보낸 편지에 있던 꿈 이야기를 연상시키는 것이었다. 그것은 이러하다. +"오늘 밤은 달이 좋다. 시베리아의 겨울 해는 참 못생긴 사람과도 같이 기운이 없지마는 하얀 땅, 검푸른 하늘에 저쪽 지평선을 향하고 흘러가는 반달은 참으로 맑음 그것이었다. +나는 평생 처음 시 비슷한 것을 지었다. +임과 이별하던 날 밤에는 남쪽 나라에 바람비가 쳤네 +임 타신 자동차의 뒷불이 빨간 뒷불이 빗발에 찢겼네 +임 떠나 혼자 헤매는 시베리아의 오늘 밤에는 +지려는 쪽달이 눈 덮인 삼림에 걸렸구나 +아아 저 쪽달이여 +억지로 반을 갈겨진 것도 같아라 +아아 저 쪽달이여 +잃어진 짝을 찾아 +차디찬 허공 속을 영원히 헤매는 것도 같구나 +나도 저 달과 같이 잃어버린 반쪽을 찾아 무궁한 시간과 공간에서 헤매는 것만 같다. +에익. 내가 왜 이리 약한가. 어찌하여 크나큰 많은 일을 돌아보지 못하고 요만한 애욕의 포로가 되는가. +그러나 나는 차마 그 달을 버리고 들어올 수가 없었다. 내가 왜 이렇게 센티멘털하게 되었는고. 내 쇠 같은 의지력이 어디로 갔는고. 내 누를 수 없는 자존심이 어디로 갔는고. 나는 마치 유모의 손에 달린 젖먹이와도 같다. 내 일신은 도시 애욕 덩어리로 화해 버린 것 같다. +이른바 사랑 사랑이란 말은 종교적 의미인 것 이외에도 입에 담기도 싫어하던 말이다 이런 것은 내 의지력과 자존심을 녹여 버렸는가. 또 이 부자연한 고독의 생활이 나를 이렇게 내 인격을 이렇게 파괴하였는가. +그렇지 아니하면 내 자존심이라는 것이나, 의지력이라는 것이나, 인격이라는 것이 모두 세상의 습관과 사조에 휩쓸리던 것인가. 남들이 그러니까 남들이 옳다니까 남들이 무서우니까 이 애욕의 무덤에 회를 발랐던 것인가. 그러다가 고독과 반성의 기회를 얻으매 모든 회칠과 가면을 떼어 버리고 빨가벗은 애욕의 뭉텅이가 나온 것인가. +그렇다 하면, 이것이 참된 나인가. 이것이 하나님께서 지어 주신 대로의 나인가. 가슴에 타오르는 애욕의 불길 이 불길이 곧 내 영혼의 불길인가. +어쩌면 그 모든 높은 이상들 인류에 대한, 민족에 대한, 도덕에 대한, 신앙에 대한 그 높은 이상들이 이렇게도 만만하게 마치 바람에 불리는 재 모양으로 자취도 없이 흩어져 버리고 말까. 그리고 그 뒤에는 평소에그렇게도 미워하고 천히 여기던 애욕의 검은 흙만 남고 말까. +아아 저 눈 덮인 땅이여, 차고 맑은 달이여, 허공이여! 나는 너희들을 부러워하노라. +불교도들의 해탈이라는 것이 이러한 애욕이 불붙는 지옥에서 눈과 같이 싸늘하고 허공과 같이 빈 곳으로 들어감을 이름인가. +석가의 팔 년 간 설산 고행이 이 애욕의 뿌리를 끊으려 함이라 하고 예수의 사십 일 광야의 고행과 겟세마네의 고민도 이 애욕의 뿌리 때문이었던가. +그러나 그것을 이기어 낸 사람이 천지 개벽 이래에 몇몇이나 되었는고? 나 같은 것이 그 중에 한 사람 되기를 바랄 수가 있을까. +나 같아서는 마침내 이 애욕의 불길에 다 타서 재가 되어 버릴 것만 같다. 아아 어떻게나 힘있고 무서운 불길인고." +이러한 고민의 자백도 있었다. +또 어떤 날 일기에는 최석은 이런 말을 썼다. +"나는 단연히 동경으로 돌아가기를 결심하였다." +그리고는 그 이튿날은, +"나는 단연히 동경으로 돌아가리란 결심을 한 것을 굳세게 취소한다. 나는 이러한 결심을 하는 나 자신을 굳세게 부인한다." +또 이런 말도 있다. +"나는 정임을 시베리아로 부르련다." +또 그 다음에는, +"아아 나는 하루바삐 죽어야 한다. 이 목숨을 연장하였다가는 무슨 일을 저지를는지 모른다. 나는 깨끗하게 나를 이기는 도덕적 인격으로 이 일생을 마쳐야 한다. 이 밖에 내 사업이 무엇이냐." +또 어떤 곳에는, +"아아 무서운 하룻밤이었다. 나는 지난 하룻밤을 누를 수 없는 애욕의 불길에 탔다. 나는 내 주먹으로 내 가슴을 두드리고 머리를 벽에 부딪쳤다. 나는 주먹으로 담벽을 두드려 손등이 터져서 피가 흘렀다. 나는 내 머리카락을 쥐어뜯었다. 나는 수없이 발을 굴렀다. 나는 이 무서운 유혹을 이기려고 내 몸을 아프게 하였다. 나는 견디다 못하여 문을 박차고 뛰어나갔다. 밖에는 달이 있고 눈이 있었다. 그러나 눈은 핏빛이요, 달은 찌그러진 것 같았다. 나는 눈 속으로 달음박질쳤다. 달을 따라서 엎드러지며 자빠지며 달음질쳤다. 나는 소리를 질렀다. 나는 미친 사람 같았다." +그러고는 어디까지 갔다가 어느 때에 어떠한 심경의 변화를 얻어 가지고 돌아왔다는 말은 쓰이지 아니하였으나 최석의 병의 원인을 설명하는 것 같았다. +"열이 나고 기침이 난다. 가슴이 아프다. 이것이 폐렴이 되어서 혼자 깨끗하게 이 생명을 마치게 하여 주소서 하고 빈다. 나는 오늘부터 먹고 마시기를 그치련다." +이러한 말을 썼다. 그러고는, +"정임, 정임, 정임, 정임." +하고 정임의 이름을 수없이 쓴 것도 있고, 어떤 데는, +"Overcome, Overcome." +하고 영어로 쓴 것도 있었다. +그리고 마지막에, +"나는 죽음과 대면하였다. 사흘째 굶고 앓은 오늘에 나는 극히 맑고 침착한 정신으로 죽음과 대면하였다. 죽음은 검은 옷을 입었으나 그 얼굴에는 자비의 표정이 있었다. 죽음은 곧 검은 옷을 입은 구원의 손이었다. 죽음은 아름다운 그림자였다. 죽음은 반가운 애인이요, 결코 무서운 원수가 아니었다. 나는 죽음의 손을 잡노라. 감사하는 마음으로 죽음의 품에 안기노라. 아멘." +이것을 쓴 뒤에는 다시는 일기가 없었다. 이것으로 최석이가 그 동안 지난 일을 적어도 심리적 변화만은 대강 추측할 수가 있었다. +다행히 최석의 병은 점점 돌리는 듯하였다. 열도 내리고 식은땀도 덜 흘렸다. 안 먹는다고 고집하던 음식도 먹기를 시작하였다. +정임에게로 갔던 노파에게서는 정임도 열이 내리고 일어나 앉을 만하다는 편지가 왔다. +나는 노파의 편지를 최석에게 읽어 주었다. 최석은 그 편지를 듣고 매우 흥분하는 모양이었으나 곧 안심하는 빛을 보였다. +나는 최석의 병이 돌리는 것을 보고 정임을 찾아볼 양으로 떠나려 하였으나 순임이가 듣지 아니하였다. 혼자서 앓는 아버지를 맡아 가지고 있을 수는 없다는 것이었다. 그래서 노파가 오기를 기다리기로 하였다. +나는 최석이가 먹을 음식도 살 겸 우편국에도 들를 겸 시가까지 가기로 하고 이 곳 온 지 일 주일이나 지나서 처음으로 산에서 나왔다. +나는 이르쿠츠크에 가서 최석을 위하여 약품과 먹을 것을 사고 또 순임을 위해서도 먹을 것과 의복과 또 하모니카와 손풍금도 사 가지고 정거장에 나와서 돌아올 차를 기다리고 있었다. +나는 순후해 보이는 아라사 사람들이 정거장에서 오락가락하는 것을 보고 속으로는 최석이가 병이 좀 나은 것을 다행으로 생각하고, 또 최석과 정임의 장래가 어찌 될까 하는 것도 생각하면서 뷔페(식당)에서 뜨거운 차이(차)를 마시고 있었다. +이 때에 밖을 바라보고 있던 내 눈은 문득 이상한 것을 보았다. 그것은 그 노파가 이리로 향하고 걸어오는 것인데 그 노파와 팔을 걸은 젊은 여자가 있는 것이다. 머리를 검은 수건으로 싸매고 입과 코를 가리웠으니 분명히 알 수 없으나 혹은 정임이나 아닌가 할 수밖에 없었다. 정임이가 몸만 기동하게 되면 최석을 보러 올 것은 정임의 열정적인 성격으로 보아서 당연한 일이기 때문이었다. +나는 반쯤 먹던 차를 놓고 뷔페 밖으로 뛰어나갔다. +"오 미시즈 체스터필드?" +하고 나는 노파 앞에 손을 내어밀었다. 노파는 체스터필드라는 미국 남편의 성을 따라서 부르는 것을 기억하였다. +"선생님!" +하는 것은 정임이었다. 그 소리만은 변치 아니하였다. 나는 검은 장갑을 낀 정임의 손을 잡았다. 나는 여러 말 아니하고 노파와 정임을 뷔페로 끌고 들어왔다. +늙은 뷔페 보이는 번쩍번쩍하는 사모바르에서 차 두 잔을 따라다가 노파와 정임의 앞에 놓았다. +노파는 어린애에게 하는 모양으로 정임의 수건을 벗겨 주었다. 그 속에서는 해쓱하게 여윈 정임의 얼굴이 나왔다. 두 볼에 불그레하게 홍훈이 도는 것도 병 때문인가. +"어때? 신열은 없나?" +하고 나는 정임에게 물었다. +"괜찮아요." +하고 정임은 웃으며, +"최 선생님께서는 어떠세요?" +하고 묻는다. +"좀 나으신 모양이야. 그래서 나는 오늘 정임을 좀 보러 가려고 했는데 이 체스터필드 부인께서 아니 오시면 순임이가 혼자 있을 수가 없다고 해서, 그래 이렇게 최 선생 자실 것을 사 가지고 가는 길이야." +하고 말을 하면서도 나는 정임의 눈과 입과 목에서 그의 병과 마음을 알아보려고 애를 썼다. +중병을 앓은 깐 해서는 한 달 전 남대문서 볼 때보다 얼마 더 초췌한 것 같지는 아니하였다. +"네에." +하고 정임은 고개를 숙였다. 그의 안경알에는 이슬이 맺혔다. +"선생님 댁은 다 안녕하셔요?" +"응, 내가 떠날 때에는 괜찮았어." +"최 선생님 댁도?" +"응." +"선생님 퍽은 애를 쓰셨어요." +하고 정임은 울음인지 웃음인지 모를 웃음을 웃는다. +말을 모르는 노파는 우리가 하는 말을 눈치나 채려는 듯이 멀거니 보고 있다가 서투른 영어로, +"아직 미스 남은 신열이 있답니다. 그래도 가 본다고, 죽어도 가 본다고 내 말을 안 듣고 따라왔지요." +하고 정임에게 애정 있는 눈흘김을 주며, +"유 노티 차일드(말썽꾼이)." +하고 입을 씰룩하며 정임을 안경 위로 본다. +"니체워, 마뚜슈까(괜찮아요, 어머니)." +하고 정임은 노파를 보고 웃었다. 정임의 서양 사람에게 대한 행동은 서양식으로 째었다고 생각하였다. +정임은 도리어 유쾌한 빛을 보였다. 다만 그의 붉은빛 띤 눈과 마른 입술이 그의 몸에 열이 있음을 보였다. 나는 그의 손끝과 발끝이 싸늘하게 얼었을 것을 상상하였다. +마침 이 날은 날이 온화하였다. 엷은 햇빛도 오늘은 두꺼워진 듯하였다. +우리 세 사람은 F역에서 내려서 썰매 하나를 얻어 타고 산으로 향하였다. 산도 아니지마는 산 있는 나라에서 살던 우리는 최석이가 사는 곳을 산이라고 부르는 습관을 지었다. 삼림이 있으니 산같이 생각된 까닭이었다. +노파가 오른편 끝에 앉고, 가운데다가 정임을 앉히고 왼편 끝에 내가 앉았다. +쩟쩟쩟 하는 소리에 말은 달리기 시작하였다. 한 필은 키 큰 말이요, 한 필은 키가 작은 말인데 키 큰 말은 아마 늙은 군마 퇴물인가 싶게 허우대는 좋으나 몸이 여위고 털에는 윤이 없었다. 조금만 올라가는 길이 되어도 고개를 숙이고 애를 썼다. 작은 말은 까불어서 가끔 채찍으로 얻어맞았다. +"아이 삼림이 좋아요." +하고 정임은 정말 기쁜 듯이 나를 돌아보았다. +"좋아?" +하고 나는 멋없이 대꾸하고 나서, 후회되는 듯이, +"밤낮 삼림 속에서만 사니까 지루한데." +하는 말을 붙였다. +"저는 저 눈 있는 삼림 속으로 한정 없이 가고 싶어요. 그러나 저는 인제 기운이 없으니깐 웬걸 그래 보겠어요?" +하고 한숨을 쉬었다. +"왜 그런 소릴 해. 인제 나을걸." +하고 나는 정임의 눈을 들여다보았다. 마치 슬픈 눈물 방울이나 찾으려는 듯이. +"제가 지금도 열이 삼십팔 도가 넘습니다. 정신이 흐릿해지는 것을 보니까 아마 더 올라가나 봐요. 그래도 괜찮아요. 오늘 하루야 못 살라고요. 오늘 하루만 살면 괜찮아요. 최 선생님만 한 번 뵙고 죽으면 괜찮아요." +"왜 그런 소릴 해?" +하고 나는 책망하는 듯이 언성을 높였다. +정임은 기침을 시작하였다. 한바탕 기침을 하고는 기운이 진한 듯이 노파에게 기대며 조선말로, +"추워요." +하였다. 이 여행이 어떻게 정임의 병에 좋지 못할 것은 의사가 아닌 나로도 짐작할 수가 있었다. 그러나 나로는 더 어찌할 수가 없었다. +나는 외투를 벗어서 정임에게 입혀 주고 노파는 정임을 안아서 몸이 덜 흔들리도록 또 춥지 않도록 하였다. +나는 정임의 모양을 애처로워서 차마 볼 수가 없었다. 그러나 이것은 하나님밖에는 어찌할 도리가 없는 일이었다. +얼마를 지나서 정임은 갑자기 고개를 들고 일어나며, +"인제 몸이 좀 녹았습니다. 선생님 추우시겠어요. 이 외투 입으셔요." +하고 그의 입만 웃는 웃음을 웃었다. +"난 춥지 않아. 어서 입고 있어." +하고 나는 정임이가 외투를 벗는 것을 막았다. 정임은 더 고집하려고도 아니하고, +"선생님 시베리아의 삼림은 참 좋아요. 눈 덮인 것이 더 좋은 것 같아요. 저는 이 인적 없고 자유로운 삼림 속으로 헤매어 보고 싶어요." +하고 아까 하던 것과 같은 말을 또 하였다. +"며칠 잘 정양하여서, 날이나 따뜻하거든 한 번 산보나 해 보지." +하고 나는 정임의 말 뜻이 다른 데 있는 줄을 알면서도 부러 평범하게 대답하였다. +정임은 대답이 없었다. +"여기서도 아직 멀어요?" +하고 정임은 몸이 흔들리는 것을 심히 괴로워하는 모양으로 두 손을 자리에 짚어 몸을 버티면서 말하였다. +"고대야, 최 선생이 반가워할 터이지. 오죽이나 반갑겠나." +하고 나는 정임을 위로하는 뜻으로 말하였다. +"아이 참 미안해요. 제가 죄인이야요. 저 때문에 애매한 누명을 쓰시고 저렇게 사업도 버리시고 병환까지 나시니 저는 어떡허면 이 죄를 씻습니까?" +하고 눈물 고인 눈으로 정임은 나를 쳐다보았다. +나는 정임과 최석을 이 자유로운 시베리아의 삼림 속에 단둘이 살게 하고 싶었다. 그러나 최석은 살아나가겠지마는 정임이가 살아날 수가 있을까, 하고 나는 정임의 어깨를 바라보았다. 그의 목숨은 실낱 같은 것 같았다. 바람받이에 놓인 등잔불과만 같은 것 같았다. 이 목숨이 끊어지기 전에 사랑하는 이의 얼굴을 한 번 대하겠다는 것밖에 아무 소원이 없는 정임은 참으로 가엾어서 가슴이 미어지는 것 같았다. +"염려 말어. 무슨 걱정이야? 최 선생도 병이 돌리고 정임도 인제 얼마 정양하면 나을 것 아닌가. 아무 염려 말아요." +하고 나는 더욱 최석과 정임과 두 사람의 사랑을 달하게 할 결심을 하였다. 하나님께서 계시다면 이 가엾은 간절한 두 사람의 마음을 가슴 미어지게 아니 생각할 리가 없다고 생각하였다. 우주의 모든 일 중에 정임의 정경보다 더 슬프고 불쌍한 정경이 또 있을까 하였다. 차디찬 눈으로 덮인 시베리아의 광야에 병든 정임의 사랑으로 타는 불똥과 같이 날아가는 이 정경은 인생이 가질 수 있는 최대한 비극인 것 같았다. +정임은 지쳐서 고개를 숙이고 있다가도 가끔 고개를 들어서는 기운 나는 양을 보이려고, 유쾌한 양을 보이려고 애를 썼다. +"저 나무 보셔요. 오백 년은 살았겠지요?" +이런 말도 하였다. 그러나 그것은 다 억지로 지어서 하는 것이었다. 그러다가는 또 기운이 지쳐서는 고개를 숙이고, 혹은 노파의 어깨에 혹은 내 어깨에 쓰러졌다. +마침내 우리가 향하고 가는 움집이 보였다. +"정임이, 저기야." +하고 나는 움집을 가리켰다. +"네에?" +하고 정임은 내 손가락 가는 곳을 보고 다음에는 내 얼굴을 보았다. 잘 보이지 않는 모양이다. +"저기 저것 말야. 저기 저 고작 큰 전나무 두 개가 있지 않아? 그 사이로 보이는 저, 저거 말야. 옳지 옳지, 순임이 지금 나오지 않아?" +하였다. +순임이가 무엇을 가지러 나오는지 문을 열고 나와서는 밥 짓느라고 지어 놓은 이를테면 부엌에를 들어갔다가 나오는 길에 이 쪽을 바라보다가 우리를 발견하였는지 몇 걸음 빨리 오다가는 서서 보고 오다가는 서서 보더니 내가 모자를 내두르는 것을 보고야 우리 일행인 것을 확실히 알고 달음박질을 쳐서 나온다. +우리 썰매를 만나자, +"정임이야? 어쩌면 이 추운데." +하고 순임은 정임을 안고 그 안경으로 정임의 눈을 들여다본다. +"어쩌면 앓으면서 이렇게 와?" +하고 순임은 노파와 나를 책망하는 듯이 돌아보았다. +"아버지 어떠시냐?" +하고 나는 짐을 들고 앞서서 오면서 뒤따르는 순임에게 물었다. +"아버지요?" +하고 순임은 어른에게 대한 경의를 표하노라고 내 곁에 와서 걸으며, +"아버지께서 오늘은 말씀을 많이 하셨어요. 순임이가 고생하는구나 고맙다, 이런 말씀도 하시고, 지금 같아서는 일어날 것도 같은데 기운이 없어서, 이런 말씀도 하시고, 또 선생님이 이르쿠츠크에를 들어가셨으니 무엇을 사 오실 듯싶으냐, 알아맞혀 보아라, 이런 농담도 하시고, 정임이가 어떤가 한 번 보았으면, 이런 말씀도 하시겠지요. 또 순임아, 내가 죽더라도 정임을 네 친동생으로 알아서 부디 잘 사랑해 주어라, 정임은 불쌍한 애다, 참 정임은 불쌍해! 이런 말씀도 하시겠지요. 그렇게 여러 가지 말씀을 많이 하시더니, 순임아 내가 죽거든 선생님을 아버지로 알고 그 지도를 받아라, 그러시길래 제가 아버지 안 돌아가셔요! 그랬더니 아버지께서 웃으시면서, 죽지 말까, 하시고는 어째 가슴이 좀 거북한가, 하시더니 잠이 드셨어요. 한 시간이나 되었을까, 온." +집 앞에 거의 다 가서는 순임은 정임의 팔을 꼈던 것을 놓고 빨리 집으로 뛰어들어갔다. +치마폭을 펄럭거리고 뛰는 양에는 어렸을 적 말괄량이 순임의 모습이 남아 있어서 나는 혼자 웃었다. 순임은 정임이가 왔다는 기쁜 소식을 한 시각이라도 빨리 아버지께 전하고 싶었던 것이다. +"아버지, 주무시우? 정임이가 왔어요. 정임이가 왔습니다." +하고 부르는 소리가 밖에서도 들렸다. +나도 방에 들어서고, 정임도 뒤따라 들어서고, 노파는 부엌으로 물건을 두러 들어갔다. +방은 절벽같이 어두웠다. +"순임아, 불을 좀 켜려무나." +하고 최석의 얼굴을 찾느라고 눈을 크게 뜨고 고개를 숙이며, +"자나? 정임이가 왔네." +하고 불렀다. +정임도 곁에 와서 선다. +최석은 대답이 없었다. +순임이가 촛불을 켜자 최석의 얼굴이 환하게 보였다. +"여보게, 여봐. 자나?" +하고 나는 무서운 예감을 가지면서 최석의 어깨를 흔들었다. +그것이 무엇인지 모르지마는 최석은 시체라 하는 것을 나는 내 손을 통해서 깨달았다. +나는 깜짝 놀라서 이불을 벗기고 최석의 팔을 잡아 맥을 짚어 보았다. 거기는 맥이 없었다. +나는 최석의 자리옷 가슴을 헤치고 귀를 가슴에 대었다. 그 살은 얼음과 같이 차고 그 가슴은 고요하였다. 심장은 뛰기를 그친 것이었다. +나는 최석의 가슴에서 귀를 떼고 일어서면서, +"네 아버지는 돌아가셨다. 네 손으로 눈이나 감겨 드려라." +하였다. 내 눈에서는 눈물이 흘렀다. +"선생님!" +하고 정임은 전연히 절제할 힘을 잃어버린 듯이 최석의 가슴에 엎어졌다. 그러고는 소리를 내어 울었다. 순임은, +"아버지, 아버지!" +하고 최석의 베개 곁에 이마를 대고 울었다. +아라사 노파도 울었다. +방 안에는 오직 울음 소리뿐이요, 말이 없었다. 최석은 벌써 이 슬픈 광경도 몰라보는 사람이었다. +최석이가 자기의 싸움을 이기고 죽었는지, 또는 끝까지 지다가 죽었는지 그것은 영원한 비밀이어서 알 도리가 없었다. 그러나 이것만은 확실하다 그의 의식이 마지막으로 끝나는 순간에 그의 의식기에 떠오르던 오직 하나가 정임이었으리라는 것만은. +지금 정임이가 그의 가슴에 엎어져 울지마는, 정임의 뜨거운 눈물이 그의 가슴을 적시건마는 최석의 가슴은 뛸 줄을 모른다. 이것이 죽음이란 것이다. +뒤에 경찰의가 와서 검사한 결과에 의하면, 최석은 폐렴으로 앓던 결과로 심장마비를 일으킨 것이라고 하였다. +나는 최석의 장례를 끝내고 순임과 정임을 데리고 오려 하였으나 정임은 듣지 아니하고 노파와 같이 바이칼 촌으로 가 버렸다. +그런 뒤로는 정임에게서는 일체 음신이 없다. 때때로 노파에게서 편지가 오는데 정임은 최석이가 있던 방에 가만히 있다고만 하였다. +서투른 영어가 뜻을 충분히 발표하지 못하는 것이었다. +나는 정임에게 안심하고 병을 치료하라는 편지도 하고 돈이 필요하거든 청구하라는 편지도 하나 영 답장이 없다. +만일 정임이가 죽었다는 기별이 오면 나는 한 번 더 시베리아에 가서 둘을 가지런히 묻고 `두 별 무덤'이라는 비를 세워 줄 생각이다. 그러나 나는 정임이가 조선으로 오기를 바란다. +여러분은 최석과 정임에게 대한 이 기록을 믿고 그 두 사람에게 대한 오해를 풀라. +EOT; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php new file mode 100644 index 0000000..5f44640 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php @@ -0,0 +1,131 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function citySuffix() + { + return static::randomElement(static::$citySuffix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetSuffix() + { + return static::randomElement(static::$streetSuffix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php new file mode 100644 index 0000000..4a110c2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php @@ -0,0 +1,15 @@ +bothify("########"); + } + + /** + * Return passport number + * @return string + * @example 12345678 + */ + public function passportNumber() + { + return $this->bothify("########"); + } + + /** + * National Personal Identity number (asmens kodas) + * @link https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @link https://lt.wikipedia.org/wiki/Asmens_kodas + * @param string [male|female] + * @param \DateTime $birthdate + * @param string $randomNumber three integers + * @return string on format XXXXXXXXXXX + */ + public function personalIdentityNumber($gender = 'male', \DateTime $birthdate = null, $randomNumber = '') + { + if (!$birthdate) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $genderNumber = ($gender == 'male') ? (int) 1 : (int) 0; + $firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber; + + $datePart = $birthdate->format('ymd'); + $randomDigits = (string) ( ! $randomNumber || strlen($randomNumber < 3)) ? static::numerify('###') : substr($randomNumber, 0, 3); + $partOfPerosnalCode = $firstNumber . $datePart . $randomDigits; + + $sum = self::calculateSum($partOfPerosnalCode, 1); + $liekana = $sum % 11; + + if ($liekana !== 10) { + $lastNumber = $liekana; + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + $sum = self::calculateSum($partOfPerosnalCode, 2); + $liekana = (int) $sum % 11; + + $lastNumber = ($liekana !== 10) ? $liekana : 0; + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + /** + * Calculate the sum of personal code + * @link https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @link https://lt.wikipedia.org/wiki/Asmens_kodas + * @param string $numbers + * @param int $time [1|2] + * @return int + */ + private static function calculateSum($numbers, $time = 1) + { + if ($time == 1) { + $multipliers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 1 ); + } else { + $multipliers = array(3, 4, 5, 6, 7, 8, 9, 1, 2, 3 ); + } + + $sum = 0; + for ($i=1; $i <= 10; $i++) { + $sum += $numbers[$i-1] * $multipliers[$i-1]; + } + + return (int) $sum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php new file mode 100644 index 0000000..752eb78 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php @@ -0,0 +1,17 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php new file mode 100644 index 0000000..99e681b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php @@ -0,0 +1,19 @@ +format('dmy'); + $randomDigits = (string) static::numerify('####'); + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php new file mode 100644 index 0000000..29c19f6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php @@ -0,0 +1,15 @@ + static::latitude(42.43, 42.45), + 'longitude' => static::longitude(19.16, 19.27) + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php new file mode 100644 index 0000000..1f80312 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php @@ -0,0 +1,49 @@ +generator->parse(static::$idNumberFormat)); + } + + /** + * @return string + * @example 'Ф' + */ + public function alphabet() + { + return static::randomElement(static::$alphabet); + } + + /** + * @return string + * @example 'Э' + */ + public function namePrefix() + { + return static::randomElement(static::$namePrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php new file mode 100644 index 0000000..dd0bb4a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php @@ -0,0 +1,13 @@ + Townships + * @link https://en.wikipedia.org/wiki/Template:Johor > Townships + * @link https://en.wikipedia.org/wiki/Template:Kedah > Townships + * @link https://en.wikipedia.org/wiki/Template:Kelantan > Townships + * @link https://en.wikipedia.org/wiki/Template:Melaka > Townships + * @link https://en.wikipedia.org/wiki/Template:Negeri_Sembilan > Townships + * @link https://en.wikipedia.org/wiki/Template:Perak > Townships + * @link https://en.wikipedia.org/wiki/Template:Penang > Townships + * @link https://en.wikipedia.org/wiki/Template:Selangor > Townships + * @link https://en.wikipedia.org/wiki/Template:Terengganu > Townships + */ + protected static $townshipPrefix = array( + 'Alam','Apartment','Ara', + 'Bandar','Bandar','Bandar','Bandar','Bandar','Bandar', + 'Bandar Bukit','Bandar Seri','Bandar Sri','Bandar Baru','Batu','Bukit', + 'Desa','Damansara', + 'Kampung','Kampung Baru','Kampung Baru','Kondominium','Kota', + 'Laman','Lembah', + 'Medan', + 'Pandan','Pangsapuri','Petaling','Puncak', + 'Seri','Sri', + 'Taman','Taman','Taman','Taman','Taman','Taman', + 'Taman Desa', + ); + protected static $townshipSuffix = array( + 'Aman','Amanjaya','Anggerik','Angkasa','Antarabangsa','Awan', + 'Bahagia','Bangsar','Baru','Belakong','Bendahara','Bestari','Bintang','Brickfields', + 'Casa','Changkat','Country Heights', + 'Damansara','Damai','Dato Harun','Delima','Duta', + 'Flora', + 'Gembira','Genting', + 'Harmoni','Hartamas', + 'Impian','Indah','Intan', + 'Jasa','Jaya', + 'Keramat','Kerinchi','Kiara','Kinrara','Kuchai', + 'Laksamana', + 'Mahkota','Maluri','Manggis','Maxwell','Medan','Melawati','Menjalara','Meru','Mulia','Mutiara', + 'Pahlawan','Perdana','Pertama','Permai','Pelangi','Petaling','Pinang','Puchong','Puteri','Putra', + 'Rahman','Rahmat','Raya','Razak','Ria', + 'Saujana','Segambut','Selamat','Selatan','Semarak','Sentosa','Seputeh','Setapak','Setia Jaya','Sinar','Sungai Besi','Sungai Buaya','Sungai Long','Suria', + 'Tasik Puteri','Tengah','Timur','Tinggi','Tropika','Tun Hussein Onn','Tun Perak','Tunku', + 'Ulu','Utama','Utara', + 'Wangi', + ); + + /** + * @link https://en.wikipedia.org/wiki/Template:Greater_Kuala_Lumpur + * @link https://en.wikipedia.org/wiki/Template:Johor + * @link https://en.wikipedia.org/wiki/Template:Kedah + * @link https://en.wikipedia.org/wiki/Template:Kelantan + * @link https://en.wikipedia.org/wiki/Template:Labuan + * @link https://en.wikipedia.org/wiki/Template:Melaka + * @link https://en.wikipedia.org/wiki/Template:Negeri_Sembilan + * @link https://en.wikipedia.org/wiki/Template:Pahang + * @link https://en.wikipedia.org/wiki/Template:Perak + * @link https://en.wikipedia.org/wiki/Template:Perlis + * @link https://en.wikipedia.org/wiki/Template:Penang + * @link https://en.wikipedia.org/wiki/Template:Sabah + * @link https://en.wikipedia.org/wiki/Template:Sarawak + * @link https://en.wikipedia.org/wiki/Template:Selangor + * @link https://en.wikipedia.org/wiki/Template:Terengganu + */ + protected static $towns = array( + 'johor' => array( + 'Ayer Hitam', + 'Batu Pahat','Bukit Gambir','Bukit Kepong','Bukit Naning', + 'Desaru', + 'Endau', + 'Gelang Patah','Gemas Baharu', + 'Iskandar Puteri', + 'Jementah','Johor Lama','Johor Bahru', + 'Kempas','Kluang','Kota Iskandar','Kota Tinggi','Kukup','Kulai', + 'Labis ','Larkin','Layang-Layang', + 'Mersing','Muar', + 'Pagoh','Paloh','Parit Jawa','Pasir Gudang','Pekan Nanas','Permas Jaya','Pontian Kechil', + 'Renggam', + 'Segamat','Senai','Simpang Renggam','Skudai','Sri Gading', + 'Tangkak','Tebrau', + 'Ulu Tiram', + 'Yong Peng', + ), + 'kedah' => array( + 'Alor Setar', + 'Baling','Bukit Kayu Hitam', + 'Changlun', + 'Durian Burung', + 'Gurun', + 'Jitra', + 'Kepala Batas','Kuah','Kuala Kedah','Kuala Ketil','Kulim', + 'Langgar','Lunas', + 'Merbok', + 'Padang Serai','Pendang', + 'Serdang','Sintok','Sungai Petani', + 'Tawar, Baling', + 'Yan', + ), + 'kelantan' => array( + 'Bachok','Bunut Payong', + 'Dabong', + 'Gua Musang', + 'Jeli', + 'Ketereh','Kota Bharu','Kuala Krai', + 'Lojing', + 'Machang', + 'Pasir Mas','Pasir Puteh', + 'Rantau Panjang', + 'Salor', + 'Tok Bali', + 'Wakaf Bharu','Wakaf Che Yeh', + ), + 'kl' => array( + 'Ampang', + 'Bandar Tasik Selatan','Bandar Tun Razak','Bangsar','Batu','Brickfields','Bukit Bintang','Bukit Jalil','Bukit Tunku', + 'Cheras','Chow Kit', + 'Damansara Town Centre','Dang Wangi','Desa Petaling','Desa Tun Hussein Onn', + 'Jinjang', + 'Kampung Baru','Kampung Kasipillay','Kampung Pandan','Kampung Sungai Penchala','Kepong','KLCC','Kuchai Lama', + 'Lake Gardens','Lembah Pantai', + 'Medan Tuanku','Mid Valley City','Mont Kiara', + 'Pantai Dalam','Pudu', + 'Salak South','Segambut','Semarak','Sentul','Setapak','Setiawangsa','Seputeh','Sri Hartamas','Sri Petaling','Sungai Besi', + 'Taman Desa','Taman Melawati','Taman OUG','Taman Tun Dr Ismail','Taman U-Thant','Taman Wahyu','Titiwangsa','Tun Razak Exchange', + 'Wangsa Maju', + ), + 'labuan' => array( + 'Batu Manikar', + 'Kiamsam', + 'Layang-Layang', + 'Rancha-Rancha' + ), + 'melaka' => array( + 'Alor Gajah', + 'Bandaraya Melaka','Batu Berendam','Bukit Beruang','Bukit Katil', + 'Cheng', + 'Durian Tunggal', + 'Hang Tuah Jaya', + 'Jasin', + 'Klebang', + 'Lubuk China', + 'Masjid Tanah', + 'Naning', + 'Pekan Asahan', + 'Ramuan China', + 'Simpang Ampat', + 'Tanjung Bidara','Telok Mas', + 'Umbai', + ), + 'nsembilan' => array( + 'Ayer Kuning','Ampangan', + 'Bahau','Batang Benar', + 'Chembong', + 'Dangi', + 'Gemas', + 'Juasseh', + 'Kuala Pilah', + 'Labu','Lenggeng','Linggi', + 'Mantin', + 'Nilai', + 'Pajam','Pedas','Pengkalan Kempas','Port Dickson', + 'Rantau','Rompin', + 'Senawang','Seremban','Sungai Gadut', + 'Tampin','Tiroi', + ), + 'pahang' => array( + 'Bandar Tun Razak','Bentong','Brinchang','Bukit Fraser','Bukit Tinggi', + 'Chendor', + 'Gambang','Genting Highlands','Genting Sempah', + 'Jerantut', + 'Karak','Kemayan','Kota Shahbandar','Kuala Lipis','Kuala Pahang','Kuala Rompin','Kuantan', + 'Lanchang','Lubuk Paku', + 'Maran','Mengkuang','Mentakab', + 'Nenasi', + 'Panching', + 'Pekan','Penor', + 'Raub', + 'Sebertak','Sungai Lembing', + 'Tanah Rata','Tanjung Sepat','Tasik Chini','Temerloh','Teriang','Tringkap', + ), + 'penang' => array( + 'Air Itam', + 'Balik Pulau','Batu Ferringhi','Batu Kawan','Bayan Lepas','Bukit Mertajam','Butterworth', + 'Gelugor','George Town', + 'Jelutong', + 'Kepala Batas', + 'Nibong Tebal', + 'Permatang Pauh','Pulau Tikus', + 'Simpang Ampat', + 'Tanjung Bungah','Tanjung Tokong', + ), + 'perak' => array( + 'Ayer Tawar', + 'Bagan Serai','Batu Gajah','Behrang','Bidor','Bukit Gantang','Bukit Merah', + 'Changkat Jering','Chemor','Chenderiang', + 'Damar Laut', + 'Gerik','Gopeng','Gua Tempurung', + 'Hutan Melintang', + 'Ipoh', + 'Jelapang', + 'Kamunting','Kampar','Kuala Kangsar', + 'Lekir','Lenggong','Lumut', + 'Malim Nawar','Manong','Menglembu', + 'Pantai Remis','Parit','Parit Buntar','Pasir Salak','Proton City', + 'Simpang Pulai','Sitiawan','Slim River','Sungai Siput','Sungkai', + 'Taiping','Tambun','Tanjung Malim','Tanjung Rambutan','Tapah','Teluk Intan', + 'Ulu Bernam', + ), + 'perlis' => array( + 'Arau', + 'Beseri', + 'Chuping', + 'Kaki Bukit','Kangar','Kuala Perlis', + 'Mata Ayer', + 'Padang Besar', + 'Sanglang','Simpang Empat', + 'Wang Kelian', + ), + 'putrajaya' => array( + 'Precinct 1','Precinct 4','Precinct 5', + 'Precinct 6','Precinct 8','Precinct 10', + 'Precinct 11','Precinct 12','Precinct 13', + 'Precinct 16','Precinct 18','Precinct 19', + ), + 'sabah' => array( + 'Beaufort','Bingkor', + 'Donggongon', + 'Inanam', + 'Kinabatangan','Kota Belud','Kota Kinabalu','Kuala Penyu','Kimanis','Kundasang', + 'Lahad Datu','Likas','Lok Kawi', + 'Manggatal', + 'Nabawan', + 'Papar','Pitas', + 'Ranau', + 'Sandakan','Sapulut','Semporna','Sepanggar', + 'Tambunan','Tanjung Aru','Tawau','Tenom','Tuaran', + 'Weston', + ), + 'sarawak' => array( + 'Asajaya', + 'Ba\'kelalan','Bario','Batu Kawa','Batu Niah','Betong','Bintulu', + 'Dalat','Daro', + 'Engkilili', + 'Julau', + 'Kapit','Kota Samarahan','Kuching', + 'Lawas','Limbang','Lubok Antu', + 'Marudi','Matu','Miri', + 'Oya', + 'Pakan', + 'Sadong Jaya','Sematan','Sibu','Siburan','Song','Sri Aman','Sungai Tujoh', + 'Tanjung Kidurong','Tanjung Manis','Tatau', + ), + 'selangor' => array( + 'Ampang','Assam Jawa', + 'Balakong','Bandar Baru Bangi','Bandar Baru Selayang','Bandar Sunway','Bangi','Banting','Batang Kali','Batu Caves','Bestari Jaya','Bukit Lanjan', + 'Cheras','Cyberjaya', + 'Damansara','Dengkil', + 'Ijok', + 'Jenjarom', + 'Kajang','Kelana Jaya','Klang','Kuala Kubu Bharu','Kuala Selangor','Kuang', + 'Lagong', + 'Morib', + 'Pandamaran','Paya Jaras','Petaling Jaya','Port Klang','Puchong', + 'Rasa','Rawang', + 'Salak Tinggi','Sekinchan','Selayang','Semenyih','Sepang','Serendah','Seri Kembangan','Shah Alam','Subang','Subang Jaya','Sungai Buloh', + 'Tanjung Karang','Tanjung Sepat', + 'Ulu Klang','Ulu Yam', + ), + 'terengganu' => array( + 'Ajil', + 'Bandar Ketengah Jaya','Bandar Permaisuri','Bukit Besi','Bukit Payong', + 'Chukai', + 'Jerteh', + 'Kampung Raja','Kerteh','Kijal','Kuala Besut','Kuala Berang','Kuala Dungun','Kuala Terengganu', + 'Marang','Merchang', + 'Pasir Raja', + 'Rantau Abang', + 'Teluk Kalung', + 'Wakaf Tapai', + ) + ); + + /** + * @link https://en.wikipedia.org/wiki/States_and_federal_territories_of_Malaysia + */ + protected static $states = array( + 'johor' => array( + 'Johor Darul Ta\'zim', + 'Johor' + ), + 'kedah' => array( + 'Kedah Darul Aman', + 'Kedah' + ), + 'kelantan' => array( + 'Kelantan Darul Naim', + 'Kelantan' + ), + 'kl' => array( + 'KL', + 'Kuala Lumpur', + 'WP Kuala Lumpur' + ), + 'labuan' => array( + 'Labuan' + ), + 'melaka' => array( + 'Malacca', + 'Melaka' + ), + 'nsembilan' => array( + 'Negeri Sembilan Darul Khusus', + 'Negeri Sembilan' + ), + 'pahang' => array( + 'Pahang Darul Makmur', + 'Pahang' + ), + 'penang' => array( + 'Penang', + 'Pulau Pinang' + ), + 'perak' => array( + 'Perak Darul Ridzuan', + 'Perak' + ), + 'perlis' => array( + 'Perlis Indera Kayangan', + 'Perlis' + ), + 'putrajaya' => array( + 'Putrajaya' + ), + 'sabah' => array( + 'Sabah' + ), + 'sarawak' => array( + 'Sarawak' + ), + 'selangor' => array( + 'Selangor Darul Ehsan', + 'Selangor' + ), + 'terengganu' => array( + 'Terengganu Darul Iman', + 'Terengganu' + ) + ); + + /** + * @link https://ms.wikipedia.org/wiki/Senarai_negara_berdaulat + */ + protected static $country = array( + 'Abkhazia','Afghanistan','Afrika Selatan','Republik Afrika Tengah','Akrotiri dan Dhekelia','Albania','Algeria','Amerika Syarikat','Andorra','Angola','Antigua dan Barbuda','Arab Saudi','Argentina','Armenia','Australia','Austria','Azerbaijan', + 'Bahamas','Bahrain','Bangladesh','Barbados','Belanda','Belarus','Belgium','Belize','Benin','Bhutan','Bolivia','Bonaire','Bosnia dan Herzegovina','Botswana','Brazil','Brunei Darussalam','Bulgaria','Burkina Faso','Burundi', + 'Cameroon','Chad','Chile','Republik Rakyat China','Republik China di Taiwan','Colombia','Comoros','Republik Demokratik Congo','Republik Congo','Kepulauan Cook','Costa Rica','Côte d\'Ivoire (Ivory Coast)','Croatia','Cuba','Curaçao','Cyprus','Republik Turki Cyprus Utara','Republik Czech', + 'Denmark','Djibouti','Dominika','Republik Dominika', + 'Ecuador','El Salvador','Emiriah Arab Bersatu','Eritrea','Estonia', + 'Kepulauan Faroe','Fiji','Filipina','Finland', + 'Gabon','Gambia','Georgia','Ghana','Grenada','Greece (Yunani)','Guatemala','Guinea','Guinea-Bissau','Guinea Khatulistiwa','Guiana Perancis','Guyana', + 'Habsyah (Etiopia)','Haiti','Honduras','Hungary', + 'Iceland','India','Indonesia','Iran','Iraq','Ireland','Israel','Itali', + 'Jamaika','Jepun','Jerman','Jordan', + 'Kanada','Kazakhstan','Kemboja','Kenya','Kiribati','Korea Selatan','Korea Utara','Kosovo','Kuwait','Kyrgyzstan', + 'Laos','Latvia','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Lubnan','Luxembourg', + 'Macedonia','Madagaskar','Maghribi','Malawi','Malaysia','Maldives','Mali','Malta','Kepulauan Marshall','Mauritania','Mauritius','Mesir','Mexico','Persekutuan Micronesia','Moldova','Monaco','Montenegro','Mongolia','Mozambique','Myanmar', + 'Namibia','Nauru','Nepal','New Zealand','Nicaragua','Niger','Nigeria','Niue','Norway', + 'Oman','Ossetia Selatan', + 'Pakistan','Palau','Palestin','Panama','Papua New Guinea','Paraguay','Perancis','Peru','Poland','Portugal', + 'Qatar', + 'Romania','Russia','Rwanda', + 'Sahara Barat','Saint Kitts dan Nevis','Saint Lucia','Saint Vincent dan Grenadines','Samoa','San Marino','São Tomé dan Príncipe','Scotland','Senegal','Sepanyol','Serbia','Seychelles','Sierra Leone','Singapura','Slovakia','Slovenia','Kepulauan Solomon','Somalia','Somaliland','Sri Lanka','Sudan','Sudan Selatan','Suriname','Swaziland','Sweden','Switzerland','Syria', + 'Tajikistan','Tanjung Verde','Tanzania','Thailand','Timor Leste','Togo','Tonga','Transnistria','Trinidad dan Tobago','Tunisia','Turki','Turkmenistan','Tuvalu', + 'Uganda','Ukraine','United Kingdom','Uruguay','Uzbekistan', + 'Vanuatu','Kota Vatican','Venezuela','Vietnam', + 'Yaman', + 'Zambia','Zimbabwe', + ); + + /** + * Return a building prefix + * + * @example 'No.' + * + * @return @string + */ + public static function buildingPrefix() + { + return static::randomElement(static::$buildingPrefix); + } + + /** + * Return a building number + * + * @example '123' + * + * @return @string + */ + public static function buildingNumber() + { + return static::toUpper(static::lexify(static::numerify(static::randomElement(static::$buildingNumber)))); + } + + /** + * Return a street prefix + * + * @example 'Jalan' + */ + public function streetPrefix() + { + $format = static::randomElement(static::$streetPrefix); + + return $this->generator->parse($format); + } + + /** + * Return a complete streename + * + * @example 'Jalan Utama 7' + * + * @return @string + */ + public function streetName() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$streetNameFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a randown township + * + * @example Taman Bahagia + * + * @return @string + */ + public function township() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$townshipFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a township prefix abbreviation + * + * @example 'USJ' + * + * @return @string + */ + public function townshipPrefixAbbr() + { + return static::randomElement(static::$townshipPrefixAbbr); + } + + /** + * Return a township prefix + * + * @example 'Taman' + * + * @return @string + */ + public function townshipPrefix() + { + return static::randomElement(static::$townshipPrefix); + } + + /** + * Return a township suffix + * + * @example 'Bahagia' + */ + public function townshipSuffix() + { + return static::randomElement(static::$townshipSuffix); + } + + /** + * Return a postcode based on state + * + * @example '55100' + * @link https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#States + * + * @param null|string $state 'state' or null + * + * @return @string + */ + public static function postcode($state = null) + { + $format = array( + 'perlis' => array( // (01000 - 02800) + '0' . mt_rand(1000, 2800) + ), + 'kedah' => array( // (05000 - 09810) + '0' . mt_rand(5000, 9810) + ), + 'penang' => array( // (10000 - 14400) + mt_rand(10000, 14400) + ), + 'kelantan' => array( // (15000 - 18500) + mt_rand(15000, 18500) + ), + 'terengganu' => array( // (20000 - 24300) + mt_rand(20000, 24300) + ), + 'pahang' => array( // (25000 - 28800 | 39000 - 39200 | 49000, 69000) + mt_rand(25000, 28800), + mt_rand(39000, 39200), + mt_rand(49000, 69000) + ), + 'perak' => array( // (30000 - 36810) + mt_rand(30000, 36810) + ), + 'selangor' => array( // (40000 - 48300 | 63000 - 68100) + mt_rand(40000, 48300), + mt_rand(63000, 68100) + ), + 'kl' => array( // (50000 - 60000) + mt_rand(50000, 60000), + ), + 'putrajaya' => array( // (62000 - 62988) + mt_rand(62000, 62988) + ), + 'nsembilan' => array( // (70000 - 73509) + mt_rand(70000, 73509) + ), + 'melaka' => array( // (75000 - 78309) + mt_rand(75000, 78309) + ), + 'johor' => array( // (79000 - 86900) + mt_rand(79000, 86900) + ), + 'labuan' => array( // (87000 - 87033) + mt_rand(87000, 87033) + ), + 'sabah' => array( // (88000 - 91309) + mt_rand(88000, 91309) + ), + 'sarawak' => array( // (93000 - 98859) + mt_rand(93000, 98859) + ) + ); + + $postcode = is_null($state) ? static::randomElement($format) : $format[$state]; + return (string)static::randomElement($postcode); + } + + /** + * Return the complete town address with matching postcode and state + * + * @example 55100 Bukit Bintang, Kuala Lumpur + * + * @return @string + */ + public function townState() + { + $state = static::randomElement(array_keys(static::$states)); + $postcode = static::postcode($state); + $town = static::randomElement(static::$towns[$state]); + $state = static::randomElement(static::$states[$state]); + + return $postcode . ' ' . $town . ', ' . $state; + } + + /** + * Return a random city (town) + * + * @example 'Ampang' + * + * @return @string + */ + public function city() + { + $state = static::randomElement(array_keys(static::$towns)); + return static::randomElement(static::$towns[$state]); + } + + /** + * Return a random state + * + * @example 'Johor' + * + * @return @string + */ + public function state() + { + $state = static::randomElement(array_keys(static::$states)); + return static::randomElement(static::$states[$state]); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php new file mode 100644 index 0000000..f2e2f5f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php @@ -0,0 +1,105 @@ +generator->parse($formats); + } + + /** + * Return Peninsular prefix alphabet + * + * @example 'W' + * + * @return @string + */ + public static function peninsularPrefix() + { + return static::randomElement(static::$peninsularPrefix); + } + + /** + * Return Sarawak state prefix alphabet + * + * @example 'QA' + * + * @return @string + */ + public static function sarawakPrefix() + { + return static::randomElement(static::$sarawakPrefix); + } + + /** + * Return Sabah state prefix alphabet + * + * @example 'SA' + * + * @return @string + */ + public static function sabahPrefix() + { + return static::randomElement(static::$sabahPrefix); + } + + /** + * Return specialty licence plate prefix + * + * @example 'G1M' + * + * @return @string + */ + public static function specialPrefix() + { + return static::randomElement(static::$specialPrefix); + } + + /** + * Return a valid license plate alphabet + * + * @example 'A' + * + * @return @string + */ + public static function validAlphabet() + { + return static::randomElement(static::$validAlphabets); + } + + /** + * Return a valid number sequence between 1 and 9999 + * + * @example '1234' + * + * @return @integer + */ + public static function numberSequence() + { + return mt_rand(1, 9999); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php new file mode 100644 index 0000000..b70a590 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php @@ -0,0 +1,244 @@ +generator->parse($formats); + } + + /** + * Return a Malaysian Bank account number + * + * @example '1234567890123456' + * + * @return @string + */ + public function bankAccountNumber() + { + $formats = static::randomElement(static::$bankAccountNumberFormats); + + return static::numerify($formats); + } + + /** + * Return a Malaysian Local Bank + * + * @example 'Public Bank' + * + * @return @string + */ + public static function localBank() + { + return static::randomElement(static::$localBanks); + } + + /** + * Return a Malaysian Foreign Bank + * + * @example 'Citibank Berhad' + * + * @return @string + */ + public static function foreignBank() + { + return static::randomElement(static::$foreignBanks); + } + + /** + * Return a Malaysian Government Bank + * + * @example 'Bank Simpanan Nasional' + * + * @return @string + */ + public static function governmentBank() + { + return static::randomElement(static::$governmentBanks); + } + + /** + * Return a Malaysian insurance company + * + * @example 'AIA Malaysia' + * + * @return @string + */ + public static function insurance() + { + return static::randomElement(static::$insuranceCompanies); + } + + /** + * Return a Malaysian Bank SWIFT Code + * + * @example 'MBBEMYKLXXX' + * + * @return @string + */ + public static function swiftCode() + { + return static::toUpper(static::lexify(static::randomElement(static::$swiftCodes))); + } + + /** + * Return the Malaysian currency symbol + * + * @example 'RM' + * + * @return @string + */ + public static function currencySymbol() + { + return static::randomElement(static::$currencySymbol); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php new file mode 100644 index 0000000..7dfaaac --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php @@ -0,0 +1,813 @@ +generator->parse(static::randomElement($formats)); + } + + /** + * Return a Malaysian I.C. No. + * + * @example '890123-45-6789' + * + * @link https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + * + * @param string|null $gender 'male', 'female' or null for any + * @param bool|string|null $hyphen true, false, or any separator characters + * + * @return string + */ + public static function myKadNumber($gender = null, $hyphen = false) + { + // year of birth + $yy = mt_rand(0, 99); + + // month of birth + $mm = DateTime::month(); + + // day of birth + $dd = DateTime::dayOfMonth(); + + // place of birth (1-59 except 17-20) + while (in_array(($pb = mt_rand(1, 59)), array(17, 18, 19, 20))) { + }; + + // random number + $nnn = mt_rand(0, 999); + + // gender digit. Odd = MALE, Even = FEMALE + $g = mt_rand(0, 9); + //Credit: https://gist.github.com/mauris/3629548 + if ($gender === static::GENDER_MALE) { + $g = $g | 1; + } elseif ($gender === static::GENDER_FEMALE) { + $g = $g & ~1; + } + + // formatting with hyphen + if ($hyphen === true) { + $hyphen = "-"; + } else if ($hyphen === false) { + $hyphen = ""; + } + + return sprintf("%02d%02d%02d%s%02d%s%03d%01d", $yy, $mm, $dd, $hyphen, $pb, $hyphen, $nnn, $g); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php new file mode 100644 index 0000000..ad199c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php @@ -0,0 +1,217 @@ +generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return prefix digits for 011 numbers + * + * @example '10' + * + * @return string + */ + public static function zeroOneOnePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneOnePrefix)); + } + + /** + * Return prefix digits for 014 numbers + * + * @example '2' + * + * @return string + */ + public static function zeroOneFourPrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFourPrefix)); + } + + /** + * Return prefix digits for 015 numbers + * + * @example '1' + * + * @return string + */ + public static function zeroOneFivePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFivePrefix)); + } + + /** + * Return a Malaysian Fixed Line Phone Number. + * + * @example '+603-4567-8912' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function fixedLineNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$fixedLineNumberFormatsWithFormatting); + } else { + $format = static::randomElement(static::$fixedLineNumberFormats); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return a Malaysian VoIP Phone Number. + * + * @example '+6015-678-9234' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function voipNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$voipNumberWithFormatting); + } else { + $format = static::randomElement(static::$voipNumber); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return a Malaysian Country Code Prefix. + * + * @example '+6' + * + * @param bool $formatting true, false + * + * @return string + */ + public static function countryCodePrefix($formatting = true) + { + if ($formatting) { + return static::randomElement(static::$plusSymbol) . static::randomElement(static::$countryCodePrefix); + } else { + return static::randomElement(static::$countryCodePrefix); + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php new file mode 100644 index 0000000..d1d8c9e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php @@ -0,0 +1,195 @@ +format('dmy'); + + /** + * @todo These number should be random based on birth year + * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $randomDigits = (string)static::numerify('##'); + + switch($gender) { + case static::GENDER_MALE: + $genderDigit = static::randomElement(array(1,3,5,7,9)); + break; + case static::GENDER_FEMALE: + $genderDigit = static::randomElement(array(0,2,4,6,8)); + break; + default: + $genderDigit = (string)static::numerify('#'); + } + + + $digits = $datePart.$randomDigits.$genderDigit; + + /** + * @todo Calculate modulo 11 of $digits + * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $checksum = (string)static::numerify('##'); + + + return $digits.$checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php new file mode 100644 index 0000000..9be2993 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php @@ -0,0 +1,22 @@ +format('ymd')); + $help = $date->format('Y') >= 2000 ? 2 : null; + + $check = intval($help.$dob.$middle); + $rest = sprintf('%02d', 97 - ($check % 97)); + + return $dob.$middle.$rest; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php new file mode 100644 index 0000000..ac17f1b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php @@ -0,0 +1,20 @@ + 9) { + if ($nr[1] > 0) { + $nr[0] = 8; + $nr[1]--; + } else { + $nr[0] = 1; + $nr[1]++; + + } + } + return implode('', array_reverse($nr)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php new file mode 100644 index 0000000..c27fe9b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php @@ -0,0 +1,39 @@ + 'Narodowy Bank Polski', + '102' => 'Powszechna Kasa Oszczędności Bank Polski SA', + '103' => 'Bank Handlowy w Warszawie SA', + '105' => 'ING Bank Śląski SA', + '106' => 'Bank BPH SA', + '109' => 'Bank Zachodni WBK SA', + '113' => 'Bank Gospodarstwa Krajowego', + '114' => 'mBank SA', + '116' => 'Bank Millennium SA', + '122' => 'Bank Handlowo-Kredytowy Spółka Akcyjna w Katowicach w likwidacji', + '124' => 'Bank Polska Kasa Opieki SA', + '128' => 'HSBC Bank Polska SA', + '132' => 'Bank Pocztowy SA', + '147' => 'Euro Bank SA', + '154' => 'Bank Ochrony Środowiska SA', + '158' => 'Mercedes-Benz Bank Polska SA', + '161' => 'SGB-Bank SA', + '167' => 'RBS Bank (Polska) SA', + '168' => 'PLUS BANK SA', + '175' => 'Raiffeisen Bank Polska SA', + '184' => 'Societe Generale SA Oddział w Polsce', + '187' => 'Nest Bank S.A.', + '189' => 'Pekao Bank Hipoteczny SA', + '191' => 'Deutsche Bank Polska SA', + '193' => 'BANK POLSKIEJ SPÓŁDZIELCZOŚCI SA', + '194' => 'Credit Agricole Bank Polska SA', + '195' => 'Idea Bank SA', + '203' => 'Bank BGŻ BNP Paribas SA', + '212' => 'Santander Consumer Bank SA', + '213' => 'VOLKSWAGEN BANK POLSKA SA', + '214' => 'FCA-Group Bank Polska SA', + '215' => 'mBank Hipoteczny SA', + '216' => 'Toyota Bank Polska SA', + '219' => 'DNB Bank Polska SA', + '224' => 'Banque PSA Finance SA Oddział w Polsce', + '225' => 'Svenska Handelsbanken AB SA Oddział w Polsce', + '229' => 'BPI Bank Polskich Inwestycji SA', + '232' => 'Nykredit Realkredit A/S SA - Oddział w Polsce', + '235' => 'BNP PARIBAS SA Oddział w Polsce', + '236' => 'Danske Bank A/S SA Oddział w Polsce', + '237' => 'Skandinaviska Enskilda Banken AB (SA) - Oddział w Polsce', + '239' => 'CAIXABANK, S.A. (SPÓŁKA AKCYJNA)ODDZIAŁ W POLSCE', + '241' => 'Elavon Financial Services Designated Activity Company (spółka z o.o. o wyznaczonym przedmiocie działalności) Oddział w Polsce', + '243' => 'BNP Paribas Securities Services SKA Oddział w Polsce', + '247' => 'HAITONG BANK, S.A. Spółka Akcyjna Oddział w Polsce', + '248' => 'Getin Noble Bank SA', + '249' => 'Alior Bank SA', + '251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - Oddział w Polsce', + '254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) Oddział w Polsce', + '255' => 'Ikano Bank AB (publ) Spółka Akcyjna Oddział w Polsce', + '256' => 'Nordea Bank AB SA Oddział w Polsce', + '257' => 'UBS Limited (spółka z ograniczoną odpowiedzialnością) Oddział w Polsce', + '258' => 'J.P. Morgan Europe Limited Sp. z o.o. Oddział w Polsce', + '260' => 'Bank of China (Luxembourg) S.A. Spółka Akcyjna Oddział w Polsce', + '262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '263' => 'Saxo Bank A/S Spółka Akcyjna Oddział w Polsce w likwidacji', + '264' => 'RCI Banque Spółka Akcyjna Oddział w Polsce', + '265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - Oddział w Polsce', + '266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna Oddział w Polsce', + '267' => 'Western Union International Bank GmbH, Sp. z o.o. Oddział w Polsce', + '269' => 'PKO Bank Hipoteczny SA', + '270' => 'TF BANK AB (Spółka z ograniczoną odpowiedzialnością) Oddział w Polsce', + '271' => 'FCE Bank Spółka Akcyjna Oddział w Polsce', + '272' => 'AS Inbank Spółka Akcyjna - Oddział w Polsce', + '273' => 'China Construction Bank (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '274' => 'MUFG Bank (Europe) N.V. S.A. Oddział w Polsce', + '275' => 'John Deere Bank S.A. Spółka Akcyjna Oddział w Polsce', + ); + + /** + * @example 'Euro Bank SA' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } + + /** + * International Bank Account Number (IBAN) + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + protected static function addBankCodeChecksum($iban, $countryCode = 'PL') + { + if ($countryCode != 'PL' || strlen($iban) <= 8) { + return $iban; + } + $checksum = 0; + $weights = array(7, 1, 3, 9, 7, 1, 3); + for ($i = 0; $i < 7; $i++) { + $checksum += $weights[$i] * (int) $iban[$i]; + } + $checksum = $checksum % 10; + + return substr($iban, 0, 7) . $checksum . substr($iban, 8); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php new file mode 100644 index 0000000..380f4d9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php @@ -0,0 +1,227 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + public function title($gender = null) + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleMale() + { + return static::title(); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleFemale() + { + return static::title(); + } + + /** + * PESEL - Universal Electronic System for Registration of the Population + * @link http://en.wikipedia.org/wiki/PESEL + * @param DateTime $birthdate + * @param string $sex M for male or F for female + * @return string 11 digit number, like 44051401358 + */ + public static function pesel($birthdate = null, $sex = null) + { + if ($birthdate === null) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $weights = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3); + $length = count($weights); + + $fullYear = (int) $birthdate->format('Y'); + $year = (int) $birthdate->format('y'); + $month = $birthdate->format('m') + (((int) ($fullYear/100) - 14) % 5) * 20; + $day = $birthdate->format('d'); + + $result = array((int) ($year / 10), $year % 10, (int) ($month / 10), $month % 10, (int) ($day / 10), $day % 10); + + for ($i = 6; $i < $length; $i++) { + $result[$i] = static::randomDigit(); + } + + $result[$length - 1] |= 1; + if ($sex == "F") { + $result[$length - 1] -= 1; + } + + $checksum = 0; + for ($i = 0; $i < $length; $i++) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum = (10 - ($checksum % 10)) % 10; + $result[] = $checksum; + + return implode('', $result); + } + + /** + * National Identity Card number + * @link http://en.wikipedia.org/wiki/Polish_National_Identity_Card + * @return string 3 letters and 6 digits, like ABA300000 + */ + public static function personalIdentityNumber() + { + $range = str_split("ABCDEFGHIJKLMNPRSTUVWXYZ"); + $low = array("A", static::randomElement($range), static::randomElement($range)); + $high = array(static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit()); + $weights = array(7, 3, 1, 7, 3, 1, 7, 3); + $checksum = 0; + for ($i = 0, $size = count($low); $i < $size; $i++) { + $checksum += $weights[$i] * (ord($low[$i]) - 55); + } + for ($i = 0, $size = count($high); $i < $size; $i++) { + $checksum += $weights[$i+3] * $high[$i]; + } + $checksum %= 10; + + return implode('', $low).$checksum.implode('', $high); + } + + /** + * Taxpayer Identification Number (NIP in Polish) + * @link http://en.wikipedia.org/wiki/PESEL#Other_identifiers + * @link http://pl.wikipedia.org/wiki/NIP + * @return string 10 digit number + */ + public static function taxpayerIdentificationNumber() + { + $weights = array(6, 5, 7, 2, 3, 4, 5, 6, 7); + $result = array(); + do { + $result = array( + static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigitNotNull(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + ); + $checksum = 0; + for ($i = 0, $size = count($result); $i < $size; $i++) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum %= 11; + } while ($checksum == 10); + $result[] = $checksum; + + return implode('', $result); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php new file mode 100644 index 0000000..65bc5c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php @@ -0,0 +1,18 @@ + + + Prof. Hart will answer or forward your message. + + We would prefer to send you information by email. + + + **The Legal Small Print** + + + (Three Pages) + + ***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN EBOOKS**START*** + Why is this "Small Print!" statement here? You know: lawyers. + They tell us you might sue us if there is something wrong with + your copy of this eBook, even if you got it for free from + someone other than us, and even if what's wrong is not our + fault. So, among other things, this "Small Print!" statement + disclaims most of our liability to you. It also tells you how + you may distribute copies of this eBook if you want to. + + *BEFORE!* YOU USE OR READ THIS EBOOK + By using or reading any part of this PROJECT GUTENBERG-tm + eBook, you indicate that you understand, agree to and accept + this "Small Print!" statement. If you do not, you can receive + a refund of the money (if any) you paid for this eBook by + sending a request within 30 days of receiving it to the person + you got it from. If you received this eBook on a physical + medium (such as a disk), you must return it with your request. + + ABOUT PROJECT GUTENBERG-TM EBOOKS + This PROJECT GUTENBERG-tm eBook, like most PROJECT GUTENBERG-tm eBooks, + is a "public domain" work distributed by Professor Michael S. Hart + through the Project Gutenberg Association (the "Project"). + Among other things, this means that no one owns a United States copyright + on or for this work, so the Project (and you!) can copy and + distribute it in the United States without permission and + without paying copyright royalties. Special rules, set forth + below, apply if you wish to copy and distribute this eBook + under the "PROJECT GUTENBERG" trademark. + + Please do not use the "PROJECT GUTENBERG" trademark to market + any commercial products without permission. + + To create these eBooks, the Project expends considerable + efforts to identify, transcribe and proofread public domain + works. Despite these efforts, the Project's eBooks and any + medium they may be on may contain "Defects". Among other + things, Defects may take the form of incomplete, inaccurate or + corrupt data, transcription errors, a copyright or other + intellectual property infringement, a defective or damaged + disk or other eBook medium, a computer virus, or computer + codes that damage or cannot be read by your equipment. + + LIMITED WARRANTY; DISCLAIMER OF DAMAGES + But for the "Right of Replacement or Refund" described below, + [1] Michael Hart and the Foundation (and any other party you may + receive this eBook from as a PROJECT GUTENBERG-tm eBook) disclaims + all liability to you for damages, costs and expenses, including + legal fees, and [2] YOU HAVE NO REMEDIES FOR NEGLIGENCE OR + UNDER STRICT LIABILITY, OR FOR BREACH OF WARRANTY OR CONTRACT, + INCLUDING BUT NOT LIMITED TO INDIRECT, CONSEQUENTIAL, PUNITIVE + OR INCIDENTAL DAMAGES, EVEN IF YOU GIVE NOTICE OF THE + POSSIBILITY OF SUCH DAMAGES. + + If you discover a Defect in this eBook within 90 days of + receiving it, you can receive a refund of the money (if any) + you paid for it by sending an explanatory note within that + time to the person you received it from. If you received it + on a physical medium, you must return it with your note, and + such person may choose to alternatively give you a replacement + copy. If you received it electronically, such person may + choose to alternatively give you a second opportunity to + receive it electronically. + + THIS EBOOK IS OTHERWISE PROVIDED TO YOU "AS-IS". NO OTHER + WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ARE MADE TO YOU AS + TO THE EBOOK OR ANY MEDIUM IT MAY BE ON, INCLUDING BUT NOT + LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A + PARTICULAR PURPOSE. + + Some states do not allow disclaimers of implied warranties or + the exclusion or limitation of consequential damages, so the + above disclaimers and exclusions may not apply to you, and you + may have other legal rights. + + INDEMNITY + You will indemnify and hold Michael Hart, the Foundation, + and its trustees and agents, and any volunteers associated + with the production and distribution of Project Gutenberg-tm + texts harmless, from all liability, cost and expense, including + legal fees, that arise directly or indirectly from any of the + following that you do or cause: [1] distribution of this eBook, + [2] alteration, modification, or addition to the eBook, + or [3] any Defect. + + DISTRIBUTION UNDER "PROJECT GUTENBERG-tm" + You may distribute copies of this eBook electronically, or by + disk, book or any other medium if you either delete this + "Small Print!" and all other references to Project Gutenberg, + or: + + [1] Only give exact copies of it. Among other things, this + requires that you do not remove, alter or modify the + eBook or this "small print!" statement. You may however, + if you wish, distribute this eBook in machine readable + binary, compressed, mark-up, or proprietary form, + including any form resulting from conversion by word + processing or hypertext software, but only so long as + *EITHER*: + + [*] The eBook, when displayed, is clearly readable, and + does *not* contain characters other than those + intended by the author of the work, although tilde + (~), asterisk (*) and underline (_) characters may + be used to convey punctuation intended by the + author, and additional characters may be used to + indicate hypertext links; OR + + [*] The eBook may be readily converted by the reader at + no expense into plain ASCII, EBCDIC or equivalent + form by the program that displays the eBook (as is + the case, for instance, with most word processors); + OR + + [*] You provide, or agree to also provide on request at + no additional cost, fee or expense, a copy of the + eBook in its original plain ASCII form (or in EBCDIC + or other equivalent proprietary form). + + [2] Honor the eBook refund and replacement provisions of this + "Small Print!" statement. + + [3] Pay a trademark license fee to the Foundation of 20% of the + gross profits you derive calculated using the method you + already use to calculate your applicable taxes. If you + don't derive profits, no royalty is due. Royalties are + payable to "Project Gutenberg Literary Archive Foundation" + the 60 days following each date you prepare (or were + legally required to prepare) your annual (or equivalent + periodic) tax return. Please contact us beforehand to + let us know your plans and to work out the details. + + WHAT IF YOU *WANT* TO SEND MONEY EVEN IF YOU DON'T HAVE TO? + Project Gutenberg is dedicated to increasing the number of + public domain and licensed works that can be freely distributed + in machine readable form. + + The Project gratefully accepts contributions of money, time, + public domain materials, or royalty free copyright licenses. + Money should be paid to the: + "Project Gutenberg Literary Archive Foundation." + + If you are interested in contributing scanning equipment or + software or other items, please contact Michael Hart at: + hart@pobox.com + + [Portions of this eBook's header and trailer may be reprinted only + when distributed free of all fees. Copyright (C) 2001, 2002 by + Michael S. Hart. Project Gutenberg is a TradeMark and may not be + used in any sales of Project Gutenberg eBooks or other materials be + they hardware or software or any other related product without + express permission.] + + *END THE SMALL PRINT! FOR PUBLIC DOMAIN EBOOKS*Ver.02/11/02*END* + + */ +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php new file mode 100644 index 0000000..68b6df0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php @@ -0,0 +1,154 @@ +generator->numerify('########0001'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php new file mode 100644 index 0000000..7481a6f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php @@ -0,0 +1,9 @@ + array( + "4##############" + ), + 'MasterCard' => array( + "5##############" + ), + 'American Express' => array( + "34############", + "37############" + ), + 'Discover Card' => array( + "6011###########", + "622############", + "64#############", + "65#############" + ), + 'Diners' => array( + "301############", + "301##########", + "305############", + "305##########", + "36#############", + "36###########", + "38#############", + "38###########", + ), + 'Elo' => array( + "636368#########", + "438935#########", + "504175#########", + "451416#########", + "636297#########", + "5067###########", + "4576###########", + "4011###########", + ), + 'Hipercard' => array( + "38#############", + "60#############", + ), + "Aura" => array( + "50#############" + ) + ); + + /** + * International Bank Account Number (IBAN) + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php new file mode 100644 index 0000000..be39a2e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php @@ -0,0 +1,133 @@ +generator->numerify('#########'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($n)) : $n; + } + + /** + * A random RG number, following Sao Paulo state's rules. + * @link http://pt.wikipedia.org/wiki/C%C3%A9dula_de_identidade + * @param bool $formatted If the number should have dots/dashes or not. + * @return string + */ + public function rg($formatted = true) + { + $n = $this->generator->numerify('########'); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d.%d%d%d.%d%d%d-%s', str_split($n)) : $n; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php new file mode 100644 index 0000000..4949eef --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php @@ -0,0 +1,137 @@ + '')); + } + + return $number; + } + + /** + * Generates an 9-digit landline number without formatting characters. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function landline($formatted = true) + { + $number = static::numerify(static::randomElement(static::$landlineFormats)); + + if (!$formatted) { + $number = strtr($number, array('-' => '')); + } + + return $number; + } + + /** + * Randomizes between cellphone and landline numbers. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return mixed + */ + public static function phone($formatted = true) + { + $options = static::randomElement(array( + array('cellphone', false), + array('cellphone', true), + array('landline', null), + )); + + return call_user_func("static::{$options[0]}", $formatted, $options[1]); + } + + /** + * Generates a complete phone number. + * @param string $type [def: landline] One of "landline" or "cellphone". Defaults to "landline" on invalid values. + * @param bool $formatted [def: true] If the number should be formatted or not. + * @return string + */ + protected static function anyPhoneNumber($type, $formatted = true) + { + $area = static::areaCode(); + $number = ($type == 'cellphone')? + static::cellphone($formatted) : + static::landline($formatted); + + return $formatted? "($area) $number" : $area.$number; + } + + /** + * Concatenates {@link areaCode} and {@link cellphone} into a national cellphone number. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function cellphoneNumber($formatted = true) + { + return static::anyPhoneNumber('cellphone', $formatted); + } + + /** + * Concatenates {@link areaCode} and {@link landline} into a national landline number. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function landlineNumber($formatted = true) + { + return static::anyPhoneNumber('landline', $formatted); + } + + /** + * Randomizes between complete cellphone and landline numbers. + * @return mixed + */ + public function phoneNumber() + { + $method = static::randomElement(array('cellphoneNumber', 'landlineNumber')); + return call_user_func("static::$method", true); + } + + /** + * Randomizes between complete cellphone and landline numbers, cleared from formatting symbols. + * @return mixed + */ + public static function phoneNumberCleared() + { + $method = static::randomElement(array('cellphoneNumber', 'landlineNumber')); + return call_user_func("static::$method", false); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php new file mode 100644 index 0000000..ab67db9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php @@ -0,0 +1,35 @@ += 12; + $verifier = 0; + + for ($i = 1; $i <= $length; $i++) { + if (!$second_algorithm) { + $multiplier = $i+1; + } else { + $multiplier = ($i >= 9)? $i-7 : $i+1; + } + $verifier += $numbers[$length-$i] * $multiplier; + } + + $verifier = 11 - ($verifier % 11); + if ($verifier >= 10) { + $verifier = 0; + } + + return $verifier; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php new file mode 100644 index 0000000..a6e1009 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php @@ -0,0 +1,124 @@ + 0; $i--) { + $numbers[$i] = substr($number, $i - 1, 1); + $partial[$i] = $numbers[$i] * $factor; + $sum += $partial[$i]; + if ($factor == $base) { + $factor = 1; + } + $factor++; + } + $res = $sum % 11; + + if ($res == 0 || $res == 1) { + $digit = 0; + } else { + $digit = 11 - $res; + } + + return $digit; + } + + /** + * + * @link http://nomesportugueses.blogspot.pt/2012/01/lista-dos-cem-nomes-mais-usados-em.html + */ + + protected static $firstNameMale = array( + 'Rodrigo', 'João', 'Martim', 'Afonso', 'Tomás', 'Gonçalo', 'Francisco', 'Tiago', + 'Diogo', 'Guilherme', 'Pedro', 'Miguel', 'Rafael', 'Gabriel', 'Santiago', 'Dinis', + 'David', 'Duarte', 'José', 'Simão', 'Daniel', 'Lucas', 'Gustavo', 'André', 'Denis', + 'Salvador', 'António', 'Vasco', 'Henrique', 'Lourenço', 'Manuel', 'Eduardo', 'Bernardo', + 'Leandro', 'Luís', 'Diego', 'Leonardo', 'Alexandre', 'Rúben', 'Mateus', 'Ricardo', + 'Vicente', 'Filipe', 'Bruno', 'Nuno', 'Carlos', 'Rui', 'Hugo', 'Samuel', 'Álvaro', + 'Matias', 'Fábio', 'Ivo', 'Paulo', 'Jorge', 'Xavier', 'Marco', 'Isaac', 'Raúl','Benjamim', + 'Renato', 'Artur', 'Mário', 'Frederico', 'Cristiano', 'Ivan', 'Sérgio', 'Micael', + 'Vítor', 'Edgar', 'Kevin', 'Joaquim', 'Igor', 'Ângelo', 'Enzo', 'Valentim', 'Flávio', + 'Joel', 'Fernando', 'Sebastião', 'Tomé', 'César', 'Cláudio', 'Nelson', 'Lisandro', 'Jaime', + 'Gil', 'Mauro', 'Sandro', 'Hélder', 'Matheus', 'William', 'Gaspar', 'Márcio', + 'Martinho', 'Emanuel', 'Marcos', 'Telmo', 'Davi', 'Wilson' + ); + + protected static $firstNameFemale = array( + 'Maria', 'Leonor', 'Matilde', 'Mariana', 'Ana', 'Beatriz', 'Inês', 'Lara', 'Carolina', 'Margarida', + 'Joana', 'Sofia', 'Diana', 'Francisca', 'Laura', 'Sara', 'Madalena', 'Rita', 'Mafalda', 'Catarina', + 'Luana', 'Marta', 'Íris', 'Alice', 'Bianca', 'Constança', 'Gabriela', 'Eva', 'Clara', 'Bruna', 'Daniela', + 'Iara', 'Filipa', 'Vitória', 'Ariana', 'Letícia', 'Bárbara', 'Camila', 'Rafaela', 'Carlota', 'Yara', + 'Núria', 'Raquel', 'Ema', 'Helena', 'Benedita', 'Érica', 'Isabel', 'Nicole', 'Lia', 'Alícia', 'Mara', + 'Jéssica', 'Soraia', 'Júlia', 'Luna', 'Victória', 'Luísa', 'Teresa', 'Miriam', 'Adriana', 'Melissa', + 'Andreia', 'Juliana', 'Alexandra', 'Yasmin', 'Tatiana', 'Leticia', 'Luciana', 'Eduarda', 'Cláudia', + 'Débora', 'Fabiana', 'Renata', 'Kyara', 'Kelly', 'Irina', 'Mélanie', 'Nádia', 'Cristiana', 'Liliana', + 'Patrícia', 'Vera', 'Doriana', 'Ângela', 'Mia', 'Erica', 'Mónica', 'Isabela', 'Salomé', 'Cátia', + 'Verónica', 'Violeta', 'Lorena', 'Érika', 'Vanessa', 'Iris', 'Anna', 'Viviane', 'Rebeca', 'Neuza', + ); + + protected static $lastName = array( + 'Abreu', 'Almeida', 'Alves', 'Amaral', 'Amorim', 'Andrade', 'Anjos', 'Antunes', 'Araújo', 'Assunção', + 'Azevedo', 'Baptista', 'Barbosa', 'Barros', 'Batista', 'Borges', 'Branco', 'Brito', 'Campos', 'Cardoso', + 'Carneiro', 'Carvalho', 'Castro', 'Coelho', 'Correia', 'Costa', 'Cruz', 'Cunha', 'Domingues', 'Esteves', + 'Faria', 'Fernandes', 'Ferreira', 'Figueiredo', 'Fonseca', 'Freitas', 'Garcia', 'Gaspar', 'Gomes', + 'Gonçalves', 'Guerreiro', 'Henriques', 'Jesus', 'Leal', 'Leite', 'Lima', 'Lopes', 'Loureiro', 'Lourenço', + 'Macedo', 'Machado', 'Magalhães', 'Maia', 'Marques', 'Martins', 'Matias', 'Matos', 'Melo', 'Mendes', + 'Miranda', 'Monteiro', 'Morais', 'Moreira', 'Mota', 'Moura', 'Nascimento', 'Neto', 'Neves', 'Nogueira', + 'Nunes', 'Oliveira', 'Pacheco', 'Paiva', 'Pereira', 'Pinheiro', 'Pinho', 'Pinto', 'Pires', 'Ramos', + 'Reis', 'Ribeiro', 'Rocha', 'Rodrigues', 'Santos', 'Silva', 'Simões', 'Soares', 'Sousa', + 'Sá', 'Tavares', 'Teixeira', 'Torres', 'Valente', 'Vaz', 'Vicente', 'Vieira', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php new file mode 100644 index 0000000..618a01c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php @@ -0,0 +1,50 @@ +generator->parse($format); + } + + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php new file mode 100644 index 0000000..5fb9543 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + /** + * @example 'Cluj' + */ + public function county() + { + return static::randomElement(static::$counties); + } + + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php new file mode 100644 index 0000000..980e8bb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php @@ -0,0 +1,19 @@ + '01', 'AR' => '02', 'AG' => '03', 'B' => '40', 'BC' => '04', 'BH' => '05', + 'BN' => '06', 'BT' => '07', 'BV' => '08', 'BR' => '09', 'BZ' => '10', 'CS' => '11', + 'CL' => '51', 'CJ' => '12', 'CT' => '13', 'CV' => '14', 'DB' => '15', 'DJ' => '16', + 'GL' => '17', 'GR' => '52', 'GJ' => '18', 'HR' => '19', 'HD' => '20', 'IL' => '21', + 'IS' => '22', 'IF' => '23', 'MM' => '24', 'MH' => '25', 'MS' => '26', 'NT' => '27', + 'OT' => '28', 'PH' => '29', 'SM' => '30', 'SJ' => '31', 'SB' => '32', 'SV' => '33', + 'TR' => '34', 'TM' => '35', 'TL' => '36', 'VS' => '37', 'VL' => '38', 'VN' => '39', + + 'B1' => '41', 'B2' => '42', 'B3' => '43', 'B4' => '44', 'B5' => '45', 'B6' => '46' + ); + + /** + * Personal Numerical Code (CNP) + * + * @link http://ro.wikipedia.org/wiki/Cod_numeric_personal + * @example 1111111111118 + * + * @param null|string $gender Person::GENDER_MALE or Person::GENDER_FEMALE + * @param null|string $dateOfBirth (1800-2099) 'Y-m-d', 'Y-m', 'Y' I.E. '1981-06-16', '2085-03', '1900' + * @param null|string $county county code where the CNP was issued + * @param null|bool $isResident flag if the person resides in Romania + * @return string 13 digits CNP code + */ + public function cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true) + { + $genders = array(Person::GENDER_MALE, Person::GENDER_FEMALE); + if (empty($gender)) { + $gender = static::randomElement($genders); + } elseif (!in_array($gender, $genders)) { + throw new \InvalidArgumentException("Gender must be '{Person::GENDER_MALE}' or '{Person::GENDER_FEMALE}'"); + } + + $date = $this->getDateOfBirth($dateOfBirth); + + if (is_null($county)) { + $countyCode = static::randomElement(array_values(static::$cnpCountyCodes)); + } elseif (!array_key_exists($county, static::$cnpCountyCodes)) { + throw new \InvalidArgumentException("Invalid county code '{$county}' received"); + } else { + $countyCode = static::$cnpCountyCodes[$county]; + } + + $cnp = (string)$this->getGenderDigit($date, $gender, $isResident) + . $date->format('ymd') + . $countyCode + . static::numerify('##%') + ; + + $checksum = $this->getChecksumDigit($cnp); + + return $cnp.$checksum; + } + + /** + * @param $dateOfBirth + * @return \DateTime + */ + protected function getDateOfBirth($dateOfBirth) + { + if (empty($dateOfBirth)) { + $dateOfBirthParts = array(static::numberBetween(1800, 2099)); + } else { + $dateOfBirthParts = explode('-', $dateOfBirth); + } + $baseDate = \Faker\Provider\DateTime::dateTimeBetween("first day of {$dateOfBirthParts[0]}", "last day of {$dateOfBirthParts[0]}"); + + switch (count($dateOfBirthParts)) { + case 1: + $dateOfBirthParts[] = $baseDate->format('m'); + //don't break, we need the day also + case 2: + $dateOfBirthParts[] = $baseDate->format('d'); + //don't break, next line will + case 3: + break; + default: + throw new \InvalidArgumentException("Invalid date of birth - must be null or in the 'Y-m-d', 'Y-m', 'Y' format"); + } + + if ($dateOfBirthParts[0] < 1800 || $dateOfBirthParts[0] > 2099) { + throw new \InvalidArgumentException("Invalid date of birth - year must be between 1900 and 2099, '{$dateOfBirthParts[0]}' received"); + } + + $dateOfBirthFinal = implode('-', $dateOfBirthParts); + $date = \DateTime::createFromFormat('Y-m-d', $dateOfBirthFinal); + //a full (invalid) date might have been supplied, check if it converts + if ($date->format('Y-m-d') !== $dateOfBirthFinal) { + throw new \InvalidArgumentException("Invalid date of birth - '{$date->format('Y-m-d')}' generated based on '{$dateOfBirth}' received"); + } + + return $date; + } + + /** + * + * https://ro.wikipedia.org/wiki/Cod_numeric_personal#S + * + * @param \DateTime $dateOfBirth + * @param bool $isResident + * @param string $gender + * @return int + */ + protected static function getGenderDigit(\DateTime $dateOfBirth, $gender, $isResident) + { + if (!$isResident) { + return 9; + } + + if ($dateOfBirth->format('Y') < 1900) { + if ($gender == Person::GENDER_MALE) { + return 3; + } + return 4; + } + + if ($dateOfBirth->format('Y') < 2000) { + if ($gender == Person::GENDER_MALE) { + return 1; + } + return 2; + } + + if ($gender == Person::GENDER_MALE) { + return 5; + } + return 6; + } + + /** + * Calculates a checksum for the Personal Numerical Code (CNP). + * + * @param string $value 12 digit CNP + * @return int checksum digit + */ + protected function getChecksumDigit($value) + { + $checkNumber = 279146358279; + + $checksum = 0; + foreach (range(0, 11) as $digit) { + $checksum += (int)substr($value, $digit, 1) * (int)substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + + return $checksum == 10 ? 1 : $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php new file mode 100644 index 0000000..e8af810 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php @@ -0,0 +1,67 @@ + array( + '021#######', // Bucharest + '023#######', + '024#######', + '025#######', + '026#######', + '027#######', // non-geographic + '031#######', // Bucharest + '033#######', + '034#######', + '035#######', + '036#######', + '037#######', // non-geographic + ), + 'mobile' => array( + '07########', + ) + ); + + protected static $specialFormats = array( + 'toll-free' => array( + '0800######', + '0801######', // shared-cost numbers + '0802######', // personal numbering + '0806######', // virtual cards + '0807######', // pre-paid cards + '0870######', // internet dial-up + ), + 'premium-rate' => array( + '0900######', + '0903######', // financial information + '0906######', // adult entertainment + ) + ); + + /** + * @link http://en.wikipedia.org/wiki/Telephone_numbers_in_Romania#Last_years + */ + public function phoneNumber() + { + $type = static::randomElement(array_keys(static::$normalFormats)); + $number = static::numerify(static::randomElement(static::$normalFormats[$type])); + + return $number; + } + + public static function tollFreePhoneNumber() + { + $number = static::numerify(static::randomElement(static::$specialFormats['toll-free'])); + + return $number; + } + + public static function premiumRatePhoneNumber() + { + $number = static::numerify(static::randomElement(static::$specialFormats['premium-rate'])); + + return $number; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php new file mode 100644 index 0000000..410c6f9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php @@ -0,0 +1,154 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php new file mode 100644 index 0000000..e1af033 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + public static function inn($area_code = "") + { + if ($area_code === "" || intval($area_code) == 0) { + //Simple generation code for areas in Russian without check for valid + $area_code = static::numberBetween(1, 91); + } else { + $area_code = intval($area_code); + } + $area_code = str_pad($area_code, 2, '0', STR_PAD_LEFT); + $inn_base = $area_code . static::numerify('#######'); + return $inn_base . \Faker\Calculator\Inn::checksum($inn_base); + } + + public static function kpp($inn = "") + { + if ($inn == "" || strlen($inn) < 4) { + $inn = static::inn(); + } + return substr($inn, 0, 4) . "01001"; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php new file mode 100644 index 0000000..53870ee --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php @@ -0,0 +1,9 @@ +.*<' | \ + * sed -r 's/—//' | sed -r 's/[\<\>]//g' | sed -r "s/(^|$)/'/g" | sed -r 's/$/,/' | sed -r 's/\&(laquo|raquo);/"/g' | \ + * sed -r 's/\s+/ /g'" + */ + protected static $banks = array( + 'Новый Промышленный Банк', + 'Новый Символ', + 'Нокссбанк', + 'Ноосфера', + 'Нордеа Банк', + 'Нота-Банк', + 'НС Банк', + 'НСТ-Банк', + 'Нэклис-Банк', + 'Образование', + 'Объединенный Банк Промышленных Инвестиций', + 'Объединенный Банк Республики', + 'Объединенный Капитал', + 'Объединенный Кредитный Банк', + 'Объединенный Кредитный Банк Московский филиал', + 'Объединенный Национальный Банк', + 'Объединенный Резервный Банк', + 'Океан Банк', + 'ОЛМА-Банк', + 'Онего', + 'Оней Банк', + 'ОПМ-Банк', + 'Оргбанк', + 'Оренбург', + 'ОТП Банк', + 'ОФК Банк', + 'Охабанк', + 'Первобанк', + 'Первомайский', + 'Первоуральскбанк', + 'Первый Дортрансбанк', + 'Первый Инвестиционный банк', + 'Первый Клиентский Банк', + 'Первый Чешско-Российский Банк', + 'Пересвет', + 'Пермь', + 'Петербургский Социальный Коммерческий Банк', + 'Петрокоммерц', + 'ПИР Банк', + 'Платина', + 'Плато-Банк', + 'Плюс Банк', + 'Пойдем!', + 'Почтобанк', + 'Прайм Финанс', + 'Преодоление', + 'Приморье', + 'Примсоцбанк', + 'Примтеркомбанк', + 'Прио-Внешторгбанк', + 'Приобье', + 'Приполярный', + 'Приско Капитал Банк', + 'Пробизнесбанк', + 'Проинвестбанк', + 'Прокоммерцбанк', + 'Проминвестбанк', + 'Промрегионбанк', + 'Промсвязьбанк', + 'Промсвязьинвестбанк', + 'Промсельхозбанк', + 'Промтрансбанк', + 'Промышленно-Финансовое Сотрудничество', + 'Промэнергобанк', + 'Профессионал Банк', + 'Профит Банк', + 'Прохладный', + 'Пульс Столицы', + 'Радиотехбанк', + 'Развитие', + 'Развитие-Столица', + 'Райффайзенбанк', + 'Расчетно-Кредитный Банк', + 'Расчетный Дом', + 'РБА', + 'Региональный Банк Развития', + 'Региональный Банк Сбережений', + 'Региональный Коммерческий Банк', + 'Региональный Кредит', + 'Регионфинансбанк', + 'Регнум', + 'Резерв', + 'Ренессанс', + 'Ренессанс Кредит', + 'Рента-Банк', + 'РЕСО Кредит', + 'Республиканский Кредитный Альянс', + 'Ресурс-Траст', + 'Риабанк', + 'Риал-Кредит', + 'Ринвестбанк', + 'Ринвестбанк Московский офис', + 'РИТ-Банк', + 'РН Банк', + 'Росавтобанк', + 'Росбанк', + 'Росбизнесбанк', + 'Росгосстрах Банк', + 'Росдорбанк', + 'РосЕвроБанк', + 'РосинтерБанк', + 'Роспромбанк', + 'Россельхозбанк', + 'Российская Финансовая Корпорация', + 'Российский Капитал', + 'Российский Кредит', + 'Российский Национальный Коммерческий Банк', + 'Россита-Банк', + 'Россия', + 'Рост Банк', + 'Ростфинанс', + 'Росэксимбанк', + 'Росэнергобанк', + 'Роял Кредит Банк', + 'РСКБ', + 'РТС-Банк', + 'РУБанк', + 'Рублев', + 'Руна-Банк', + 'Рунэтбанк', + 'Рускобанк', + 'Руснарбанк', + 'Русский Банк Сбережений', + 'Русский Ипотечный Банк', + 'Русский Международный Банк', + 'Русский Национальный Банк', + 'Русский Стандарт', + 'Русский Торговый Банк', + 'Русский Трастовый Банк', + 'Русский Финансовый Альянс', + 'Русский Элитарный Банк', + 'Русславбанк', + 'Руссобанк', + 'Русстройбанк', + 'Русфинанс Банк', + 'Русь', + 'РусьРегионБанк', + 'Русьуниверсалбанк', + 'РусЮгбанк', + 'РФИ Банк', + 'Саммит Банк', + 'Санкт-Петербургский Банк Инвестиций', + 'Саратов', + 'Саровбизнесбанк', + 'Сбербанк России', + 'Связной Банк', + 'Связь-Банк', + 'СДМ-Банк', + 'Севастопольский Морской банк', + 'Северный Кредит', + 'Северный Народный Банк', + 'Северо-Восточный Альянс', + 'Северо-Западный 1 Альянс Банк', + 'Северстройбанк', + 'Севзапинвестпромбанк', + 'Сельмашбанк', + 'Сервис-Резерв', + 'Сетелем Банк', + 'СИАБ', + 'Сибирский Банк Реконструкции и Развития', + 'Сибнефтебанк', + 'Сибсоцбанк', + 'Сибэс', + 'Сибэс Московский офис', + 'Синергия', + 'Синко-Банк', + 'Система', + 'Сити Инвест Банк', + 'Ситибанк', + 'СКА-Банк', + 'СКБ-Банк', + 'Славия', + 'Славянбанк', + 'Славянский Кредит', + 'Смартбанк', + 'СМБ-Банк', + 'Смолевич', + 'СМП Банк', + 'Снежинский', + 'Собинбанк', + 'Соверен Банк', + 'Советский', + 'Совкомбанк', + 'Современные Стандарты Бизнеса', + 'Содружество', + 'Соколовский', + 'Солид Банк', + 'Солидарность (Москва)', + 'Солидарность (Самара)', + 'Социнвестбанк', + 'Социнвестбанк Московский филиал', + 'Социум-Банк', + 'Союз', + 'Союзный', + 'Спецстройбанк', + 'Спиритбанк', + 'Спурт Банк', + 'Спутник', + 'Ставропольпромстройбанк', + 'Сталь Банк', + 'Стандарт-Кредит', + 'Стар Альянс', + 'СтарБанк', + 'Старооскольский Агропромбанк', + 'Старый Кремль', + 'Стелла-Банк', + 'Столичный Кредит', + 'Стратегия', + 'Строительно-Коммерческий Банк', + 'Стройлесбанк', + 'Сумитомо Мицуи', + 'Сургутнефтегазбанк', + 'СЭБ Банк', + 'Таатта', + 'Таврический', + 'Таганрогбанк', + 'Тагилбанк', + 'Тайдон', + 'Тайм Банк', + 'Тальменка-Банк', + 'Тальменка-Банк Московский филиал', + 'Тамбовкредитпромбанк', + 'Татагропромбанк', + 'Татсоцбанк', + 'Татфондбанк', + 'Таурус Банк', + 'ТверьУниверсалБанк', + 'Тексбанк', + 'Темпбанк', + 'Тендер-Банк', + 'Терра', + 'Тетраполис', + 'Тимер Банк', + 'Тинькофф Банк', + 'Тихоокеанский Внешторгбанк', + 'Тойота Банк', + 'Тольяттихимбанк', + 'Томскпромстройбанк', + 'Торгово-Промышленный Банк Китая', + 'Торговый Городской Банк', + 'Торжокуниверсалбанк', + 'Транскапиталбанк', + 'Транснациональный Банк', + 'Транспортный', + 'Трансстройбанк', + 'Траст Капитал Банк', + 'Тройка-Д Банк', + 'Тульский Промышленник', + 'Тульский Промышленник Московский офис', + 'Тульский Расчетный Центр', + 'Турбобанк', + 'Тусар', + 'ТЭМБР-Банк', + 'ТЭСТ', + 'Углеметбанк', + 'Уздан', + 'Унифин', + 'Унифондбанк', + 'Уралкапиталбанк', + 'Уралприватбанк', + 'Уралпромбанк', + 'Уралсиб', + 'Уралтрансбанк', + 'Уралфинанс', + 'Уральский Банк Реконструкции и Развития', + 'Уральский Межрегиональный Банк', + 'Уральский Финансовый Дом', + 'Ури Банк', + 'Уссури', + 'ФДБ', + 'ФИА-Банк', + 'Финам Банк', + 'Финанс Бизнес Банк', + 'Финансово-Промышленный Капитал', + 'Финансовый Капитал', + 'Финансовый Стандарт', + 'Финарс Банк', + 'Финпромбанк (ФПБ Банк)', + 'Финтрастбанк', + 'ФК Открытие (бывш. НОМОС-Банк)', + 'Флора-Москва', + 'Фольксваген Банк Рус', + 'Фондсервисбанк', + 'Фора-Банк', + 'Форбанк', + 'Форус Банк', + 'Форштадт', + 'Фьючер', + 'Хакасский Муниципальный Банк', + 'Ханты-Мансийский банк Открытие', + 'Химик', + 'Хлынов', + 'Хованский', + 'Холдинвестбанк', + 'Холмск', + 'Хоум Кредит Банк', + 'Центр-инвест', + 'Центрально-Азиатский', + 'Центрально-Европейский Банк', + 'Центркомбанк', + 'ЦентроКредит', + 'Церих', + 'Чайна Констракшн', + 'Чайнасельхозбанк', + 'Челиндбанк', + 'Челябинвестбанк', + 'Черноморский банк развития и реконструкции', + 'Чувашкредитпромбанк', + 'Эйч-Эс-Би-Си Банк (HSBC)', + 'Эко-Инвест', + 'Экономбанк', + 'Экономикс-Банк', + 'Экси-Банк', + 'Эксперт Банк', + 'Экспобанк', + 'Экспресс-Волга', + 'Экспресс-Кредит', + 'Эл Банк', + 'Элита', + 'Эльбин', + 'Энергобанк', + 'Энергомашбанк', + 'Энерготрансбанк', + 'Эно', + 'Энтузиастбанк', + 'Эргобанк', + 'Ю Би Эс Банк', + 'ЮГ-Инвестбанк', + 'Югра', + 'Южный Региональный Банк', + 'ЮМК', + 'Юниаструм Банк', + 'ЮниКредит Банк', + 'Юнистрим', + 'Япы Креди Банк Москва', + 'ЯР-Банк', + 'Яринтербанк', + 'Ярославич', + 'K2 Банк', + 'АББ', + 'Абсолют Банк', + 'Авангард', + 'Аверс', + 'Автоградбанк', + 'АвтоКредитБанк', + 'Автоторгбанк', + 'Агроинкомбанк', + 'Агропромкредит', + 'Агророс', + 'Агросоюз', + 'Адамон Банк', + 'Адамон Банк Московский филиал', + 'Аделантбанк', + 'Адмиралтейский', + 'Азиатско-Тихоокеанский Банк', + 'Азимут', + 'Азия Банк', + 'Азия-Инвест Банк', + 'Ай-Си-Ай-Си-Ай Банк (ICICI)', + 'Айви Банк', + 'АйМаниБанк', + 'Ак Барс', + 'Акибанк', + 'Аккобанк', + 'Акрополь', + 'Аксонбанк', + 'Актив Банк', + 'АктивКапитал Банк', + 'АктивКапитал Банк Московский филиал', + 'АктивКапитал Банк Санкт-Петербургский филиал', + 'Акцент', + 'Акцепт', + 'Акция', + 'Алданзолотобанк', + 'Александровский', + 'Алеф-Банк', + 'Алжан', + 'Алмазэргиэнбанк', + 'АлтайБизнес-Банк', + 'Алтайкапиталбанк', + 'Алтынбанк', + 'Альба Альянс', + 'Альта-Банк', + 'Альтернатива', + 'Альфа-Банк', + 'АМБ Банк', + 'Америкэн Экспресс Банк', + 'Анелик РУ', + 'Анкор Банк', + 'Анталбанк', + 'Апабанк', + 'Аресбанк', + 'Арзамас', + 'Арксбанк', + 'Арсенал', + 'Аспект', + 'Ассоциация', + 'БайкалБанк', + 'БайкалИнвестБанк', + 'Байкалкредобанк', + 'Балаково-Банк', + 'Балтийский Банк', + 'Балтика', + 'Балтинвестбанк', + 'Банк "Акцент" Московский филиал', + 'Банк "МБА-Москва"', + 'Банк "Санкт-Петербург"', + 'Банк АВБ', + 'Банк БКФ', + 'Банк БФА', + 'Банк БЦК-Москва', + 'Банк Город', + 'Банк Жилищного Финансирования', + 'Банк Инноваций и Развития', + 'Банк Интеза', + 'Банк ИТБ', + 'Банк Казани', + 'Банк Китая (Элос)', + 'Банк Кредит Свисс', + 'Банк МБФИ', + 'Банк Москвы', + 'Банк на Красных Воротах', + 'Банк Оранжевый (бывш. Промсервисбанк)', + 'Банк оф Токио-Мицубиси', + 'Банк Премьер Кредит', + 'Банк ПСА Финанс Рус', + 'Банк Развития Технологий', + 'Банк Расчетов и Сбережений', + 'Банк Раунд', + 'Банк РСИ', + 'Банк Сберегательно-кредитного сервиса', + 'Банк СГБ', + 'Банк Торгового Финансирования', + 'Банк Финсервис', + 'Банк Экономический Союз', + 'Банкирский Дом', + 'Банкхаус Эрбе', + 'Башкомснаббанк', + 'Башпромбанк', + 'ББР Банк', + 'Белгородсоцбанк', + 'Бенифит-Банк', + 'Берейт', + 'Бест Эффортс Банк', + 'Бизнес для Бизнеса', + 'Бинбанк', + 'БИНБАНК кредитные карты', + 'Бинбанк Мурманск', + 'БКС Инвестиционный Банк', + 'БМВ Банк', + 'БНП Париба Банк', + 'Богородский', + 'Богородский Муниципальный Банк', + 'Братский АНКБ', + 'БСТ-Банк', + 'Булгар Банк', + 'Бум-Банк', + 'Бумеранг', + 'БФГ-Кредит', + 'БыстроБанк', + 'Вакобанк', + 'Вега-Банк', + 'Век', + 'Великие Луки Банк', + 'Венец', + 'Верхневолжский', + 'Верхневолжский Крымский филиал', + 'Верхневолжский Московский филиал', + 'Верхневолжский Невский филиал', + 'Верхневолжский Таврический филиал', + 'Верхневолжский Ярославский филиал', + 'Веста', + 'Вестинтербанк', + 'Взаимодействие', + 'Викинг', + 'Витабанк', + 'Витязь', + 'Вкабанк', + 'Владбизнесбанк', + 'Владпромбанк', + 'Внешпромбанк', + 'Внешфинбанк', + 'Внешэкономбанк', + 'Военно-Промышленный Банк', + 'Возрождение', + 'Вокбанк', + 'Вологдабанк', + 'Вологжанин', + 'Воронеж', + 'Восточно-Европейский Трастовый Банк', + 'Восточный Экспресс Банк', + 'ВостСибтранскомбанк', + 'ВРБ Москва', + 'Всероссийский Банк Развития Регионов', + 'ВТБ', + 'ВТБ 24', + 'ВУЗ-Банк', + 'Выборг-Банк', + 'Выборг-Банк Московский филиал', + 'Вэлтон Банк', + 'Вятич', + 'Вятка-Банк', + 'Гагаринский', + 'Газбанк', + 'Газнефтьбанк', + 'Газпромбанк', + 'Газстройбанк', + 'Газтрансбанк', + 'Газэнергобанк', + 'Ганзакомбанк', + 'Гарант-Инвест', + 'Гаранти Банк Москва', + 'Геленджик-Банк', + 'Генбанк', + 'Геобанк', + 'Гефест', + 'Глобус', + 'Глобэкс', + 'Голдман Сакс Банк', + 'Горбанк', + 'ГПБ-Ипотека', + 'Гранд Инвест Банк', + 'Гринкомбанк', + 'Гринфилдбанк', + 'Грис-Банк', + 'Гута-Банк', + 'Далена', + 'Далетбанк', + 'Далта-Банк', + 'Дальневосточный Банк', + 'Данске Банк', + 'Девон-Кредит', + 'ДельтаКредит', + 'Денизбанк Москва', + 'Держава', + 'Дж. П. Морган Банк', + 'Джаст Банк', + 'Джей энд Ти Банк', + 'Дил-Банк', + 'Динамичные Системы', + 'Дойче Банк', + 'Долинск', + 'Дом-Банк', + 'Дон-Тексбанк', + 'Донкомбанк', + 'Донхлеббанк', + 'Дорис Банк', + 'Дружба', + 'ЕАТП Банк', + 'Евразийский Банк', + 'Евроазиатский Инвестиционный Банк', + 'ЕвроАксис Банк', + 'Евроальянс', + 'Еврокапитал-Альянс', + 'Еврокоммерц', + 'Еврокредит', + 'Евромет', + 'Европейский Стандарт', + 'Европлан Банк', + 'ЕвроситиБанк', + 'Еврофинанс Моснарбанк', + 'Единственный', + 'Единый Строительный Банк', + 'Екатеринбург', + 'Екатерининский', + 'Енисей', + 'Енисейский Объединенный Банк', + 'Ермак', + 'Живаго-Банк', + 'Жилкредит', + 'Жилстройбанк', + 'Запсибкомбанк', + 'Заречье', + 'Заубер Банк', + 'Земкомбанк', + 'Земский Банк', + 'Зенит', + 'Зенит Сочи', + 'Зернобанк', + 'Зираат Банк', + 'Златкомбанк', + 'И.Д.Е.А. Банк', + 'Иваново', + 'Идеалбанк', + 'Ижкомбанк', + 'ИК Банк', + 'Икано Банк', + 'Инбанк', + 'Инвест-Экобанк', + 'Инвестиционный Банк Кубани', + 'Инвестиционный Республиканский Банк', + 'Инвестиционный Союз', + 'Инвесткапиталбанк', + 'Инвестсоцбанк', + 'Инвестторгбанк', + 'ИНГ Банк', + 'Индустриальный Сберегательный Банк', + 'Инкаробанк', + 'Интерактивный Банк', + 'Интеркоммерц Банк', + 'Интеркоопбанк', + 'Интеркредит', + 'Интернациональный Торговый Банк', + 'Интерпрогрессбанк', + 'Интерпромбанк', + 'Интехбанк', + 'Информпрогресс', + 'Ипозембанк', + 'ИпоТек Банк', + 'Иронбанк', + 'ИРС', + 'Итуруп', + 'Ишбанк', + 'Йошкар-Ола', + 'Калуга', + 'Камский Горизонт', + 'Камский Коммерческий Банк', + 'Камчаткомагропромбанк', + 'Канский', + 'Капитал', + 'Капиталбанк', + 'Кедр', + 'Кемсоцинбанк', + 'Кетовский Коммерческий Банк', + 'Киви Банк', + 'Классик Эконом Банк', + 'Клиентский', + 'Кольцо Урала', + 'Коммерцбанк (Евразия)', + 'Коммерческий Банк Развития', + 'Коммерческий Индо Банк', + 'Консервативный Коммерческий Банк', + 'Констанс-Банк', + 'Континенталь', + 'Конфидэнс Банк', + 'Кор', + 'Кореа Эксчендж Банк Рус', + 'Королевский Банк Шотландии', + 'Космос', + 'Костромаселькомбанк', + 'Кошелев-Банк', + 'Крайинвестбанк', + 'Кранбанк', + 'Креди Агриколь КИБ', + 'Кредит Европа Банк', + 'Кредит Урал Банк', + 'Кредит Экспресс', + 'Кредит-Москва', + 'Кредитинвест', + 'Кредо Финанс', + 'Кредпромбанк', + 'Кремлевский', + 'Крокус-Банк', + 'Крона-Банк', + 'Кросна-Банк', + 'Кроссинвестбанк', + 'Крыловский', + 'КС Банк', + 'Кубанский Универсальный Банк', + 'Кубань Кредит', + 'Кубаньторгбанк', + 'Кузбассхимбанк', + 'Кузнецкбизнесбанк', + 'Кузнецкий', + 'Кузнецкий Мост', + 'Курган', + 'Курскпромбанк', + 'Лада-Кредит', + 'Лайтбанк', + 'Ланта-Банк', + 'Левобережный', + 'Легион', + 'Леноблбанк', + 'Лесбанк', + 'Лето Банк', + 'Липецккомбанк', + 'Логос', + 'Локо-Банк', + 'Лэнд-Банк', + 'М2М Прайвет Банк', + 'Майкопбанк', + 'Майский', + 'МАК-Банк', + 'Максима', + 'Максимум', + 'МАСТ-Банк', + 'Мастер-Капитал', + 'МВС Банк', + 'МДМ Банк', + 'Мегаполис', + 'Международный Акционерный Банк', + 'Международный Банк Развития', + 'Международный Банк Санкт-Петербурга (МБСП)', + 'Международный Коммерческий Банк', + 'Международный Расчетный Банк', + 'Международный Строительный Банк', + 'Международный Финансовый Клуб', + 'Межотраслевая Банковская Корпорация', + 'Межрегиональный Банк Реконструкции', + 'Межрегиональный Клиринговый Банк', + 'Межрегиональный Почтовый Банк', + 'Межрегиональный промышленно-строительный банк', + 'Межрегионбанк', + 'Межтопэнергобанк', + 'Межтрастбанк', + 'Мерседес-Бенц Банк Рус', + 'Металлинвестбанк', + 'Металлург', + 'Меткомбанк (Каменск-Уральский)', + 'Меткомбанк (Череповец)', + 'Метробанк', + 'Метрополь', + 'Мидзухо Банк', + 'Мико-Банк', + 'Милбанк', + 'Миллениум Банк', + 'Мир Бизнес Банк', + 'Мираф-Банк', + 'Мираф-Банк Московский филиал', + 'Миръ', + 'Михайловский ПЖСБ', + 'Морган Стэнли Банк', + 'Морской Банк', + 'Мосводоканалбанк', + 'Москва', + 'Москва-Сити', + 'Московский Вексельный Банк', + 'Московский Индустриальный Банк', + 'Московский Коммерческий Банк', + 'Московский Кредитный Банк', + 'Московский Национальный Инвестиционный Банк', + 'Московский Нефтехимический Банк', + 'Московский Областной Банк', + 'Московско-Парижский Банк', + 'Московское Ипотечное Агентство', + 'Москоммерцбанк', + 'Мосстройэкономбанк (М Банк)', + 'Мострансбанк', + 'Мосуралбанк', + 'МС Банк Рус', + 'МСП Банк', + 'МТИ-Банк', + 'МТС Банк', + 'Муниципальный Камчатпрофитбанк', + 'Мурманский Социальный Коммерческий Банк', + 'МФБанк', + 'Н-Банк', + 'Нальчик', + 'Наратбанк', + 'Народный Банк', + 'Народный Банк Республики Тыва', + 'Народный Доверительный Банк', + 'Народный Земельно-Промышленный Банк', + 'Народный Инвестиционный Банк', + 'Натиксис Банк', + 'Нацинвестпромбанк', + 'Национальная Факторинговая Компания', + 'Национальный Банк "Траст"', + 'Национальный Банк Взаимного Кредита', + 'Национальный Банк Сбережений', + 'Национальный Залоговый Банк', + 'Национальный Клиринговый Банк', + 'Национальный Клиринговый Центр', + 'Национальный Корпоративный Банк', + 'Национальный Резервный Банк', + 'Национальный Стандарт', + 'Наш Дом', + 'НБД-Банк', + 'НБК-Банк', + 'Невастройинвест', + 'Невский Банк', + 'Нейва', + 'Нерюнгрибанк', + 'Нефтепромбанк', + 'Нефтяной Альянс', + 'Нижневолжский Коммерческий Банк', + 'Нико-Банк', + 'НК Банк', + 'НоваховКапиталБанк', + 'Новация', + 'Новикомбанк', + 'Новобанк', + 'Новое Время', + 'Новокиб', + 'Новопокровский', + 'Новый Век', + 'Новый Кредитный Союз', + 'Новый Московский Банк', + ); + + /** + * @example 'Новый Московский Банк' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php new file mode 100644 index 0000000..25ebd5a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php @@ -0,0 +1,157 @@ +middleNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement(array( + static::GENDER_MALE, + static::GENDER_FEMALE, + ))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php new file mode 100644 index 0000000..c7477d7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * @example 'PhD' + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php new file mode 100644 index 0000000..1baf7cc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php @@ -0,0 +1,15 @@ +format('ymd'); + + if ($gender && $gender == static::GENDER_MALE) { + $randomDigits = (string)static::numerify('##') . static::randomElement(array(1,3,5,7,9)); + } elseif ($gender && $gender == static::GENDER_FEMALE) { + $randomDigits = (string)static::numerify('##') . static::randomElement(array(0,2,4,6,8)); + } else { + $randomDigits = (string)static::numerify('###'); + } + + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php new file mode 100644 index 0000000..d15e5dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php @@ -0,0 +1,37 @@ +format('a') === 'am' ? 'öö' : 'ös'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => 'Pazar', + 'Monday' => 'Pazartesi', + 'Tuesday' => 'Salı', + 'Wednesday' => 'Çarşamba', + 'Thursday' => 'Perşembe', + 'Friday' => 'Cuma', + 'Saturday' => 'Cumartesi', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => 'Ocak', + 'February' => 'Şubat', + 'March' => 'Mart', + 'April' => 'Nisan', + 'May' => 'Mayıs', + 'June' => 'Haziran', + 'July' => 'Temmuz', + 'August' => 'Ağustos', + 'September' => 'Eylül', + 'October' => 'Ekim', + 'November' => 'Kasım', + 'December' => 'Aralık', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php new file mode 100644 index 0000000..ef907d4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php @@ -0,0 +1,9 @@ +generator->parse($format); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php new file mode 100644 index 0000000..197cc3b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public static function companyName() + { + return static::randomElement(static::$companyName); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php new file mode 100644 index 0000000..33214d6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php @@ -0,0 +1,9 @@ +middleNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement(array( + static::GENDER_MALE, + static::GENDER_FEMALE, + ))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php new file mode 100644 index 0000000..24187f3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php @@ -0,0 +1,51 @@ +generator->parse($format)); + } + + public function hamletPrefix() + { + return static::randomElement(static::$hamletPrefix); + } + + public function wardName() + { + $format = static::randomElement(static::$wardNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function wardPrefix() + { + return static::randomElement(static::$wardPrefix); + } + + public function districtName() + { + $format = static::randomElement(static::$districtNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function districtPrefix() + { + return static::randomElement(static::$districtPrefix); + } + + /** + * @example 'Hà Nội' + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example 'Bắc Giang' + */ + public static function province() + { + return static::randomElement(static::$province); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php new file mode 100644 index 0000000..4deaa2f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php @@ -0,0 +1,36 @@ +generator->parse(static::randomElement(static::$middleNameFormat)); + } + + public static function middleNameMale() + { + return static::randomElement(static::$middleNameMale); + } + + public static function middleNameFemale() + { + return static::randomElement(static::$middleNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php new file mode 100644 index 0000000..5f9f60a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php @@ -0,0 +1,61 @@ + array( + '0[a] ### ####', + '(0[a]) ### ####', + '0[a]-###-####', + '(0[a])###-####', + '84-[a]-###-####', + '(84)([a])###-####', + '+84-[a]-###-####', + ), + '8' => array( + '0[a] #### ####', + '(0[a]) #### ####', + '0[a]-####-####', + '(0[a])####-####', + '84-[a]-####-####', + '(84)([a])####-####', + '+84-[a]-####-####', + ), + ); + + public function phoneNumber() + { + $areaCode = static::randomElement(static::$areaCodes); + $areaCodeLength = strlen($areaCode); + $digits = 7; + + if ($areaCodeLength < 2) { + $digits = 8; + } + + return static::numerify(str_replace('[a]', $areaCode, static::randomElement(static::$formats[$digits]))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php new file mode 100644 index 0000000..19d1c94 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php @@ -0,0 +1,149 @@ +city() . static::area(); + } + + public static function postcode() + { + $prefix = str_pad(mt_rand(1, 85), 2, 0, STR_PAD_LEFT); + $suffix = '00'; + + return $prefix . mt_rand(10, 88) . $suffix; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php new file mode 100644 index 0000000..12d29e3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php @@ -0,0 +1,66 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php new file mode 100644 index 0000000..ca10822 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php @@ -0,0 +1,24 @@ + array( + '板橋區', '三重區', '中和區', '永和區', + '新莊區', '新店區', '樹林區', '鶯歌區', + '三峽區', '淡水區', '汐止區', '瑞芳區', + '土城區', '蘆洲區', '五股區', '泰山區', + '林口區', '深坑區', '石碇區', '坪林區', + '三芝區', '石門區', '八里區', '平溪區', + '雙溪區', '貢寮區', '金山區', '萬里區', + '烏來區', + ), + '宜蘭縣' => array( + '宜蘭市', '羅東鎮', '蘇澳鎮', '頭城鎮', '礁溪鄉', + '壯圍鄉', '員山鄉', '冬山鄉', '五結鄉', '三星鄉', + '大同鄉', '南澳鄉', + ), + '桃園市' => array( + '桃園區', '中壢區', '大溪區', '楊梅區', '蘆竹區', + '大園區', '龜山區', '八德區', '龍潭區', '平鎮區', + '新屋區', '觀音區', '復興區', + ), + '新竹縣' => array( + '竹北市', '竹東鎮', '新埔鎮', '關西鎮', '湖口鄉', + '新豐鄉', '芎林鄉', '橫山鄉', '北埔鄉', '寶山鄉', + '峨眉鄉', '尖石鄉', '五峰鄉', + ), + '苗栗縣' => array( + '苗栗市', '苑裡鎮', '通霄鎮', '竹南鎮', '頭份鎮', + '後龍鎮', '卓蘭鎮', '大湖鄉', '公館鄉', '銅鑼鄉', + '南庄鄉', '頭屋鄉', '三義鄉', '西湖鄉', '造橋鄉', + '三灣鄉', '獅潭鄉', '泰安鄉', + ), + '臺中市' => array( + '豐原區', '東勢區', '大甲區', '清水區', '沙鹿區', + '梧棲區', '后里區', '神岡區', '潭子區', '大雅區', + '新社區', '石岡區', '外埔區', '大安區', '烏日區', + '大肚區', '龍井區', '霧峰區', '太平區', '大里區', + '和平區', '中區', '東區', '南區', '西區', '北區', + '西屯區', '南屯區', '北屯區', + ), + '彰化縣' => array( + '彰化市', '鹿港鎮', '和美鎮', '線西鄉', '伸港鄉', + '福興鄉', '秀水鄉', '花壇鄉', '芬園鄉', '員林鎮', + '溪湖鎮', '田中鎮', '大村鄉', '埔鹽鄉', '埔心鄉', + '永靖鄉', '社頭鄉', '二水鄉', '北斗鎮', '二林鎮', + '田尾鄉', '埤頭鄉', '芳苑鄉', '大城鄉', '竹塘鄉', + '溪州鄉', + ), + '南投縣' => array( + '南投市', '埔里鎮', '草屯鎮', '竹山鎮', '集集鎮', + '名間鄉', '鹿谷鄉', '中寮鄉', '魚池鄉', '國姓鄉', + '水里鄉', '信義鄉', '仁愛鄉', + ), + '雲林縣' => array( + '斗六市', '斗南鎮', '虎尾鎮', '西螺鎮', '土庫鎮', + '北港鎮', '古坑鄉', '大埤鄉', '莿桐鄉', '林內鄉', + '二崙鄉', '崙背鄉', '麥寮鄉', '東勢鄉', '褒忠鄉', + '臺西鄉', '元長鄉', '四湖鄉', '口湖鄉', '水林鄉', + ), + '嘉義縣' => array( + '太保市', '朴子市', '布袋鎮', '大林鎮', '民雄鄉', + '溪口鄉', '新港鄉', '六腳鄉', '東石鄉', '義竹鄉', + '鹿草鄉', '水上鄉', '中埔鄉', '竹崎鄉', '梅山鄉', + '番路鄉', '大埔鄉', '阿里山鄉', + ), + '臺南市' => array( + '新營區', '鹽水區', '白河區', '柳營區', '後壁區', + '東山區', '麻豆區', '下營區', '六甲區', '官田區', + '大內區', '佳里區', '學甲區', '西港區', '七股區', + '將軍區', '北門區', '新化區', '善化區', '新市區', + '安定區', '山上區', '玉井區', '楠西區', '南化區', + '左鎮區', '仁德區', '歸仁區', '關廟區', '龍崎區', + '永康區', '東區', '南區', '西區', '北區', '中區', + '安南區', '安平區', + ), + '高雄市' => array( + '鳳山區', '林園區', '大寮區', '大樹區', '大社區', + '仁武區', '鳥松區', '岡山區', '橋頭區', '燕巢區', + '田寮區', '阿蓮區', '路竹區', '湖內區', '茄萣區', + '永安區', '彌陀區', '梓官區', '旗山區', '美濃區', + '六龜區', '甲仙區', '杉林區', '內門區', '茂林區', + '桃源區', '三民區', '鹽埕區', '鼓山區', '左營區', + '楠梓區', '三民區', '新興區', '前金區', '苓雅區', + '前鎮區', '旗津區', '小港區', + ), + '屏東縣' => array( + '屏東市', '潮州鎮', '東港鎮', '恆春鎮', '萬丹鄉', + '長治鄉', '麟洛鄉', '九如鄉', '里港鄉', '鹽埔鄉', + '高樹鄉', '萬巒鄉', '內埔鄉', '竹田鄉', '新埤鄉', + '枋寮鄉', '新園鄉', '崁頂鄉', '林邊鄉', '南州鄉', + '佳冬鄉', '琉球鄉', '車城鄉', '滿州鄉', '枋山鄉', + '三地門鄉', '霧臺鄉', '瑪家鄉', '泰武鄉', '來義鄉', + '春日鄉', '獅子鄉', '牡丹鄉', + ), + '臺東縣' => array( + '臺東市', '成功鎮', '關山鎮', '卑南鄉', '鹿野鄉', + '池上鄉', '東河鄉', '長濱鄉', '太麻里鄉', '大武鄉', + '綠島鄉', '海端鄉', '延平鄉', '金峰鄉', '達仁鄉', + '蘭嶼鄉', + ), + '花蓮縣' => array( + '花蓮市', '鳳林鎮', '玉里鎮', '新城鄉', '吉安鄉', + '壽豐鄉', '光復鄉', '豐濱鄉', '瑞穗鄉', '富里鄉', + '秀林鄉', '萬榮鄉', '卓溪鄉', + ), + '澎湖縣' => array( + '馬公市', '湖西鄉', '白沙鄉', '西嶼鄉', '望安鄉', + '七美鄉', + ), + '基隆市' => array( + '中正區', '七堵區', '暖暖區', '仁愛區', '中山區', + '安樂區', '信義區', + ), + '新竹市' => array( + '東區', '北區', '香山區', + ), + '嘉義市' => array( + '東區', '西區', + ), + '臺北市' => array( + '松山區', '信義區', '大安區', '中山區', '中正區', + '大同區', '萬華區', '文山區', '南港區', '內湖區', + '士林區', '北投區', + ), + '連江縣' => array( + '南竿鄉', '北竿鄉', '莒光鄉', '東引鄉', + ), + '金門縣' => array( + '金城鎮', '金沙鎮', '金湖鎮', '金寧鄉', '烈嶼鄉', '烏坵鄉', + ), + ); + + /** + * @link http://terms.naer.edu.tw/download/287/ + */ + protected static $country = array( + '不丹', '中非', '丹麥', '伊朗', '冰島', '剛果', + '加彭', '北韓', '南非', '卡達', '印尼', '印度', + '古巴', '哥德', '埃及', '多哥', '寮國', '尼日', + '巴曼', '巴林', '巴紐', '巴西', '希臘', '帛琉', + '德國', '挪威', '捷克', '教廷', '斐濟', '日本', + '智利', '東加', '查德', '汶萊', '法國', '波蘭', + '波赫', '泰國', '海地', '瑞典', '瑞士', '祕魯', + '秘魯', '約旦', '紐埃', '緬甸', '美國', '聖尼', + '聖普', '肯亞', '芬蘭', '英國', '荷蘭', '葉門', + '蘇丹', '諾魯', '貝南', '越南', '迦彭', + '迦納', '阿曼', '阿聯', '韓國', '馬利', + '以色列', '以色利', '伊拉克', '俄羅斯', + '利比亞', '加拿大', '匈牙利', '南極洲', + '南蘇丹', '厄瓜多', '吉布地', '吐瓦魯', + '哈撒克', '哈薩克', '喀麥隆', '喬治亞', + '土庫曼', '土耳其', '塔吉克', '塞席爾', + '墨西哥', '大西洋', '奧地利', '孟加拉', + '安哥拉', '安地卡', '安道爾', '尚比亞', + '尼伯爾', '尼泊爾', '巴哈馬', '巴拉圭', + '巴拿馬', '巴貝多', '幾內亞', '愛爾蘭', + '所在國', '摩洛哥', '摩納哥', '敍利亞', + '敘利亞', '新加坡', '東帝汶', '柬埔寨', + '比利時', '波扎那', '波札那', '烏克蘭', + '烏干達', '烏拉圭', '牙買加', '獅子山', + '甘比亞', '盧安達', '盧森堡', '科威特', + '科索夫', '科索沃', '立陶宛', '紐西蘭', + '維德角', '義大利', '聖文森', '艾塞亞', + '菲律賓', '萬那杜', '葡萄牙', '蒲隆地', + '蓋亞納', '薩摩亞', '蘇利南', '西班牙', + '貝里斯', '賴索托', '辛巴威', '阿富汗', + '阿根廷', '馬其頓', '馬拉威', '馬爾他', + '黎巴嫩', '亞塞拜然', '亞美尼亞', '保加利亞', + '南斯拉夫', '厄利垂亞', '史瓦濟蘭', '吉爾吉斯', + '吉里巴斯', '哥倫比亞', '坦尚尼亞', '塞內加爾', + '塞内加爾', '塞爾維亞', '多明尼加', '多米尼克', + '奈及利亞', '委內瑞拉', '宏都拉斯', '尼加拉瓜', + '巴基斯坦', '庫克群島', '愛沙尼亞', '拉脫維亞', + '摩爾多瓦', '摩里西斯', '斯洛伐克', '斯里蘭卡', + '格瑞那達', '模里西斯', '波多黎各', '澳大利亞', + '烏茲別克', '玻利維亞', '瓜地馬拉', '白俄羅斯', + '突尼西亞', '納米比亞', '索馬利亞', '索馬尼亞', + '羅馬尼亞', '聖露西亞', '聖馬利諾', '莫三比克', + '莫三鼻克', '葛摩聯盟', '薩爾瓦多', '衣索比亞', + '西薩摩亞', '象牙海岸', '賴比瑞亞', '賽普勒斯', + '馬來西亞', '馬爾地夫', '克羅埃西亞', + '列支敦斯登', '哥斯大黎加', '布吉納法索', + '布吉那法索', '幾內亞比索', '幾內亞比紹', + '斯洛維尼亞', '索羅門群島', '茅利塔尼亞', + '蒙特內哥羅', '赤道幾內亞', '阿爾及利亞', + '阿爾及尼亞', '阿爾巴尼亞', '馬紹爾群島', + '馬達加斯加', '密克羅尼西亞', '沙烏地阿拉伯', + '千里達及托巴哥', + ); + + protected static $postcode = array('###-##', '###'); + + public function street() + { + return static::randomElement(static::$street); + } + + public static function randomChineseNumber() + { + $digits = array( + '', '一', '二', '三', '四', '五', '六', '七', '八', '九', + ); + return $digits[static::randomDigitNotNull()]; + } + + public static function randomNumber2() + { + return static::randomNumber(2) + 1; + } + + public static function randomNumber3() + { + return static::randomNumber(3) + 1; + } + + public static function localLatitude() + { + return number_format(mt_rand(22000000, 25000000)/1000000, 6); + } + + public static function localLongitude() + { + return number_format(mt_rand(120000000, 122000000)/1000000, 6); + } + + public function city() + { + $county = static::randomElement(array_keys(static::$city)); + $city = static::randomElement(static::$city[$county]); + return $county.$city; + } + + public function state() + { + return '臺灣省'; + } + + public static function stateAbbr() + { + return '臺'; + } + + public static function cityPrefix() + { + return ''; + } + + public static function citySuffix() + { + return ''; + } + + public static function secondaryAddress() + { + return (static::randomNumber(2)+1).static::randomElement(static::$secondaryAddressSuffix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php new file mode 100644 index 0000000..7be5953 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php @@ -0,0 +1,66 @@ +generator->parse($format); + } + + public static function companyModifier() + { + return static::randomElement(static::$companyModifier); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public function catchPhrase() + { + return static::randomElement(static::$catchPhrase); + } + + public function bs() + { + $result = ''; + foreach (static::$bsWords as &$word) { + $result .= static::randomElement($word); + } + return $result; + } + + /** + * return standard VAT / Tax ID / Uniform Serial Number + * + * @example 28263822 + * + * @return int + */ + public function VAT() + { + return static::randomNumber(8, true); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php new file mode 100644 index 0000000..6df5e92 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php @@ -0,0 +1,46 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php new file mode 100644 index 0000000..4035ea8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php @@ -0,0 +1,16 @@ +userName(); + } + + public function domainWord() + { + return \Faker\Factory::create('en_US')->domainWord(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php new file mode 100644 index 0000000..6b1a582 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php @@ -0,0 +1,11 @@ +creditCardDetails($valid); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php new file mode 100644 index 0000000..1ae7202 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php @@ -0,0 +1,201 @@ + 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 34, + 'J' => 18, + 'K' => 19, + 'M' => 21, + 'N' => 22, + 'O' => 35, + 'p' => 23, + 'Q' => 24, + 'T' => 27, + 'U' => 28, + 'V' => 29, + 'W' => 32, + 'X' => 30, + 'Z' => 33 + ); + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public static $idDigitValidator = array(1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1); + + protected static $maleNameFormats = array( + '{{lastName}}{{firstNameMale}}', + ); + + protected static $femaleNameFormats = array( + '{{lastName}}{{firstNameFemale}}', + ); + + protected static $titleMale = array('先生', '博士', '教授'); + protected static $titleFemale = array('小姐', '太太', '博士', '教授'); + + /** + * @link http://zh.wikipedia.org/wiki/%E7%99%BE%E5%AE%B6%E5%A7%93 + */ + protected static $lastName = array( + '趙', '錢', '孫', '李', '周', '吳', '鄭', '王', '馮', + '陳', '褚', '衛', '蔣', '沈', '韓', '楊', '朱', '秦', + '尤', '許', '何', '呂', '施', '張', '孔', '曹', '嚴', + '華', '金', '魏', '陶', '姜', '戚', '謝', '鄒', '喻', + '柏', '水', '竇', '章', '雲', '蘇', '潘', '葛', + '奚', '范', '彭', '郎', '魯', '韋', '昌', '馬', + '苗', '鳳', '花', '方', '俞', '任', '袁', '柳', + '酆', '鮑', '史', '唐', '費', '廉', '岑', '薛', + '雷', '賀', '倪', '湯', '滕', '殷', '羅', '畢', + '郝', '鄔', '安', '常', '樂', '于', '時', '傅', + '皮', '卞', '齊', '康', '伍', '余', '元', '卜', + '顧', '孟', '平', '黃', '和', '穆', '蕭', '尹', + '姚', '邵', '湛', '汪', '祁', '毛', '禹', '狄', + '米', '貝', '明', '臧', '計', '伏', '成', '戴', + '談', '宋', '茅', '龐', '熊', '紀', '舒', '屈', + '項', '祝', '董', '梁', '杜', '阮', '藍', '閔', + '席', '季', '麻', '強', '賈', '路', '婁', '危', + '江', '童', '顏', '郭', '梅', '盛', '林', '刁', + '鍾', '徐', '丘', '駱', '高', '夏', '蔡', '田', + '樊', '胡', '凌', '霍', '虞', '萬', '支', '柯', + '昝', '管', '盧', '莫', '經', '房', '裘', '繆', + '干', '解', '應', '宗', '丁', '宣', '賁', '鄧', + '郁', '單', '杭', '洪', '包', '諸', '左', '石', + '崔', '吉', '鈕', '龔', '程', '嵇', '邢', '滑', + '裴', '陸', '榮', '翁', '荀', '羊', '於', '惠', + '甄', '麴', '家', '封', '芮', '羿', '儲', '靳', + '汲', '邴', '糜', '松', '井', '段', '富', '巫', + '烏', '焦', '巴', '弓', '牧', '隗', '山', '谷', + '車', '侯', '宓', '蓬', '全', '郗', '班', '仰', + '秋', '仲', '伊', '宮', '甯', '仇', '欒', '暴', + '甘', '鈄', '厲', '戎', '祖', '武', '符', '劉', + '景', '詹', '束', '龍', '葉', '幸', '司', '韶', + '郜', '黎', '薊', '薄', '印', '宿', '白', '懷', + '蒲', '邰', '從', '鄂', '索', '咸', '籍', '賴', + '卓', '藺', '屠', '蒙', '池', '喬', '陰', '鬱', + '胥', '能', '蒼', '雙', '聞', '莘', '黨', '翟', + '譚', '貢', '勞', '逄', '姬', '申', '扶', '堵', + '冉', '宰', '酈', '雍', '郤', '璩', '桑', '桂', + '濮', '牛', '壽', '通', '邊', '扈', '燕', '冀', + '郟', '浦', '尚', '農', '溫', '別', '莊', '晏', + '柴', '瞿', '閻', '充', '慕', '連', '茹', '習', + '宦', '艾', '魚', '容', '向', '古', '易', '慎', + '戈', '廖', '庾', '終', '暨', '居', '衡', '步', + '都', '耿', '滿', '弘', '匡', '國', '文', '寇', + '廣', '祿', '闕', '東', '歐', '殳', '沃', '利', + '蔚', '越', '夔', '隆', '師', '鞏', '厙', '聶', + '晁', '勾', '敖', '融', '冷', '訾', '辛', '闞', + '那', '簡', '饒', '空', '曾', '毋', '沙', '乜', + '養', '鞠', '須', '豐', '巢', '關', '蒯', '相', + '查', '后', '荊', '紅', '游', '竺', '權', '逯', + '蓋', '益', '桓', '公', '万俟', '司馬', '上官', + '歐陽', '夏侯', '諸葛', '聞人', '東方', '赫連', + '皇甫', '尉遲', '公羊', '澹臺', '公冶', '宗政', + '濮陽', '淳于', '單于', '太叔', '申屠', '公孫', + '仲孫', '軒轅', '令狐', '鍾離', '宇文', '長孫', + '慕容', '鮮于', '閭丘', '司徒', '司空', '亓官', + '司寇', '仉', '督', '子車', '顓孫', '端木', '巫馬', + '公西', '漆雕', '樂正', '壤駟', '公良', '拓跋', + '夾谷', '宰父', '穀梁', '晉', '楚', '閆', '法', + '汝', '鄢', '涂', '欽', '段干', '百里', '東郭', + '南門', '呼延', '歸', '海', '羊舌', '微生', '岳', + '帥', '緱', '亢', '況', '後', '有', '琴', '梁丘', + '左丘', '東門', '西門', '商', '牟', '佘', '佴', + '伯', '賞', '南宮', '墨', '哈', '譙', '笪', '年', + '愛', '陽', '佟', '第五', '言', '福', + ); + + /** + * @link http://technology.chtsai.org/namefreq/ + */ + protected static $characterMale = array( + '佳', '俊', '信', '偉', '傑', '冠', '君', '哲', + '嘉', '威', '宇', '安', '宏', '宗', '宜', '家', + '庭', '廷', '建', '彥', '心', '志', '思', '承', + '文', '柏', '樺', '瑋', '穎', '美', '翰', '華', + '詩', '豪', '賢', '軒', '銘', '霖', + ); + + protected static $characterFemale = array( + '伶', '佩', '佳', '依', '儀', '冠', '君', '嘉', + '如', '娟', '婉', '婷', '安', '宜', '家', '庭', + '心', '思', '怡', '惠', '慧', '文', '欣', '涵', + '淑', '玲', '珊', '琪', '琬', '瑜', '穎', '筑', + '筱', '美', '芬', '芳', '華', '萍', '萱', '蓉', + '詩', '貞', '郁', '鈺', '雅', '雯', '靜', '馨', + ); + + public static function randomName($pool, $n) + { + $name = ''; + for ($i = 0; $i < $n; ++$i) { + $name .= static::randomElement($pool); + } + return $name; + } + + public static function firstNameMale() + { + return static::randomName(static::$characterMale, mt_rand(1, 2)); + } + + public static function firstNameFemale() + { + return static::randomName(static::$characterFemale, mt_rand(1, 2)); + } + + public static function suffix() + { + return ''; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @see https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China) + * + * @return string Length 10 alphanumeric characters, begins with 1 latin character (birthplace), + * 1 number (gender) and then 8 numbers (the last one is check digit). + */ + public function personalIdentityNumber($gender = null) + { + $birthPlace = self::randomKey(self::$idBirthplaceCode); + $birthPlaceCode = self::$idBirthplaceCode[$birthPlace]; + + $gender = ($gender != null) ? $gender : self::randomElement(array(self::GENDER_FEMALE, self::GENDER_MALE)); + $genderCode = ($gender === self::GENDER_MALE) ? 1 : 2; + + $randomNumberCode = self::randomNumber(7, true); + + $codes = str_split($birthPlaceCode . $genderCode . $randomNumberCode); + $total = 0; + + foreach ($codes as $key => $code) { + $total += $code * self::$idDigitValidator[$key]; + } + + $checkSumDigit = 10 - ($total % 10); + + if ($checkSumDigit == 10) { + $checkSumDigit = 0; + } + + $id = $birthPlace . $genderCode . $randomNumberCode . $checkSumDigit; + + return $id; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php new file mode 100644 index 0000000..7c31a97 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php @@ -0,0 +1,19 @@ + 251: + $temp .= $chars[++$i]; + // no break + case $ord > 247: + $temp .= $chars[++$i]; + // no break + case $ord > 239: + $temp .= $chars[++$i]; + // no break + case $ord > 223: + $temp .= $chars[++$i]; + // no break + case $ord > 191: + $temp .= $chars[++$i]; + // no break + } + + $encoding[] = $temp; + } + + return $encoding; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php b/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php new file mode 100644 index 0000000..431f765 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php @@ -0,0 +1,58 @@ +unique() + */ +class UniqueGenerator +{ + protected $generator; + protected $maxRetries; + protected $uniques = array(); + + /** + * @param Generator $generator + * @param integer $maxRetries + */ + public function __construct(Generator $generator, $maxRetries = 10000) + { + $this->generator = $generator; + $this->maxRetries = $maxRetries; + } + + /** + * Catch and proxy all generator calls but return only unique values + * @param string $attribute + * @return mixed + */ + public function __get($attribute) + { + return $this->__call($attribute, array()); + } + + /** + * Catch and proxy all generator calls with arguments but return only unique values + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call($name, $arguments) + { + if (!isset($this->uniques[$name])) { + $this->uniques[$name] = array(); + } + $i = 0; + do { + $res = call_user_func_array(array($this->generator, $name), $arguments); + $i++; + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries)); + } + } while (array_key_exists(serialize($res), $this->uniques[$name])); + $this->uniques[$name][serialize($res)]= null; + + return $res; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php b/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php new file mode 100644 index 0000000..1352dfc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php @@ -0,0 +1,65 @@ +valid() + */ +class ValidGenerator +{ + protected $generator; + protected $validator; + protected $maxRetries; + + /** + * @param Generator $generator + * @param callable|null $validator + * @param integer $maxRetries + */ + public function __construct(Generator $generator, $validator = null, $maxRetries = 10000) + { + if (is_null($validator)) { + $validator = function () { + return true; + }; + } elseif (!is_callable($validator)) { + throw new \InvalidArgumentException('valid() only accepts callables as first argument'); + } + $this->generator = $generator; + $this->validator = $validator; + $this->maxRetries = $maxRetries; + } + + /** + * Catch and proxy all generator calls but return only valid values + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->__call($attribute, array()); + } + + /** + * Catch and proxy all generator calls with arguments but return only valid values + * @param string $name + * @param array $arguments + * + * @return mixed + */ + public function __call($name, $arguments) + { + $i = 0; + do { + $res = call_user_func_array(array($this->generator, $name), $arguments); + $i++; + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid value', $this->maxRetries)); + } + } while (!call_user_func($this->validator, $res)); + + return $res; + } +} diff --git a/vendor/fzaninotto/faker/src/autoload.php b/vendor/fzaninotto/faker/src/autoload.php new file mode 100644 index 0000000..f55914d --- /dev/null +++ b/vendor/fzaninotto/faker/src/autoload.php @@ -0,0 +1,26 @@ +assertEquals($checksum, Iban::checksum($iban), $iban); + } + + public function validatorProvider() + { + return array( + array('AL47212110090000000235698741', true), + array('AD1200012030200359100100', true), + array('AT611904300234573201', true), + array('AZ21NABZ00000000137010001944', true), + array('BH67BMAG00001299123456', true), + array('BE68539007547034', true), + array('BA391290079401028494', true), + array('BR7724891749412660603618210F3', true), + array('BG80BNBG96611020345678', true), + array('CR0515202001026284066', true), + array('HR1210010051863000160', true), + array('CY17002001280000001200527600', true), + array('CZ6508000000192000145399', true), + array('DK5000400440116243', true), + array('DO28BAGR00000001212453611324', true), + array('EE382200221020145685', true), + array('FO6264600001631634', true), + array('FI2112345600000785', true), + array('FR1420041010050500013M02606', true), + array('GE29NB0000000101904917', true), + array('DE89370400440532013000', true), + array('GI75NWBK000000007099453', true), + array('GR1601101250000000012300695', true), + array('GL8964710001000206', true), + array('GT82TRAJ01020000001210029690', true), + array('HU42117730161111101800000000', true), + array('IS140159260076545510730339', true), + array('IE29AIBK93115212345678', true), + array('IL620108000000099999999', true), + array('IT60X0542811101000000123456', true), + array('KZ86125KZT5004100100', true), + array('KW81CBKU0000000000001234560101', true), + array('LV80BANK0000435195001', true), + array('LB62099900000001001901229114', true), + array('LI21088100002324013AA', true), + array('LT121000011101001000', true), + array('LU280019400644750000', true), + array('MK07250120000058984', true), + array('MT84MALT011000012345MTLCAST001S', true), + array('MR1300020001010000123456753', true), + array('MU17BOMM0101101030300200000MUR', true), + array('MD24AG000225100013104168', true), + array('MC5811222000010123456789030', true), + array('ME25505000012345678951', true), + array('NL91ABNA0417164300', true), + array('NO9386011117947', true), + array('PK36SCBL0000001123456702', true), + array('PL61109010140000071219812874', true), + array('PS92PALS000000000400123456702', true), + array('PT50000201231234567890154', true), + array('QA58DOHB00001234567890ABCDEFG', true), + array('RO49AAAA1B31007593840000', true), + array('SM86U0322509800000000270100', true), + array('SA0380000000608010167519', true), + array('RS35260005601001611379', true), + array('SK3112000000198742637541', true), + array('SI56263300012039086', true), + array('ES9121000418450200051332', true), + array('SE4550000000058398257466', true), + array('CH9300762011623852957', true), + array('TN5910006035183598478831', true), + array('TR330006100519786457841326', true), + array('AE070331234567890123456', true), + array('GB29NWBK60161331926819', true), + array('VG96VPVG0000012345678901', true), + array('YY24KIHB12476423125915947930915268', true), + array('ZZ25VLQT382332233206588011313776421', true), + + + array('AL4721211009000000023569874', false), + array('AD120001203020035910010', false), + array('AT61190430023457320', false), + array('AZ21NABZ0000000013701000194', false), + array('BH67BMAG0000129912345', false), + array('BE6853900754703', false), + array('BA39129007940102849', false), + array('BR7724891749412660603618210F', false), + array('BG80BNBG9661102034567', false), + array('CR051520200102628406', false), + array('HR121001005186300016', false), + array('CY1700200128000000120052760', false), + array('CZ650800000019200014539', false), + array('DK500040044011624', false), + array('DO28BAGR0000000121245361132', false), + array('EE38220022102014568', false), + array('FO626460000163163', false), + array('FI2112345600000780', false), + array('FR1420041010050500013M0260', false), + array('GE29NB000000010190491', false), + array('DE8937040044053201300', false), + array('GI75NWBK00000000709945', false), + array('GR160110125000000001230069', false), + array('GL896471000100020', false), + array('GT82TRAJ0102000000121002969', false), + array('HU4211773016111110180000000', false), + array('IS14015926007654551073033', false), + array('IE29AIBK9311521234567', false), + array('IL62010800000009999999', false), + array('IT60X054281110100000012345', false), + array('KZ86125KZT500410010', false), + array('KW81CBKU000000000000123456010', false), + array('LV80BANK000043519500', false), + array('LB6209990000000100190122911', false), + array('LI21088100002324013A', false), + array('LT12100001110100100', false), + array('LU28001940064475000', false), + array('MK0725012000005898', false), + array('MT84MALT011000012345MTLCAST001', false), + array('MR130002000101000012345675', false), + array('MU17BOMM0101101030300200000MU', false), + array('MD24AG00022510001310416', false), + array('MC58112220000101234567890', false), + array('ME2550500001234567895', false), + array('NL91ABNA041716430', false), + array('NO938601111794', false), + array('PK36SCBL000000112345670', false), + array('PL6110901014000007121981287', false), + array('PS92PALS00000000040012345670', false), + array('PT5000020123123456789015', false), + array('QA58DOHB00001234567890ABCDEF', false), + array('RO49AAAA1B3100759384000', false), + array('SM86U032250980000000027010', false), + array('SA038000000060801016751', false), + array('RS3526000560100161137', false), + array('SK311200000019874263754', false), + array('SI5626330001203908', false), + array('ES912100041845020005133', false), + array('SE455000000005839825746', false), + array('CH930076201162385295', false), + array('TN591000603518359847883', false), + array('TR33000610051978645784132', false), + array('AE07033123456789012345', false), + array('GB29NWBK6016133192681', false), + array('VG96VPVG000001234567890', false), + array('YY24KIHB1247642312591594793091526', false), + array('ZZ25VLQT38233223320658801131377642', false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($iban, $isValid) + { + $this->assertEquals($isValid, Iban::isValid($iban), $iban); + } + + public function alphaToNumberProvider() + { + return array( + array('A', 10), + array('B', 11), + array('C', 12), + array('D', 13), + array('E', 14), + array('F', 15), + array('G', 16), + array('H', 17), + array('I', 18), + array('J', 19), + array('K', 20), + array('L', 21), + array('M', 22), + array('N', 23), + array('O', 24), + array('P', 25), + array('Q', 26), + array('R', 27), + array('S', 28), + array('T', 29), + array('U', 30), + array('V', 31), + array('W', 32), + array('X', 33), + array('Y', 34), + array('Z', 35), + ); + } + + /** + * @dataProvider alphaToNumberProvider + */ + public function testAlphaToNumber($letter, $number) + { + $this->assertEquals($number, Iban::alphaToNumber($letter), $letter); + } + + public function mod97Provider() + { + // Large numbers + $return = array( + array('123456789123456789', 7), + array('111222333444555666', 73), + array('4242424242424242424242', 19), + array('271828182845904523536028', 68), + ); + + // 0-200 + for ($i = 0; $i < 200; $i++) { + $return[] = array((string)$i, $i % 97); + } + + return $return; + } + /** + * @dataProvider mod97Provider + */ + public function testMod97($number, $result) + { + $this->assertEquals($result, Iban::mod97($number), $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php new file mode 100644 index 0000000..71d9193 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php @@ -0,0 +1,51 @@ +assertEquals($checksum, Inn::checksum($inn), $inn); + } + + public function validatorProvider() + { + return array( + array('5902179757', true), + array('5408294405', true), + array('2724164617', true), + array('0726000515', true), + array('6312123552', true), + + array('1111111111', false), + array('0123456789', false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($inn, $isValid) + { + $this->assertEquals($isValid, Inn::isValid($inn), $inn); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php new file mode 100644 index 0000000..2e81414 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php @@ -0,0 +1,72 @@ +assertInternalType('string', $checkDigit); + $this->assertEquals($checkDigit, Luhn::computeCheckDigit($partialNumber)); + } + + public function validatorProvider() + { + return array( + array('79927398710', false), + array('79927398711', false), + array('79927398712', false), + array('79927398713', true), + array('79927398714', false), + array('79927398715', false), + array('79927398716', false), + array('79927398717', false), + array('79927398718', false), + array('79927398719', false), + array(79927398713, true), + array(79927398714, false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($number, $isValid) + { + $this->assertEquals($isValid, Luhn::isValid($number)); + } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument should be an integer. + */ + public function testGenerateLuhnNumberWithInvalidPrefix() + { + Luhn::generateLuhnNumber('abc'); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php new file mode 100644 index 0000000..9e40d79 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php @@ -0,0 +1,54 @@ +assertEquals($checksum, TCNo::checksum($tcNo), $tcNo); + } + + public function validatorProvider() + { + return array( + array('22978160678', true), + array('26480045324', true), + array('47278360658', true), + array('34285002510', true), + array('19874561012', true), + + array('11111111111', false), + array('11234567899', false), + ); + } + + /** + * @dataProvider validatorProvider + * @param $tcNo + * @param $isValid + */ + public function testIsValid($tcNo, $isValid) + { + $this->assertEquals($isValid, TCNo::isValid($tcNo), $tcNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php b/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php new file mode 100644 index 0000000..fa9eb85 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php @@ -0,0 +1,28 @@ +assertNull($generator->value); + } + + public function testGeneratorReturnsDefaultValueForAnyPropertyGet() + { + $generator = new DefaultGenerator(123); + $this->assertSame(123, $generator->foo); + $this->assertNotNull($generator->bar); + } + + public function testGeneratorReturnsDefaultValueForAnyMethodCall() + { + $generator = new DefaultGenerator(123); + $this->assertSame(123, $generator->foobar()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php b/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php new file mode 100644 index 0000000..f15df44 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php @@ -0,0 +1,148 @@ +addProvider(new FooProvider()); + $generator->addProvider(new BarProvider()); + $this->assertEquals('barfoo', $generator->format('fooFormatter')); + } + + public function testGetFormatterReturnsCallable() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertInternalType('callable', $generator->getFormatter('fooFormatter')); + } + + public function testGetFormatterReturnsCorrectFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $expected = array($provider, 'fooFormatter'); + $this->assertEquals($expected, $generator->getFormatter('fooFormatter')); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testGetFormatterThrowsExceptionOnIncorrectProvider() + { + $generator = new Generator; + $generator->getFormatter('fooFormatter'); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testGetFormatterThrowsExceptionOnIncorrectFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $generator->getFormatter('barFormatter'); + } + + public function testFormatCallsFormatterOnProvider() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->format('fooFormatter')); + } + + public function testFormatTransfersArgumentsToFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('bazfoo', $generator->format('fooFormatterWithArguments', array('foo'))); + } + + public function testParseReturnsSameStringWhenItContainsNoCurlyBraces() + { + $generator = new Generator(); + $this->assertEquals('fooBar#?', $generator->parse('fooBar#?')); + } + + public function testParseReturnsStringWithTokensReplacedByFormatters() + { + $generator = new Generator(); + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('This is foobar a text with foobar', $generator->parse('This is {{fooFormatter}} a text with {{ fooFormatter }}')); + } + + public function testMagicGetCallsFormat() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->fooFormatter); + } + + public function testMagicCallCallsFormat() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->fooFormatter()); + } + + public function testMagicCallCallsFormatWithArguments() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('bazfoo', $generator->fooFormatterWithArguments('foo')); + } + + public function testSeed() + { + $generator = new Generator; + + $generator->seed(0); + $mtRandWithSeedZero = mt_rand(); + $generator->seed(0); + $this->assertEquals($mtRandWithSeedZero, mt_rand(), 'seed(0) should be deterministic.'); + + $generator->seed(); + $mtRandWithoutSeed = mt_rand(); + $this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)'); + $generator->seed(); + $this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.'); + + $generator->seed('10'); + $this->assertTrue(true, 'seeding with a non int value doesn\'t throw an exception'); + } +} + +class FooProvider +{ + public function fooFormatter() + { + return 'foobar'; + } + + public function fooFormatterWithArguments($value = '') + { + return 'baz' . $value; + } +} + +class BarProvider +{ + public function fooFormatter() + { + return 'barfoo'; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php new file mode 100644 index 0000000..c7f1814 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php @@ -0,0 +1,47 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testLatitude() + { + $latitude = $this->faker->latitude(); + $this->assertInternalType('float', $latitude); + $this->assertGreaterThanOrEqual(-90, $latitude); + $this->assertLessThanOrEqual(90, $latitude); + } + + public function testLongitude() + { + $longitude = $this->faker->longitude(); + $this->assertInternalType('float', $longitude); + $this->assertGreaterThanOrEqual(-180, $longitude); + $this->assertLessThanOrEqual(180, $longitude); + } + + public function testCoordinate() + { + $coordinate = $this->faker->localCoordinates(); + $this->assertInternalType('array', $coordinate); + $this->assertInternalType('float', $coordinate['latitude']); + $this->assertGreaterThanOrEqual(-90, $coordinate['latitude']); + $this->assertLessThanOrEqual(90, $coordinate['latitude']); + $this->assertInternalType('float', $coordinate['longitude']); + $this->assertGreaterThanOrEqual(-180, $coordinate['longitude']); + $this->assertLessThanOrEqual(180, $coordinate['longitude']); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php new file mode 100644 index 0000000..16ca3cd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php @@ -0,0 +1,46 @@ +addProvider(new Barcode($faker)); + $faker->seed(0); + $this->faker = $faker; + } + + public function testEan8() + { + $code = $this->faker->ean8(); + $this->assertRegExp('/^\d{8}$/i', $code); + $codeWithoutChecksum = substr($code, 0, -1); + $checksum = substr($code, -1); + $this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum); + } + + public function testEan13() + { + $code = $this->faker->ean13(); + $this->assertRegExp('/^\d{13}$/i', $code); + $codeWithoutChecksum = substr($code, 0, -1); + $checksum = substr($code, -1); + $this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum); + } +} + +class TestableBarcode extends Barcode +{ + public static function eanChecksum($input) + { + return parent::eanChecksum($input); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php new file mode 100644 index 0000000..e619d5b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php @@ -0,0 +1,572 @@ +assertInternalType('integer', BaseProvider::randomDigit()); + } + + public function testRandomDigitReturnsDigit() + { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomDigit()); + $this->assertLessThan(10, BaseProvider::randomDigit()); + } + + public function testRandomDigitNotNullReturnsNotNullDigit() + { + $this->assertGreaterThan(0, BaseProvider::randomDigitNotNull()); + $this->assertLessThan(10, BaseProvider::randomDigitNotNull()); + } + + + public function testRandomDigitNotReturnsValidDigit() + { + for ($i = 0; $i <= 9; $i++) { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomDigitNot($i)); + $this->assertLessThan(10, BaseProvider::randomDigitNot($i)); + $this->assertNotSame(BaseProvider::randomDigitNot($i), $i); + } + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testRandomNumberThrowsExceptionWhenCalledWithAMax() + { + BaseProvider::randomNumber(5, 200); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testRandomNumberThrowsExceptionWhenCalledWithATooHighNumberOfDigits() + { + BaseProvider::randomNumber(10); + } + + public function testRandomNumberReturnsInteger() + { + $this->assertInternalType('integer', BaseProvider::randomNumber()); + $this->assertInternalType('integer', BaseProvider::randomNumber(5, false)); + } + + public function testRandomNumberReturnsDigit() + { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomNumber(3)); + $this->assertLessThan(1000, BaseProvider::randomNumber(3)); + } + + public function testRandomNumberAcceptsStrictParamToEnforceNumberSize() + { + $this->assertEquals(5, strlen((string) BaseProvider::randomNumber(5, true))); + } + + public function testNumberBetween() + { + $min = 5; + $max = 6; + + $this->assertGreaterThanOrEqual($min, BaseProvider::numberBetween($min, $max)); + $this->assertGreaterThanOrEqual(BaseProvider::numberBetween($min, $max), $max); + } + + public function testNumberBetweenAcceptsZeroAsMax() + { + $this->assertEquals(0, BaseProvider::numberBetween(0, 0)); + } + + public function testRandomFloat() + { + $min = 4; + $max = 10; + $nbMaxDecimals = 8; + + $result = BaseProvider::randomFloat($nbMaxDecimals, $min, $max); + + $parts = explode('.', $result); + + $this->assertInternalType('float', $result); + $this->assertGreaterThanOrEqual($min, $result); + $this->assertLessThanOrEqual($max, $result); + $this->assertLessThanOrEqual($nbMaxDecimals, strlen($parts[1])); + } + + public function testRandomLetterReturnsString() + { + $this->assertInternalType('string', BaseProvider::randomLetter()); + } + + public function testRandomLetterReturnsSingleLetter() + { + $this->assertEquals(1, strlen(BaseProvider::randomLetter())); + } + + public function testRandomLetterReturnsLowercaseLetter() + { + $lowercaseLetters = 'abcdefghijklmnopqrstuvwxyz'; + $this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomLetter())); + } + + public function testRandomAsciiReturnsString() + { + $this->assertInternalType('string', BaseProvider::randomAscii()); + } + + public function testRandomAsciiReturnsSingleCharacter() + { + $this->assertEquals(1, strlen(BaseProvider::randomAscii())); + } + + public function testRandomAsciiReturnsAsciiCharacter() + { + $lowercaseLetters = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; + $this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomAscii())); + } + + public function testRandomElementReturnsNullWhenArrayEmpty() + { + $this->assertNull(BaseProvider::randomElement(array())); + } + + public function testRandomElementReturnsNullWhenCollectionEmpty() + { + $this->assertNull(BaseProvider::randomElement(new Collection(array()))); + } + + public function testRandomElementReturnsElementFromArray() + { + $elements = array('23', 'e', 32, '#'); + $this->assertContains(BaseProvider::randomElement($elements), $elements); + } + + public function testRandomElementReturnsElementFromAssociativeArray() + { + $elements = array('tata' => '23', 'toto' => 'e', 'tutu' => 32, 'titi' => '#'); + $this->assertContains(BaseProvider::randomElement($elements), $elements); + } + + public function testRandomElementReturnsElementFromCollection() + { + $collection = new Collection(array('one', 'two', 'three')); + $this->assertContains(BaseProvider::randomElement($collection), $collection); + } + + public function testShuffleReturnsStringWhenPassedAStringArgument() + { + $this->assertInternalType('string', BaseProvider::shuffle('foo')); + } + + public function testShuffleReturnsArrayWhenPassedAnArrayArgument() + { + $this->assertInternalType('array', BaseProvider::shuffle(array(1, 2, 3))); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testShuffleThrowsExceptionWhenPassedAnInvalidArgument() + { + BaseProvider::shuffle(false); + } + + public function testShuffleArraySupportsEmptyArrays() + { + $this->assertEquals(array(), BaseProvider::shuffleArray(array())); + } + + public function testShuffleArrayReturnsAnArrayOfTheSameSize() + { + $array = array(1, 2, 3, 4, 5); + $this->assertSameSize($array, BaseProvider::shuffleArray($array)); + } + + public function testShuffleArrayReturnsAnArrayWithSameElements() + { + $array = array(2, 4, 6, 8, 10); + $shuffleArray = BaseProvider::shuffleArray($array); + $this->assertContains(2, $shuffleArray); + $this->assertContains(4, $shuffleArray); + $this->assertContains(6, $shuffleArray); + $this->assertContains(8, $shuffleArray); + $this->assertContains(10, $shuffleArray); + } + + public function testShuffleArrayReturnsADifferentArrayThanTheOriginal() + { + $arr = array(1, 2, 3, 4, 5); + $shuffledArray = BaseProvider::shuffleArray($arr); + $this->assertNotEquals($arr, $shuffledArray); + } + + public function testShuffleArrayLeavesTheOriginalArrayUntouched() + { + $arr = array(1, 2, 3, 4, 5); + BaseProvider::shuffleArray($arr); + $this->assertEquals($arr, array(1, 2, 3, 4, 5)); + } + + public function testShuffleStringSupportsEmptyStrings() + { + $this->assertEquals('', BaseProvider::shuffleString('')); + } + + public function testShuffleStringReturnsAnStringOfTheSameSize() + { + $string = 'abcdef'; + $this->assertEquals(strlen($string), strlen(BaseProvider::shuffleString($string))); + } + + public function testShuffleStringReturnsAnStringWithSameElements() + { + $string = 'acegi'; + $shuffleString = BaseProvider::shuffleString($string); + $this->assertContains('a', $shuffleString); + $this->assertContains('c', $shuffleString); + $this->assertContains('e', $shuffleString); + $this->assertContains('g', $shuffleString); + $this->assertContains('i', $shuffleString); + } + + public function testShuffleStringReturnsADifferentStringThanTheOriginal() + { + $string = 'abcdef'; + $shuffledString = BaseProvider::shuffleString($string); + $this->assertNotEquals($string, $shuffledString); + } + + public function testShuffleStringLeavesTheOriginalStringUntouched() + { + $string = 'abcdef'; + BaseProvider::shuffleString($string); + $this->assertEquals($string, 'abcdef'); + } + + public function testNumerifyReturnsSameStringWhenItContainsNoHashSign() + { + $this->assertEquals('fooBar?', BaseProvider::numerify('fooBar?')); + } + + public function testNumerifyReturnsStringWithHashSignsReplacedByDigits() + { + $this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo#Ba#r')); + } + + public function testNumerifyReturnsStringWithPercentageSignsReplacedByDigits() + { + $this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo%Ba%r')); + } + + public function testNumerifyReturnsStringWithPercentageSignsReplacedByNotNullDigits() + { + $this->assertNotEquals('0', BaseProvider::numerify('%')); + } + + public function testNumerifyCanGenerateALargeNumberOfDigits() + { + $largePattern = str_repeat('#', 20); // definitely larger than PHP_INT_MAX on all systems + $this->assertEquals(20, strlen(BaseProvider::numerify($largePattern))); + } + + public function testLexifyReturnsSameStringWhenItContainsNoQuestionMark() + { + $this->assertEquals('fooBar#', BaseProvider::lexify('fooBar#')); + } + + public function testLexifyReturnsStringWithQuestionMarksReplacedByLetters() + { + $this->assertRegExp('/foo[a-z]Ba[a-z]r/', BaseProvider::lexify('foo?Ba?r')); + } + + public function testBothifyCombinesNumerifyAndLexify() + { + $this->assertRegExp('/foo[a-z]Ba\dr/', BaseProvider::bothify('foo?Ba#r')); + } + + public function testBothifyAsterisk() + { + $this->assertRegExp('/foo([a-z]|\d)Ba([a-z]|\d)r/', BaseProvider::bothify('foo*Ba*r')); + } + + public function testBothifyUtf() + { + $utf = 'œ∑´®†¥¨ˆøπ“‘和製╯°□°╯︵ ┻━┻🐵 🙈 ﺚﻣ ﻦﻔﺳ ﺲﻘﻄﺗ ﻮﺑﺎﻠﺘﺣﺪﻳﺩ،, ﺝﺰﻳﺮﺘﻳ ﺏﺎﺴﺘﺧﺩﺎﻣ ﺄﻧ ﺪﻧﻭ. ﺇﺫ ﻪﻧﺍ؟ ﺎﻠﺴﺗﺍﺭ ﻮﺘ'; + $this->assertRegExp('/'.$utf.'foo\dB[a-z]a([a-z]|\d)r/u', BaseProvider::bothify($utf.'foo#B?a*r')); + } + + public function testAsciifyReturnsSameStringWhenItContainsNoStarSign() + { + $this->assertEquals('fooBar?', BaseProvider::asciify('fooBar?')); + } + + public function testAsciifyReturnsStringWithStarSignsReplacedByAsciiChars() + { + $this->assertRegExp('/foo.Ba.r/', BaseProvider::asciify('foo*Ba*r')); + } + + public function regexifyBasicDataProvider() + { + return array( + array('azeQSDF1234', 'azeQSDF1234', 'does not change non regex chars'), + array('foo(bar){1}', 'foobar', 'replaces regex characters'), + array('', '', 'supports empty string'), + array('/^foo(bar){1}$/', 'foobar', 'ignores regex delimiters') + ); + } + + /** + * @dataProvider regexifyBasicDataProvider + */ + public function testRegexifyBasicFeatures($input, $output, $message) + { + $this->assertEquals($output, BaseProvider::regexify($input), $message); + } + + public function regexifyDataProvider() + { + return array( + array('\d', 'numbers'), + array('\w', 'letters'), + array('(a|b)', 'alternation'), + array('[aeiou]', 'basic character class'), + array('[a-z]', 'character class range'), + array('[a-z1-9]', 'multiple character class range'), + array('a*b+c?', 'single character quantifiers'), + array('a{2}', 'brackets quantifiers'), + array('a{2,3}', 'min-max brackets quantifiers'), + array('[aeiou]{2,3}', 'brackets quantifiers on basic character class'), + array('[a-z]{2,3}', 'brackets quantifiers on character class range'), + array('(a|b){2,3}', 'brackets quantifiers on alternation'), + array('\.\*\?\+', 'escaped characters'), + array('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}', 'complex regex') + ); + } + + /** + * @dataProvider regexifyDataProvider + */ + public function testRegexifySupportedRegexSyntax($pattern, $message) + { + $this->assertRegExp('/' . $pattern . '/', BaseProvider::regexify($pattern), 'Regexify supports ' . $message); + } + + public function testOptionalReturnsProviderValueWhenCalledWithWeight1() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertNotNull($faker->optional(100)->randomDigit); + } + + public function testOptionalReturnsNullWhenCalledWithWeight0() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertNull($faker->optional(0)->randomDigit); + } + + public function testOptionalAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->optional(100)->count); + $this->assertNull($faker->optional(0)->count); + } + + public function testOptionalAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->optional(100)->count()); + $this->assertNull($faker->optional(0)->count()); + } + + public function testOptionalAllowsChainingProviderCallRandomlyReturnNull() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->optional()->randomDigit; + } + $this->assertContains(null, $values); + + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->optional(50)->randomDigit; + } + $this->assertContains(null, $values); + } + + /** + * @link https://github.com/fzaninotto/Faker/issues/265 + */ + public function testOptionalPercentageAndWeight() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \Faker\Provider\Miscellaneous($faker)); + + $valuesOld = array(); + $valuesNew = array(); + + for ($i = 0; $i < 10000; ++$i) { + $valuesOld[] = $faker->optional(0.5)->boolean(100); + $valuesNew[] = $faker->optional(50)->boolean(100); + } + + $this->assertEquals( + round(array_sum($valuesOld) / 10000, 2), + round(array_sum($valuesNew) / 10000, 2) + ); + } + + public function testUniqueAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->unique()->count); + } + + public function testUniqueAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->unique()->count()); + } + + public function testUniqueReturnsOnlyUniqueValues() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->unique()->randomDigit; + } + sort($values); + $this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), $values); + } + + /** + * @expectedException OverflowException + */ + public function testUniqueThrowsExceptionWhenNoUniqueValueCanBeGenerated() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + for ($i=0; $i < 11; $i++) { + $faker->unique()->randomDigit; + } + } + + public function testUniqueCanResetUniquesWhenPassedTrueAsArgument() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->unique()->randomDigit; + } + $values[]= $faker->unique(true)->randomDigit; + for ($i=0; $i < 9; $i++) { + $values[]= $faker->unique()->randomDigit; + } + sort($values); + $this->assertEquals(array(0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9), $values); + } + + public function testValidAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertLessThan(10, $faker->valid()->randomDigit); + } + + public function testValidAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertLessThan(10, $faker->valid()->numberBetween(5, 9)); + } + + public function testValidReturnsOnlyValidValues() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + $evenValidator = function($digit) { + return $digit % 2 === 0; + }; + for ($i=0; $i < 50; $i++) { + $values[$faker->valid($evenValidator)->randomDigit] = true; + } + $uniqueValues = array_keys($values); + sort($uniqueValues); + $this->assertEquals(array(0, 2, 4, 6, 8), $uniqueValues); + } + + /** + * @expectedException OverflowException + */ + public function testValidThrowsExceptionWhenNoValidValueCanBeGenerated() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $evenValidator = function($digit) { + return $digit % 2 === 0; + }; + for ($i=0; $i < 11; $i++) { + $faker->valid($evenValidator)->randomElement(array(1, 3, 5, 7, 9)); + } + } + + /** + * @expectedException InvalidArgumentException + */ + public function testValidThrowsExceptionWhenParameterIsNotCollable() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->valid(12)->randomElement(array(1, 3, 5, 7, 9)); + } + + /** + * @expectedException LengthException + * @expectedExceptionMessage Cannot get 2 elements, only 1 in array + */ + public function testRandomElementsThrowsWhenRequestingTooManyKeys() + { + BaseProvider::randomElements(array('foo'), 2); + } + + public function testRandomElements() + { + $this->assertCount(1, BaseProvider::randomElements(), 'Should work without any input'); + + $empty = BaseProvider::randomElements(array(), 0); + $this->assertInternalType('array', $empty); + $this->assertCount(0, $empty); + + $shuffled = BaseProvider::randomElements(array('foo', 'bar', 'baz'), 3); + $this->assertContains('foo', $shuffled); + $this->assertContains('bar', $shuffled); + $this->assertContains('baz', $shuffled); + + $allowDuplicates = BaseProvider::randomElements(array('foo', 'bar'), 3, true); + $this->assertCount(3, $allowDuplicates); + $this->assertContainsOnly('string', $allowDuplicates); + } +} + +class Collection extends \ArrayObject +{ +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php new file mode 100644 index 0000000..cce3dc0 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php @@ -0,0 +1,74 @@ +generator = new Generator(); + $this->generator->addProvider(new Biased($this->generator)); + + $this->results = array_fill(1, self::MAX, 0); + } + + public function performFake($function) + { + for($i = 0; $i < self::NUMBERS; $i++) { + $this->results[$this->generator->biasedNumberBetween(1, self::MAX, $function)]++; + } + } + + public function testUnbiased() + { + $this->performFake(array('\Faker\Provider\Biased', 'unbiased')); + + // assert that all numbers are near the expected unbiased value + foreach ($this->results as $number => $amount) { + // integral + $assumed = (1 / self::MAX * $number) - (1 / self::MAX * ($number - 1)); + // calculate the fraction of the whole area + $assumed /= 1; + $this->assertGreaterThan(self::NUMBERS * $assumed * .95, $amount, "Value was more than 5 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.05, $amount, "Value was more than 5 percent over the expected value"); + } + } + + public function testLinearHigh() + { + $this->performFake(array('\Faker\Provider\Biased', 'linearHigh')); + + foreach ($this->results as $number => $amount) { + // integral + $assumed = 0.5 * pow(1 / self::MAX * $number, 2) - 0.5 * pow(1 / self::MAX * ($number - 1), 2); + // calculate the fraction of the whole area + $assumed /= pow(1, 2) * .5; + $this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value"); + } + } + + public function testLinearLow() + { + $this->performFake(array('\Faker\Provider\Biased', 'linearLow')); + + foreach ($this->results as $number => $amount) { + // integral + $assumed = -0.5 * pow(1 / self::MAX * $number, 2) - -0.5 * pow(1 / self::MAX * ($number - 1), 2); + // shift the graph up + $assumed += 1 / self::MAX; + // calculate the fraction of the whole area + $assumed /= pow(1, 2) * .5; + $this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value"); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php new file mode 100644 index 0000000..ff5edac --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php @@ -0,0 +1,54 @@ +assertRegExp('/^#[a-f0-9]{6}$/i', Color::hexColor()); + } + + public function testSafeHexColor() + { + $this->assertRegExp('/^#[a-f0-9]{6}$/i', Color::safeHexColor()); + } + + public function testRgbColorAsArray() + { + $this->assertEquals(3, count(Color::rgbColorAsArray())); + } + + public function testRgbColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $this->assertRegExp('/^' . $regexp . ',' . $regexp . ',' . $regexp . '$/i', Color::rgbColor()); + } + + public function testRgbCssColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $this->assertRegExp('/^rgb\(' . $regexp . ',' . $regexp . ',' . $regexp . '\)$/i', Color::rgbCssColor()); + } + + public function testRgbaCssColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $regexpAlpha = '([01]?(\.\d+)?)'; + $this->assertRegExp('/^rgba\(' . $regexp . ',' . $regexp . ',' . $regexp . ',' . $regexpAlpha . '\)$/i', Color::rgbaCssColor()); + } + + public function testSafeColorName() + { + $this->assertRegExp('/^[\w]+$/', Color::safeColorName()); + } + + public function testColorName() + { + $this->assertRegExp('/^[\w]+$/', Color::colorName()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php new file mode 100644 index 0000000..28ce0eb --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php @@ -0,0 +1,31 @@ +addProvider(new Company($faker)); + $faker->addProvider(new Lorem($faker)); + $this->faker = $faker; + } + + public function testJobTitle() + { + $jobTitle = $this->faker->jobTitle(); + $pattern = '/^[A-Za-z]+$/'; + $this->assertRegExp($pattern, $jobTitle); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php new file mode 100644 index 0000000..ec3ad86 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php @@ -0,0 +1,282 @@ +defaultTz = 'UTC'; + DateTimeProvider::setDefaultTimezone($this->defaultTz); + } + + public function tearDown() + { + DateTimeProvider::setDefaultTimezone(); + } + + public function testPreferDefaultTimezoneOverSystemTimezone() + { + /** + * Set the system timezone to something *other* than the timezone used + * in setUp(). + */ + $originalSystemTimezone = date_default_timezone_get(); + $systemTimezone = 'Antarctica/Vostok'; + date_default_timezone_set($systemTimezone); + + /** + * Get a new date/time value and assert that it prefers the default + * timezone over the system timezone. + */ + $date = DateTimeProvider::dateTime(); + $this->assertNotSame($systemTimezone, $date->getTimezone()->getName()); + $this->assertSame($this->defaultTz, $date->getTimezone()->getName()); + + /** + * Restore the system timezone. + */ + date_default_timezone_set($originalSystemTimezone); + } + + public function testUseSystemTimezoneWhenDefaultTimezoneIsNotSet() + { + /** + * Set the system timezone to something *other* than the timezone used + * in setUp() *and* reset the default timezone. + */ + $originalSystemTimezone = date_default_timezone_get(); + $originalDefaultTimezone = DateTimeProvider::getDefaultTimezone(); + $systemTimezone = 'Antarctica/Vostok'; + date_default_timezone_set($systemTimezone); + DateTimeProvider::setDefaultTimezone(); + + /** + * Get a new date/time value and assert that it uses the system timezone + * and not the system timezone. + */ + $date = DateTimeProvider::dateTime(); + $this->assertSame($systemTimezone, $date->getTimezone()->getName()); + $this->assertNotSame($this->defaultTz, $date->getTimezone()->getName()); + + /** + * Restore the system timezone. + */ + date_default_timezone_set($originalSystemTimezone); + } + + public function testUnixTime() + { + $timestamp = DateTimeProvider::unixTime(); + $this->assertInternalType('int', $timestamp); + $this->assertGreaterThanOrEqual(0, $timestamp); + $this->assertLessThanOrEqual(time(), $timestamp); + } + + public function testDateTime() + { + $date = DateTimeProvider::dateTime(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeWithTimezone() + { + $date = DateTimeProvider::dateTime('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeAD() + { + $date = DateTimeProvider::dateTimeAD(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('0000-01-01 00:00:00'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisCentury() + { + $date = DateTimeProvider::dateTimeThisCentury(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-100 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisDecade() + { + $date = DateTimeProvider::dateTimeThisDecade(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-10 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisYear() + { + $date = DateTimeProvider::dateTimeThisYear(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-1 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisMonth() + { + $date = DateTimeProvider::dateTimeThisMonth(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-1 month'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisCenturyWithTimezone() + { + $date = DateTimeProvider::dateTimeThisCentury('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisDecadeWithTimezone() + { + $date = DateTimeProvider::dateTimeThisDecade('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisYearWithTimezone() + { + $date = DateTimeProvider::dateTimeThisYear('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisMonthWithTimezone() + { + $date = DateTimeProvider::dateTimeThisMonth('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testIso8601() + { + $date = DateTimeProvider::iso8601(); + $this->assertRegExp('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-Z](\d{4})?$/', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date)); + $this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date)); + } + + public function testDate() + { + $date = DateTimeProvider::date(); + $this->assertRegExp('/^\d{4}-\d{2}-\d{2}$/', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date)); + $this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date)); + } + + public function testTime() + { + $date = DateTimeProvider::time(); + $this->assertRegExp('/^\d{2}:\d{2}:\d{2}$/', $date); + } + + /** + * + * @dataProvider providerDateTimeBetween + */ + public function testDateTimeBetween($start, $end) + { + $date = DateTimeProvider::dateTimeBetween($start, $end); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime($start), $date); + $this->assertLessThanOrEqual(new \DateTime($end), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function providerDateTimeBetween() + { + return array( + array('-1 year', false), + array('-1 year', null), + array('-1 day', '-1 hour'), + array('-1 day', 'now'), + ); + } + + /** + * + * @dataProvider providerDateTimeInInterval + */ + public function testDateTimeInInterval($start, $interval = "+5 days", $isInFuture) + { + $date = DateTimeProvider::dateTimeInInterval($start, $interval); + $this->assertInstanceOf('\DateTime', $date); + + $_interval = \DateInterval::createFromDateString($interval); + $_start = new \DateTime($start); + if ($isInFuture) { + $this->assertGreaterThanOrEqual($_start, $date); + $this->assertLessThanOrEqual($_start->add($_interval), $date); + } else { + $this->assertLessThanOrEqual($_start, $date); + $this->assertGreaterThanOrEqual($_start->add($_interval), $date); + } + } + + public function providerDateTimeInInterval() + { + return array( + array('-1 year', '+5 days', true), + array('-1 day', '-1 hour', false), + array('-1 day', '+1 hour', true), + ); + } + + public function testFixedSeedWithMaximumTimestamp() + { + $max = '2118-03-01 12:00:00'; + + mt_srand(1); + $unixTime = DateTimeProvider::unixTime($max); + $datetimeAD = DateTimeProvider::dateTimeAD($max); + $dateTime1 = DateTimeProvider::dateTime($max); + $dateTimeBetween = DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max); + $date = DateTimeProvider::date('Y-m-d', $max); + $time = DateTimeProvider::time('H:i:s', $max); + $iso8601 = DateTimeProvider::iso8601($max); + $dateTimeThisCentury = DateTimeProvider::dateTimeThisCentury($max); + $dateTimeThisDecade = DateTimeProvider::dateTimeThisDecade($max); + $dateTimeThisMonth = DateTimeProvider::dateTimeThisMonth($max); + $amPm = DateTimeProvider::amPm($max); + $dayOfMonth = DateTimeProvider::dayOfMonth($max); + $dayOfWeek = DateTimeProvider::dayOfWeek($max); + $month = DateTimeProvider::month($max); + $monthName = DateTimeProvider::monthName($max); + $year = DateTimeProvider::year($max); + $dateTimeThisYear = DateTimeProvider::dateTimeThisYear($max); + mt_srand(); + + //regenerate Random Date with same seed and same maximum end timestamp + mt_srand(1); + $this->assertEquals($unixTime, DateTimeProvider::unixTime($max)); + $this->assertEquals($datetimeAD, DateTimeProvider::dateTimeAD($max)); + $this->assertEquals($dateTime1, DateTimeProvider::dateTime($max)); + $this->assertEquals($dateTimeBetween, DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max)); + $this->assertEquals($date, DateTimeProvider::date('Y-m-d', $max)); + $this->assertEquals($time, DateTimeProvider::time('H:i:s', $max)); + $this->assertEquals($iso8601, DateTimeProvider::iso8601($max)); + $this->assertEquals($dateTimeThisCentury, DateTimeProvider::dateTimeThisCentury($max)); + $this->assertEquals($dateTimeThisDecade, DateTimeProvider::dateTimeThisDecade($max)); + $this->assertEquals($dateTimeThisMonth, DateTimeProvider::dateTimeThisMonth($max)); + $this->assertEquals($amPm, DateTimeProvider::amPm($max)); + $this->assertEquals($dayOfMonth, DateTimeProvider::dayOfMonth($max)); + $this->assertEquals($dayOfWeek, DateTimeProvider::dayOfWeek($max)); + $this->assertEquals($month, DateTimeProvider::month($max)); + $this->assertEquals($monthName, DateTimeProvider::monthName($max)); + $this->assertEquals($year, DateTimeProvider::year($max)); + $this->assertEquals($dateTimeThisYear, DateTimeProvider::dateTimeThisYear($max)); + mt_srand(); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php new file mode 100644 index 0000000..f7814fa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php @@ -0,0 +1,30 @@ +addProvider(new HtmlLorem($faker)); + $node = $faker->randomHtml(6, 10); + $this->assertStringStartsWith("", $node); + $this->assertStringEndsWith("\n", $node); + } + + public function testRandomHtmlReturnsValidHTMLString(){ + $faker = new Generator(); + $faker->addProvider(new HtmlLorem($faker)); + $node = $faker->randomHtml(6, 10); + $dom = new \DOMDocument(); + $error = $dom->loadHTML($node); + $this->assertTrue($error); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php new file mode 100644 index 0000000..c73992c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php @@ -0,0 +1,76 @@ +assertRegExp('#^https://lorempixel.com/640/480/#', Image::imageUrl()); + } + + public function testImageUrlAcceptsCustomWidthAndHeight() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/#', Image::imageUrl(800, 400)); + } + + public function testImageUrlAcceptsCustomCategory() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/nature/#', Image::imageUrl(800, 400, 'nature')); + } + + public function testImageUrlAcceptsCustomText() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/nature/Faker#', Image::imageUrl(800, 400, 'nature', false, 'Faker')); + } + + public function testImageUrlAddsARandomGetParameterByDefault() + { + $url = Image::imageUrl(800, 400); + $splitUrl = preg_split('/\?/', $url); + + $this->assertEquals(count($splitUrl), 2); + $this->assertRegexp('#\d{5}#', $splitUrl[1]); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testUrlWithDimensionsAndBadCategory() + { + Image::imageUrl(800, 400, 'bullhonky'); + } + + public function testDownloadWithDefaults() + { + $url = "http://lorempixel.com/"; + $curlPing = curl_init($url); + curl_setopt($curlPing, CURLOPT_TIMEOUT, 5); + curl_setopt($curlPing, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($curlPing, CURLOPT_RETURNTRANSFER, true); + $data = curl_exec($curlPing); + $httpCode = curl_getinfo($curlPing, CURLINFO_HTTP_CODE); + curl_close($curlPing); + + if ($httpCode < 200 | $httpCode > 300) { + $this->markTestSkipped("LoremPixel is offline, skipping image download"); + } + + $file = Image::image(sys_get_temp_dir()); + $this->assertFileExists($file); + if (function_exists('getimagesize')) { + list($width, $height, $type, $attr) = getimagesize($file); + $this->assertEquals(640, $width); + $this->assertEquals(480, $height); + $this->assertEquals(constant('IMAGETYPE_JPEG'), $type); + } else { + $this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION)); + } + if (file_exists($file)) { + unlink($file); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php new file mode 100644 index 0000000..93fe7b4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php @@ -0,0 +1,167 @@ +addProvider(new Lorem($faker)); + $faker->addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function localeDataProvider() + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + $localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR)); + foreach ($localePaths as $path) { + $parts = explode('/', $path); + $locales[] = array($parts[count($parts) - 1]); + } + + return $locales; + } + + /** + * @link http://stackoverflow.com/questions/12026842/how-to-validate-an-email-address-in-php + * + * @dataProvider localeDataProvider + */ + public function testEmailIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD'; + $emailAddress = $this->faker->email(); + $this->assertRegExp($pattern, $emailAddress); + } + + /** + * @dataProvider localeDataProvider + */ + public function testUsernameIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[A-Za-z0-9]+([._][A-Za-z0-9]+)*$/'; + $username = $this->faker->username(); + $this->assertRegExp($pattern, $username); + } + + /** + * @dataProvider localeDataProvider + */ + public function testDomainnameIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[a-z]+(\.[a-z]+)+$/'; + $domainName = $this->faker->domainName(); + $this->assertRegExp($pattern, $domainName); + } + + /** + * @dataProvider localeDataProvider + */ + public function testDomainwordIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[a-z]+$/'; + $domainWord = $this->faker->domainWord(); + $this->assertRegExp($pattern, $domainWord); + } + + public function loadLocalProviders($locale) + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + if (file_exists($providerPath.'/'.$locale.'/Internet.php')) { + $internet = "\\Faker\\Provider\\$locale\\Internet"; + $this->faker->addProvider(new $internet($this->faker)); + } + if (file_exists($providerPath.'/'.$locale.'/Person.php')) { + $person = "\\Faker\\Provider\\$locale\\Person"; + $this->faker->addProvider(new $person($this->faker)); + } + if (file_exists($providerPath.'/'.$locale.'/Company.php')) { + $company = "\\Faker\\Provider\\$locale\\Company"; + $this->faker->addProvider(new $company($this->faker)); + } + } + + public function testPasswordIsValid() + { + $this->assertRegexp('/^.{6}$/', $this->faker->password(6, 6)); + } + + public function testSlugIsValid() + { + $pattern = '/^[a-z0-9-]+$/'; + $slug = $this->faker->slug(); + $this->assertSame(preg_match($pattern, $slug), 1); + } + + public function testUrlIsValid() + { + $url = $this->faker->url(); + $this->assertNotFalse(filter_var($url, FILTER_VALIDATE_URL)); + } + + public function testLocalIpv4() + { + $this->assertNotFalse(filter_var(Internet::localIpv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); + } + + public function testIpv4() + { + $this->assertNotFalse(filter_var($this->faker->ipv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); + } + + public function testIpv4NotLocalNetwork() + { + $this->assertNotRegExp('/\A0\./', $this->faker->ipv4()); + } + + public function testIpv4NotBroadcast() + { + $this->assertNotEquals('255.255.255.255', $this->faker->ipv4()); + } + + public function testIpv6() + { + $this->assertNotFalse(filter_var($this->faker->ipv6(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); + } + + public function testMacAddress() + { + $this->assertRegExp('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/i', Internet::macAddress()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php new file mode 100644 index 0000000..6cfcc89 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php @@ -0,0 +1,27 @@ +assertNotNull($faker->name(), 'Localized Name Provider ' . $matches[1] . ' does not throw errors'); + } + } + + public function testLocalizedAddressProvidersDoNotThrowErrors() + { + foreach (glob(__DIR__ . '/../../../src/Faker/Provider/*/Address.php') as $localizedAddress) { + preg_match('#/([a-zA-Z_]+)/Address\.php#', $localizedAddress, $matches); + $faker = Factory::create($matches[1]); + $this->assertNotNull($faker->address(), 'Localized Address Provider ' . $matches[1] . ' does not throw errors'); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php new file mode 100644 index 0000000..16d9889 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php @@ -0,0 +1,109 @@ +assertEquals('Word word word word.', TestableLorem::text(24)); + } + + public function testTextReturnsSentencesWhenAskedSizeLessThan100() + { + $this->assertEquals('This is a test sentence. This is a test sentence. This is a test sentence.', TestableLorem::text(99)); + } + + public function testTextReturnsParagraphsWhenAskedSizeGreaterOrEqualThanThan100() + { + $this->assertEquals('This is a test paragraph. It has three sentences. Exactly three.', TestableLorem::text(100)); + } + + public function testSentenceWithZeroNbWordsReturnsEmptyString() + { + $this->assertEquals('', Lorem::sentence(0)); + } + + public function testSentenceWithNegativeNbWordsReturnsEmptyString() + { + $this->assertEquals('', Lorem::sentence(-1)); + } + + public function testParagraphWithZeroNbSentencesReturnsEmptyString() + { + $this->assertEquals('', Lorem::paragraph(0)); + } + + public function testParagraphWithNegativeNbSentencesReturnsEmptyString() + { + $this->assertEquals('', Lorem::paragraph(-1)); + } + + public function testSentenceWithPositiveNbWordsReturnsAtLeastOneWord() + { + $sentence = Lorem::sentence(1); + + $this->assertGreaterThan(1, strlen($sentence)); + $this->assertGreaterThanOrEqual(1, count(explode(' ', $sentence))); + } + + public function testParagraphWithPositiveNbSentencesReturnsAtLeastOneWord() + { + $paragraph = Lorem::paragraph(1); + + $this->assertGreaterThan(1, strlen($paragraph)); + $this->assertGreaterThanOrEqual(1, count(explode(' ', $paragraph))); + } + + public function testWordssAsText() + { + $words = TestableLorem::words(2, true); + + $this->assertEquals('word word', $words); + } + + public function testSentencesAsText() + { + $sentences = TestableLorem::sentences(2, true); + + $this->assertEquals('This is a test sentence. This is a test sentence.', $sentences); + } + + public function testParagraphsAsText() + { + $paragraphs = TestableLorem::paragraphs(2, true); + + $expected = "This is a test paragraph. It has three sentences. Exactly three.\n\nThis is a test paragraph. It has three sentences. Exactly three."; + $this->assertEquals($expected, $paragraphs); + } +} + +class TestableLorem extends Lorem +{ + + public static function word() + { + return 'word'; + } + + public static function sentence($nbWords = 5, $variableNbWords = true) + { + return 'This is a test sentence.'; + } + + public static function paragraph($nbSentences = 3, $variableNbSentences = true) + { + return 'This is a test paragraph. It has three sentences. Exactly three.'; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php new file mode 100644 index 0000000..6a29cd5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php @@ -0,0 +1,59 @@ +assertContains(Miscellaneous::boolean(), array(true, false)); + } + + public function testMd5() + { + $this->assertRegExp('/^[a-z0-9]{32}$/', Miscellaneous::md5()); + } + + public function testSha1() + { + $this->assertRegExp('/^[a-z0-9]{40}$/', Miscellaneous::sha1()); + } + + public function testSha256() + { + $this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256()); + } + + public function testLocale() + { + $this->assertRegExp('/^[a-z]{2,3}_[A-Z]{2}$/', Miscellaneous::locale()); + } + + public function testCountryCode() + { + $this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode()); + } + + public function testCountryISOAlpha3() + { + $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::countryISOAlpha3()); + } + + public function testLanguage() + { + $this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode()); + } + + public function testCurrencyCode() + { + $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::currencyCode()); + } + + public function testEmoji() + { + $this->assertRegExp('/^[\x{1F600}-\x{1F637}]$/u', Miscellaneous::emoji()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php new file mode 100644 index 0000000..966b9d6 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php @@ -0,0 +1,209 @@ +addProvider(new BaseProvider($faker)); + $faker->addProvider(new DateTimeProvider($faker)); + $faker->addProvider(new PersonProvider($faker)); + $faker->addProvider(new PaymentProvider($faker)); + $this->faker = $faker; + } + + public function localeDataProvider() + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + $localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR)); + foreach ($localePaths as $path) { + $parts = explode('/', $path); + $locales[] = array($parts[count($parts) - 1]); + } + + return $locales; + } + + public function loadLocalProviders($locale) + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + if (file_exists($providerPath.'/'.$locale.'/Payment.php')) { + $payment = "\\Faker\\Provider\\$locale\\Payment"; + $this->faker->addProvider(new $payment($this->faker)); + } + } + + public function testCreditCardTypeReturnsValidVendorName() + { + $this->assertContains($this->faker->creditCardType, array('Visa', 'Visa Retired', 'MasterCard', 'American Express', 'Discover Card')); + } + + public function creditCardNumberProvider() + { + return array( + array('Discover Card', '/^6011\d{12}$/'), + array('Visa', '/^4\d{15}$/'), + array('Visa Retired', '/^4\d{12}$/'), + array('MasterCard', '/^(5[1-5]|2[2-7])\d{14}$/') + ); + } + + /** + * @dataProvider creditCardNumberProvider + */ + public function testCreditCardNumberReturnsValidCreditCardNumber($type, $regexp) + { + $cardNumber = $this->faker->creditCardNumber($type); + $this->assertRegExp($regexp, $cardNumber); + $this->assertTrue(Luhn::isValid($cardNumber)); + } + + public function testCreditCardNumberCanFormatOutput() + { + $this->assertRegExp('/^6011-\d{4}-\d{4}-\d{4}$/', $this->faker->creditCardNumber('Discover Card', true)); + } + + public function testCreditCardExpirationDateReturnsValidDateByDefault() + { + $expirationDate = $this->faker->creditCardExpirationDate; + $this->assertTrue(intval($expirationDate->format('U')) > strtotime('now')); + $this->assertTrue(intval($expirationDate->format('U')) < strtotime('+36 months')); + } + + public function testRandomCard() + { + $cardDetails = $this->faker->creditCardDetails; + $this->assertEquals(count($cardDetails), 4); + $this->assertEquals(array('type', 'number', 'name', 'expirationDate'), array_keys($cardDetails)); + } + + protected $ibanFormats = array( + 'AD' => '/^AD\d{2}\d{4}\d{4}[A-Z0-9]{12}$/', + 'AE' => '/^AE\d{2}\d{3}\d{16}$/', + 'AL' => '/^AL\d{2}\d{8}[A-Z0-9]{16}$/', + 'AT' => '/^AT\d{2}\d{5}\d{11}$/', + 'AZ' => '/^AZ\d{2}[A-Z]{4}[A-Z0-9]{20}$/', + 'BA' => '/^BA\d{2}\d{3}\d{3}\d{8}\d{2}$/', + 'BE' => '/^BE\d{2}\d{3}\d{7}\d{2}$/', + 'BG' => '/^BG\d{2}[A-Z]{4}\d{4}\d{2}[A-Z0-9]{8}$/', + 'BH' => '/^BH\d{2}[A-Z]{4}[A-Z0-9]{14}$/', + 'BR' => '/^BR\d{2}\d{8}\d{5}\d{10}[A-Z]{1}[A-Z0-9]{1}$/', + 'CH' => '/^CH\d{2}\d{5}[A-Z0-9]{12}$/', + 'CR' => '/^CR\d{2}\d{3}\d{14}$/', + 'CY' => '/^CY\d{2}\d{3}\d{5}[A-Z0-9]{16}$/', + 'CZ' => '/^CZ\d{2}\d{4}\d{6}\d{10}$/', + 'DE' => '/^DE\d{2}\d{8}\d{10}$/', + 'DK' => '/^DK\d{2}\d{4}\d{9}\d{1}$/', + 'DO' => '/^DO\d{2}[A-Z0-9]{4}\d{20}$/', + 'EE' => '/^EE\d{2}\d{2}\d{2}\d{11}\d{1}$/', + 'ES' => '/^ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}$/', + 'FI' => '/^FI\d{2}\d{6}\d{7}\d{1}$/', + 'FR' => '/^FR\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/', + 'GB' => '/^GB\d{2}[A-Z]{4}\d{6}\d{8}$/', + 'GE' => '/^GE\d{2}[A-Z]{2}\d{16}$/', + 'GI' => '/^GI\d{2}[A-Z]{4}[A-Z0-9]{15}$/', + 'GR' => '/^GR\d{2}\d{3}\d{4}[A-Z0-9]{16}$/', + 'GT' => '/^GT\d{2}[A-Z0-9]{4}[A-Z0-9]{20}$/', + 'HR' => '/^HR\d{2}\d{7}\d{10}$/', + 'HU' => '/^HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}$/', + 'IE' => '/^IE\d{2}[A-Z]{4}\d{6}\d{8}$/', + 'IL' => '/^IL\d{2}\d{3}\d{3}\d{13}$/', + 'IS' => '/^IS\d{2}\d{4}\d{2}\d{6}\d{10}$/', + 'IT' => '/^IT\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/', + 'KW' => '/^KW\d{2}[A-Z]{4}\d{22}$/', + 'KZ' => '/^KZ\d{2}\d{3}[A-Z0-9]{13}$/', + 'LB' => '/^LB\d{2}\d{4}[A-Z0-9]{20}$/', + 'LI' => '/^LI\d{2}\d{5}[A-Z0-9]{12}$/', + 'LT' => '/^LT\d{2}\d{5}\d{11}$/', + 'LU' => '/^LU\d{2}\d{3}[A-Z0-9]{13}$/', + 'LV' => '/^LV\d{2}[A-Z]{4}[A-Z0-9]{13}$/', + 'MC' => '/^MC\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/', + 'MD' => '/^MD\d{2}[A-Z0-9]{2}[A-Z0-9]{18}$/', + 'ME' => '/^ME\d{2}\d{3}\d{13}\d{2}$/', + 'MK' => '/^MK\d{2}\d{3}[A-Z0-9]{10}\d{2}$/', + 'MR' => '/^MR\d{2}\d{5}\d{5}\d{11}\d{2}$/', + 'MT' => '/^MT\d{2}[A-Z]{4}\d{5}[A-Z0-9]{18}$/', + 'MU' => '/^MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}$/', + 'NL' => '/^NL\d{2}[A-Z]{4}\d{10}$/', + 'NO' => '/^NO\d{2}\d{4}\d{6}\d{1}$/', + 'PK' => '/^PK\d{2}[A-Z]{4}[A-Z0-9]{16}$/', + 'PL' => '/^PL\d{2}\d{8}\d{16}$/', + 'PS' => '/^PS\d{2}[A-Z]{4}[A-Z0-9]{21}$/', + 'PT' => '/^PT\d{2}\d{4}\d{4}\d{11}\d{2}$/', + 'RO' => '/^RO\d{2}[A-Z]{4}[A-Z0-9]{16}$/', + 'RS' => '/^RS\d{2}\d{3}\d{13}\d{2}$/', + 'SA' => '/^SA\d{2}\d{2}[A-Z0-9]{18}$/', + 'SE' => '/^SE\d{2}\d{3}\d{16}\d{1}$/', + 'SI' => '/^SI\d{2}\d{5}\d{8}\d{2}$/', + 'SK' => '/^SK\d{2}\d{4}\d{6}\d{10}$/', + 'SM' => '/^SM\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/', + 'TN' => '/^TN\d{2}\d{2}\d{3}\d{13}\d{2}$/', + 'TR' => '/^TR\d{2}\d{5}\d{1}[A-Z0-9]{16}$/', + 'VG' => '/^VG\d{2}[A-Z]{4}\d{16}$/', + ); + + /** + * @dataProvider localeDataProvider + */ + public function testBankAccountNumber($locale) + { + $parts = explode('_', $locale); + $countryCode = array_pop($parts); + + if (!isset($this->ibanFormats[$countryCode])) { + // No IBAN format available + return; + } + + $this->loadLocalProviders($locale); + + try { + $iban = $this->faker->bankAccountNumber; + } catch (\InvalidArgumentException $e) { + // Not implemented, nothing to test + $this->markTestSkipped("bankAccountNumber not implemented for $locale"); + return; + } + + // Test format + $this->assertRegExp($this->ibanFormats[$countryCode], $iban); + + // Test checksum + $this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid"); + } + + public function ibanFormatProvider() + { + $return = array(); + foreach ($this->ibanFormats as $countryCode => $regex) { + $return[] = array($countryCode, $regex); + } + return $return; + } + /** + * @dataProvider ibanFormatProvider + */ + public function testIban($countryCode, $regex) + { + $iban = $this->faker->iban($countryCode); + + // Test format + $this->assertRegExp($regex, $iban); + + // Test checksum + $this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid"); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php new file mode 100644 index 0000000..f53076f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php @@ -0,0 +1,87 @@ +addProvider(new Person($faker)); + $this->assertContains($faker->firstName($gender), $expected); + } + + public function firstNameProvider() + { + return array( + array(null, array('John', 'Jane')), + array('foobar', array('John', 'Jane')), + array('male', array('John')), + array('female', array('Jane')), + ); + } + + public function testFirstNameMale() + { + $this->assertContains(Person::firstNameMale(), array('John')); + } + + public function testFirstNameFemale() + { + $this->assertContains(Person::firstNameFemale(), array('Jane')); + } + + /** + * @dataProvider titleProvider + */ + public function testTitle($gender, $expected) + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertContains($faker->title($gender), $expected); + } + + public function titleProvider() + { + return array( + array(null, array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + array('foobar', array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + array('male', array('Mr.', 'Dr.', 'Prof.')), + array('female', array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + ); + } + + public function testTitleMale() + { + $this->assertContains(Person::titleMale(), array('Mr.', 'Dr.', 'Prof.')); + } + + public function testTitleFemale() + { + $this->assertContains(Person::titleFemale(), array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')); + } + + public function testLastNameReturnsDoe() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertEquals($faker->lastName(), 'Doe'); + } + + public function testNameReturnsFirstNameAndLastName() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertContains($faker->name(), array('John Doe', 'Jane Doe')); + $this->assertContains($faker->name('foobar'), array('John Doe', 'Jane Doe')); + $this->assertContains($faker->name('male'), array('John Doe')); + $this->assertContains($faker->name('female'), array('Jane Doe')); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php new file mode 100644 index 0000000..520ecea --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $number = $this->faker->e164PhoneNumber(); + $this->assertRegExp('/^\+[0-9]{11,}$/', $number); + } + + public function testImeiReturnsValidNumber() + { + $imei = $this->faker->imei(); + $this->assertTrue(Luhn::isValid($imei)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php new file mode 100644 index 0000000..61d7d63 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php @@ -0,0 +1,194 @@ + + */ + +namespace Faker\Test\Provider; + +use Faker; +use PHPUnit\Framework\TestCase; + +/** + * Class ProviderOverrideTest + * + * @package Faker\Test\Provider + * + * This class tests a large portion of all locale specific providers. It does not test the entire stack, because each + * locale specific provider (can) has specific implementations. The goal of this test is to test the common denominator + * and to try to catch possible invalid multi-byte sequences. + */ +class ProviderOverrideTest extends TestCase +{ + /** + * Constants with regular expression patterns for testing the output. + * + * Regular expressions are sensitive for malformed strings (e.g.: strings with incorrect encodings) so by using + * PCRE for the tests, even though they seem fairly pointless, we test for incorrect encodings also. + */ + const TEST_STRING_REGEX = '/.+/u'; + + /** + * Slightly more specific for e-mail, the point isn't to properly validate e-mails. + */ + const TEST_EMAIL_REGEX = '/^(.+)@(.+)$/ui'; + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testAddress($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->city); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->postcode); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->address); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->country); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testCompany($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->company); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testDateTime($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->century); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->timezone); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testInternet($locale = null) + { + if ($locale && $locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->userName); + + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->email); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->safeEmail); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->freeEmail); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->companyEmail); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testPerson($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->name); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->title); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->firstName); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->lastName); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testPhoneNumber($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->phoneNumber); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testUserAgent($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->userAgent); + } + + + /** + * @dataProvider localeDataProvider + * + * @param null $locale + * @param string $locale + */ + public function testUuid($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->uuid); + } + + + /** + * @return array + */ + public function localeDataProvider() + { + $locales = $this->getAllLocales(); + $data = array(); + + foreach ($locales as $locale) { + $data[] = array( + $locale + ); + } + + return $data; + } + + + /** + * Returns all locales as array values + * + * @return array + */ + private function getAllLocales() + { + static $locales = array(); + + if ( ! empty($locales)) { + return $locales; + } + + // Finding all PHP files in the xx_XX directories + $providerDir = __DIR__ .'/../../../src/Faker/Provider'; + foreach (glob($providerDir .'/*_*/*.php') as $file) { + $localisation = basename(dirname($file)); + + if (isset($locales[ $localisation ])) { + continue; + } + + $locales[ $localisation ] = $localisation; + } + + return $locales; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php new file mode 100644 index 0000000..a43d8d4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php @@ -0,0 +1,55 @@ +addProvider(new Text($generator)); + $generator->seed(0); + + $lengths = array(10, 20, 50, 70, 90, 120, 150, 200, 500); + + foreach ($lengths as $length) { + $this->assertLessThan($length, $generator->realText($length)); + } + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMaxIndex() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(200, 11); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMinIndex() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(200, 0); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMinLength() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(9); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php new file mode 100644 index 0000000..5ba2459 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php @@ -0,0 +1,39 @@ +assertNotNull(UserAgent::userAgent()); + } + + public function testFirefoxUserAgent() + { + $this->stringContains(' Firefox/', UserAgent::firefox()); + } + + public function testSafariUserAgent() + { + $this->stringContains('Safari/', UserAgent::safari()); + } + + public function testInternetExplorerUserAgent() + { + $this->assertStringStartsWith('Mozilla/5.0 (compatible; MSIE ', UserAgent::internetExplorer()); + } + + public function testOperaUserAgent() + { + $this->assertStringStartsWith('Opera/', UserAgent::opera()); + } + + public function testChromeUserAgent() + { + $this->stringContains('(KHTML, like Gecko) Chrome/', UserAgent::chrome()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php new file mode 100644 index 0000000..5c639ca --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php @@ -0,0 +1,32 @@ +assertTrue($this->isUuid($uuid)); + } + + public function testUuidExpectedSeed() + { + if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { + $this->markTestSkipped('Big Endian'); + } + $faker = new Generator(); + $faker->seed(123); + $this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid()); + $this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid()); + } + + protected function isUuid($uuid) + { + return is_string($uuid) && (bool) preg_match('/^[a-f0-9]{8,8}-(?:[a-f0-9]{4,4}-){3,3}[a-f0-9]{12,12}$/i', $uuid); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php new file mode 100644 index 0000000..33d70c4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php new file mode 100644 index 0000000..8059f00 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php new file mode 100644 index 0000000..f62dae8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php @@ -0,0 +1,31 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(AT U\d{8})$/', $vat); + $this->assertRegExp('/^(ATU\d{8})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php new file mode 100644 index 0000000..b5645f9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php @@ -0,0 +1,31 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BG \d{9,10})$/', $vat); + $this->assertRegExp('/^(BG\d{9,10})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php new file mode 100644 index 0000000..e82fe8b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php @@ -0,0 +1,30 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfFirstNameMaleCanReturnData() + { + $firstNameMale = $this->faker->firstNameMale(); + $this->assertNotEmpty($firstNameMale); + } + + public function testIfFirstNameFemaleCanReturnData() + { + $firstNameFemale = $this->faker->firstNameFemale(); + $this->assertNotEmpty($firstNameFemale); + } +} +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php new file mode 100644 index 0000000..0b19872 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php @@ -0,0 +1,47 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Miscellaneous($faker)); + + for ($i = 0; $i < 1000; $i++) { + $birthNumber = $faker->birthNumber(); + $birthNumber = str_replace('/', '', $birthNumber); + + // check date + $year = intval(substr($birthNumber, 0, 2), 10); + $month = intval(substr($birthNumber, 2, 2), 10); + $day = intval(substr($birthNumber, 4, 2), 10); + + // make 4 digit year from 2 digit representation + $year += $year < 54 ? 2000 : 1900; + + // adjust special cases for month + if ($month > 50) $month -= 50; + if ($year >= 2004 && $month > 20) $month -= 20; + + $this->assertTrue(checkdate($month, $day, $year), "Birth number $birthNumber: date $year/$month/$day is invalid."); + + // check CRC if presented + if (strlen($birthNumber) == 10) { + $crc = intval(substr($birthNumber, -1), 10); + $refCrc = intval(substr($birthNumber, 0, -1), 10) % 11; + if ($refCrc == 10) { + $refCrc = 0; + } + $this->assertEquals($crc, $refCrc, "Birth number $birthNumber: checksum $crc doesn't match expected $refCrc."); + } + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php new file mode 100644 index 0000000..43c09be --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php new file mode 100644 index 0000000..1d778ee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php new file mode 100644 index 0000000..7cc6e6b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php @@ -0,0 +1,29 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/^06\d{2} \d{7}|\+43 \d{4} \d{4}(-\d{2})?$/', $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php new file mode 100644 index 0000000..668f211 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php new file mode 100644 index 0000000..31dcc55 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php new file mode 100644 index 0000000..5102297 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php new file mode 100644 index 0000000..a15f366 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php new file mode 100644 index 0000000..3f03dd3 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ—')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ,')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ! ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ; ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php new file mode 100644 index 0000000..b2f72e8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php @@ -0,0 +1,49 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testCityPrefix() + { + $cityPrefix = $this->faker->cityPrefix(); + $this->assertNotEmpty($cityPrefix); + $this->assertInternalType('string', $cityPrefix); + $this->assertRegExp('/[A-Z][a-z]+/', $cityPrefix); + } + + public function testStreetSuffix() + { + $streetSuffix = $this->faker->streetSuffix(); + $this->assertNotEmpty($streetSuffix); + $this->assertInternalType('string', $streetSuffix); + $this->assertRegExp('/[A-Z][a-z]+/', $streetSuffix); + } + + public function testState() + { + $state = $this->faker->state(); + $this->assertNotEmpty($state); + $this->assertInternalType('string', $state); + $this->assertRegExp('/[A-Z][a-z]+/', $state); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php new file mode 100644 index 0000000..6b1ece7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php @@ -0,0 +1,69 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * Test the validity of province + */ + public function testProvince() + { + $province = $this->faker->province(); + $this->assertNotEmpty($province); + $this->assertInternalType('string', $province); + $this->assertRegExp('/[A-Z][a-z]+/', $province); + } + + /** + * Test the validity of province abbreviation + */ + public function testProvinceAbbr() + { + $provinceAbbr = $this->faker->provinceAbbr(); + $this->assertNotEmpty($provinceAbbr); + $this->assertInternalType('string', $provinceAbbr); + $this->assertRegExp('/^[A-Z]{2}$/', $provinceAbbr); + } + + /** + * Test the validity of postcode letter + */ + public function testPostcodeLetter() + { + $postcodeLetter = $this->faker->randomPostcodeLetter(); + $this->assertNotEmpty($postcodeLetter); + $this->assertInternalType('string', $postcodeLetter); + $this->assertRegExp('/^[A-Z]{1}$/', $postcodeLetter); + } + + /** + * Test the validity of Canadian postcode + */ + public function testPostcode() + { + $postcode = $this->faker->postcode(); + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + $this->assertRegExp('/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/', $postcode); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php new file mode 100644 index 0000000..762e11a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php @@ -0,0 +1,36 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * + */ + public function testPostcode() + { + + $postcode = $this->faker->postcode(); + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + $this->assertRegExp('@^(GIR ?0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]([0-9ABEHMNPRV-Y])?)|[0-9][A-HJKPS-UW]) ?[0-9][ABD-HJLNP-UW-Z]{2})$@i', $postcode); + + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php new file mode 100644 index 0000000..125cbdf --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php @@ -0,0 +1,57 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testCity() + { + $city = $this->faker->city(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + $this->assertRegExp('/[A-Z][a-z]+/', $city); + } + + public function testCountry() + { + $country = $this->faker->country(); + $this->assertNotEmpty($country); + $this->assertInternalType('string', $country); + $this->assertRegExp('/[A-Z][a-z]+/', $country); + } + + public function testLocalityName() + { + $localityName = $this->faker->localityName(); + $this->assertNotEmpty($localityName); + $this->assertInternalType('string', $localityName); + $this->assertRegExp('/[A-Z][a-z]+/', $localityName); + } + + public function testAreaSuffix() + { + $areaSuffix = $this->faker->areaSuffix(); + $this->assertNotEmpty($areaSuffix); + $this->assertInternalType('string', $areaSuffix); + $this->assertRegExp('/[A-Z][a-z]+/', $areaSuffix); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php new file mode 100644 index 0000000..27c591b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php @@ -0,0 +1,57 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * + */ + public function testPostcodeIsNotEmptyAndIsValid() + { + $postcode = $this->faker->postcode(); + + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + } + + /** + * Test the name of the Nigerian State/County + */ + public function testCountyIsAValidString() + { + $county = $this->faker->county; + + $this->assertNotEmpty($county); + $this->assertInternalType('string', $county); + } + + /** + * Test the name of the Nigerian Region in a State. + */ + public function testRegionIsAValidString() + { + $region = $this->faker->region; + + $this->assertNotEmpty($region); + $this->assertInternalType('string', $region); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php new file mode 100644 index 0000000..6ebc620 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + $this->assertNotEmpty($email); + $this->assertInternalType('string', $email); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php new file mode 100644 index 0000000..2180e36 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php @@ -0,0 +1,30 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testPersonNameIsAValidString() + { + $name = $this->faker->name; + + $this->assertNotEmpty($name); + $this->assertInternalType('string', $name); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php new file mode 100644 index 0000000..c591b8a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php @@ -0,0 +1,26 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsPhoneNumberWithOrWithoutCountryCode() + { + $phoneNumber = $this->faker->phoneNumber(); + + $this->assertNotEmpty($phoneNumber); + $this->assertInternalType('string', $phoneNumber); + $this->assertRegExp('/^(0|(\+234))\s?[789][01]\d\s?(\d{3}\s?\d{4})/', $phoneNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php new file mode 100644 index 0000000..14b145c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testIfPhoneNumberCanReturnData() + { + $number = $this->faker->phoneNumber; + $this->assertNotEmpty($number); + } + + public function phoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/(^\([0]\d{1}\))(\d{7}$)|(^\([0][2]\d{1}\))(\d{6,8}$)|([0][8][0][0])([\s])(\d{5,8}$)/', $number); + } +} +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php new file mode 100644 index 0000000..19367a4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php @@ -0,0 +1,50 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testProvince() + { + $province = $this->faker->province(); + $this->assertNotEmpty($province); + $this->assertInternalType('string', $province); + } + + public function testCity() + { + $city = $this->faker->city(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + } + + public function testMunicipality() + { + $municipality = $this->faker->municipality(); + $this->assertNotEmpty($municipality); + $this->assertInternalType('string', $municipality); + } + + public function testBarangay() + { + $barangay = $this->faker->barangay(); + $this->assertInternalType('string', $barangay); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php new file mode 100644 index 0000000..abc62aa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php @@ -0,0 +1,27 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testStreetNumber() + { + $this->assertRegExp('/^\d{2,3}$/', $this->faker->streetNumber()); + } + + public function testBlockNumber() + { + $this->assertRegExp('/^Blk\s*\d{2,3}[A-H]*$/i', $this->faker->blockNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php new file mode 100644 index 0000000..c8bb13f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php @@ -0,0 +1,46 @@ +faker = Factory::create('en_SG'); + $this->faker->seed(1); + $this->faker->addProvider(new PhoneNumber($this->faker)); + } + + // http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan + // y means 0 to 8 only + // x means 0 to 9 + public function testMobilePhoneNumberStartWith9Returns9yxxxxxx() + { + $startsWith9 = false; + while (!$startsWith9) { + $mobileNumber = $this->faker->mobileNumber(); + $startsWith9 = preg_match('/^(\+65|65)?\s*9/', $mobileNumber); + } + + $this->assertRegExp('/^(\+65|65)?\s*9\s*[0-8]{3}\s*\d{4}$/', $mobileNumber); + } + + // http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan + // z means 1 to 9 only + // x means 0 to 9 + public function testMobilePhoneNumberStartWith7Or8Returns7Or8zxxxxxx() + { + $startsWith7Or8 = false; + while (!$startsWith7Or8) { + $mobileNumber = $this->faker->mobileNumber(); + $startsWith7Or8 = preg_match('/^(\+65|65)?\s*[7-8]/', $mobileNumber); + } + $this->assertRegExp('/^(\+65|65)?\s*[7-8]\s*[1-9]{3}\s*\d{4}$/', $mobileNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php new file mode 100644 index 0000000..571d93f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php @@ -0,0 +1,53 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function testCityName() + { + $city = $this->faker->cityName(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + } + + /** + * @test + */ + public function testDistrict() + { + $district = $this->faker->district(); + $this->assertNotEmpty($district); + $this->assertInternalType('string', $district); + } + + /** + * @test + */ + public function testRegion() + { + $region = $this->faker->region(); + $this->assertNotEmpty($region); + $this->assertInternaltype('string', $region); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php new file mode 100644 index 0000000..735d833 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php @@ -0,0 +1,33 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @link https://stackoverflow.com/questions/4242433/regex-for-ein-number-and-ssn-number-format-in-jquery/35471665#35471665 + */ + public function testEin() + { + $number = $this->faker->ein; + + // should be in the format ##-#######, with a valid prefix + $this->assertRegExp('/^(0[1-6]||1[0-6]|2[0-7]|[35]\d|[468][0-8]|7[1-7]|9[0-58-9])-\d{7}$/', $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php new file mode 100644 index 0000000..ec82691 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php @@ -0,0 +1,85 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testBankAccountNumber() + { + $accNo = $this->faker->bankAccountNumber; + $this->assertTrue(ctype_digit($accNo)); + $this->assertLessThanOrEqual(17, strlen($accNo)); + } + + public function testBankRoutingNumber() + { + $routingNo = $this->faker->bankRoutingNumber; + $this->assertRegExp('/^\d{9}$/', $routingNo); + $this->assertEquals(Payment::calculateRoutingNumberChecksum($routingNo), $routingNo[8]); + } + + public function routingNumberProvider() + { + return array( + array('122105155'), + array('082000549'), + array('121122676'), + array('122235821'), + array('102101645'), + array('102000021'), + array('123103729'), + array('071904779'), + array('081202759'), + array('074900783'), + array('104000029'), + array('073000545'), + array('101000187'), + array('042100175'), + array('083900363'), + array('091215927'), + array('091300023'), + array('091000022'), + array('081000210'), + array('101200453'), + array('092900383'), + array('104000029'), + array('121201694'), + array('107002312'), + array('091300023'), + array('041202582'), + array('042000013'), + array('123000220'), + array('091408501'), + array('064000059'), + array('124302150'), + array('125000105'), + array('075000022'), + array('307070115'), + array('091000022'), + ); + } + + /** + * @dataProvider routingNumberProvider + */ + public function testCalculateRoutingNumberChecksum($routingNo) + { + $this->assertEquals($routingNo[8], Payment::calculateRoutingNumberChecksum($routingNo), $routingNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php new file mode 100644 index 0000000..3ddb38b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php @@ -0,0 +1,48 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testSsn() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->ssn; + + // should be in the format ###-##-#### + $this->assertRegExp('/^[0-9]{3}-[0-9]{2}-[0-9]{4}$/', $number); + + $parts = explode("-", $number); + + // first part must be between 001 and 899, excluding 666 + $this->assertNotEquals(666, $parts[0]); + $this->assertGreaterThan(0, $parts[0]); + $this->assertLessThan(900, $parts[0]); + + // second part must be between 01 and 99 + $this->assertGreaterThan(0, $parts[1]); + $this->assertLessThan(100, $parts[1]); + + // the third part must be between 0001 and 9999 + $this->assertGreaterThan(0, $parts[2]); + $this->assertLessThan(10000, $parts[2]); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php new file mode 100644 index 0000000..a54ff88 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php @@ -0,0 +1,85 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->phoneNumber; + $baseNumber = preg_replace('/ *x.*$/', '', $number); // Remove possible extension + $digits = array_values(array_filter(str_split($baseNumber), 'ctype_digit')); + + // Prefix '1' allowed + if (count($digits) === 11) { + $this->assertEquals('1', $digits[0]); + $digits = array_slice($digits, 1); + } + + // 10 digits + $this->assertEquals(10, count($digits)); + + // Last two digits of area code cannot be identical + $this->assertNotEquals($digits[1], $digits[2]); + + // Last two digits of exchange code cannot be 1 + if ($digits[4] === 1) { + $this->assertNotEquals($digits[4], $digits[5]); + } + + // Test format + $this->assertRegExp('/^(\+?1)?([ -.]*\d{3}[ -.]*| *\(\d{3}\) *)\d{3}[-.]?\d{4}$/', $baseNumber); + } + } + + public function testTollFreeAreaCode() + { + $this->assertContains($this->faker->tollFreeAreaCode, array(800, 822, 833, 844, 855, 866, 877, 888, 880, 887, 889)); + } + + public function testTollFreePhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->tollFreePhoneNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + // Prefix '1' allowed + if (count($digits) === 11) { + $this->assertEquals('1', $digits[0]); + $digits = array_slice($digits, 1); + } + + // 10 digits + $this->assertEquals(10, count($digits)); + + $areaCode = $digits[0] . $digits[1] . $digits[2]; + $this->assertContains($areaCode, array('800', '822', '833', '844', '855', '866', '877', '888', '880', '887', '889')); + + // Last two digits of exchange code cannot be 1 + if ($digits[4] === 1) { + $this->assertNotEquals($digits[4], $digits[5]); + } + + // Test format + $this->assertRegExp('/^(\+?1)?([ -.]*\d{3}[ -.]*| *\(\d{3}\) *)\d{3}[-.]?\d{4}$/', $number); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php new file mode 100644 index 0000000..0e51d49 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php @@ -0,0 +1,27 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testGenerateValidCompanyNumber() + { + $companyRegNo = $this->faker->companyNumber(); + + $this->assertEquals(14, strlen($companyRegNo)); + $this->assertRegExp('#^\d{4}/\d{6}/\d{2}$#', $companyRegNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php new file mode 100644 index 0000000..02c2940 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php new file mode 100644 index 0000000..d7973e7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php @@ -0,0 +1,69 @@ +addProvider(new Person($faker)); + $faker->addProvider(new DateTime($faker)); + $this->faker = $faker; + } + + public function testIdNumberWithDefaults() + { + $idNumber = $this->faker->idNumber(); + + $this->assertEquals(13, strlen($idNumber)); + $this->assertRegExp('#^\d{13}$#', $idNumber); + $this->assertInternalType('string', $idNumber); + } + + public function testIdNumberForMales() + { + $idNumber = $this->faker->idNumber(new \DateTime(), true, 'male'); + + $genderDigit = substr($idNumber, 6, 1); + + $this->assertContains($genderDigit, array('5', '6', '7', '8', '9')); + } + + public function testIdNumberForFemales() + { + $idNumber = $this->faker->idNumber(new \DateTime(), true, 'female'); + + $genderDigit = substr($idNumber, 6, 1); + + $this->assertContains($genderDigit, array('0', '1', '2', '3', '4')); + } + + public function testLicenceCode() + { + $validLicenceCodes = array('A', 'A1', 'B', 'C', 'C1', 'C2', 'EB', 'EC', 'EC1', 'I', 'L', 'L1'); + + $this->assertContains($this->faker->licenceCode, $validLicenceCodes); + } + + public function testMaleTitles() + { + $validMaleTitles = array('Mr.', 'Dr.', 'Prof.', 'Rev.', 'Hon.'); + + $this->assertContains(Person::titleMale(), $validMaleTitles); + } + + public function testFemaleTitles() + { + $validateFemaleTitles = array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.', 'Rev.', 'Hon.'); + + $this->assertContains(Person::titleFemale(), $validateFemaleTitles); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php new file mode 100644 index 0000000..37b781b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php @@ -0,0 +1,66 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->phoneNumber; + + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + // 10 digits + if($digits[0] = 2 && $digits[1] == 7) { + $this->assertLessThanOrEqual(11, count($digits)); + } else { + $this->assertGreaterThanOrEqual(10, count($digits)); + } + } + } + + public function testTollFreePhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->tollFreeNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + if (count($digits) === 11) { + $this->assertEquals('0', $digits[0]); + } + + $areaCode = $digits[0] . $digits[1] . $digits[2] . $digits[3]; + $this->assertContains($areaCode, array('0800', '0860', '0861', '0862')); + } + } + + public function testCellPhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->mobileNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + if($digits[0] = 2 && $digits[1] == 7) { + $this->assertLessThanOrEqual(11, count($digits)); + } else { + $this->assertGreaterThanOrEqual(10, count($digits)); + } + + $this->assertRegExp('/^(\+27|27)?(\()?0?([6][0-4]|[7][1-9]|[8][1-9])(\))?( |-|\.|_)?(\d{3})( |-|\.|_)?(\d{4})/', $number); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php new file mode 100644 index 0000000..e636544 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php @@ -0,0 +1,61 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVAT() + { + $vat = $this->faker->vat(); + + $this->assertTrue($this->isValidCIF($vat)); + } + + /** + * Validation taken from https://github.com/amnesty/drupal-nif-nie-cif-validator/ + * @link https://github.com/amnesty/drupal-nif-nie-cif-validator/blob/master/includes/nif-nie-cif.php + */ + function isValidCIF($docNumber) + { + $fixedDocNumber = strtoupper($docNumber); + + return $this->isValidCIFFormat($fixedDocNumber); + } + + function isValidCIFFormat($docNumber) + { + return $this->respectsDocPattern($docNumber, '/^[PQSNWR][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z0-9]/') + || + $this->respectsDocPattern($docNumber, '/^[ABCDEFGHJUV][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/'); + } + + function respectsDocPattern($givenString, $pattern) + { + $isValid = FALSE; + $fixedString = strtoupper($givenString); + if (is_int(substr($fixedString, 0, 1))) { + $fixedString = substr("000000000" . $givenString, -9); + } + if (preg_match($pattern, $fixedString)) { + $isValid = TRUE; + } + return $isValid; + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php new file mode 100644 index 0000000..e29f3f9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php @@ -0,0 +1,46 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testDNI() + { + $dni = $this->faker->dni; + $this->assertTrue($this->isValidDNI($dni)); + } + + // validation taken from http://kiwwito.com/php-function-for-spanish-dni-nie-validation/ + public function isValidDNI($string) + { + if (strlen($string) != 9 || + preg_match('/^[XYZ]?([0-9]{7,8})([A-Z])$/i', $string, $matches) !== 1) { + return false; + } + + $map = 'TRWAGMYFPDXBNJZSQVHLCKE'; + + list(, $number, $letter) = $matches; + + return strtoupper($letter) === $map[((int) $number) % 23]; + } + + public function testLicenceCode() + { + $validLicenceCodes = array('AM', 'A1', 'A2', 'A','B', 'B+E', 'C1', 'C1+E', 'C', 'C+E', 'D1', 'D1+E', 'D', 'D+E'); + + $this->assertContains($this->faker->licenceCode, $validLicenceCodes); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php new file mode 100644 index 0000000..a8ae348 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php @@ -0,0 +1,27 @@ +addProvider(new Text($faker)); + $this->faker = $faker; + } + + public function testText() + { + $this->assertNotSame('', $this->faker->realtext(200, 2)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php new file mode 100644 index 0000000..6014938 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php @@ -0,0 +1,29 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testDNI() + { + $dni = $this->faker->dni; + $this->assertRegExp('/\A[0-9]{8}\Z/', $dni); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php new file mode 100644 index 0000000..3c9b162 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php @@ -0,0 +1,43 @@ + for Faker + * Date: 01/09/2017 + * Time: 09:45 PM + */ + +namespace Faker\Test\Provider\es_VE; + +use Faker\Generator; +use Faker\Provider\es_VE\Company; +use PHPUnit\Framework\TestCase; + +class CompanyTest extends TestCase +{ + /** + * @var Generator + */ + private $faker; + + public function setUp() + { + $faker = new Generator(); + $faker->seed(1); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * national Id format validator + */ + public function testNationalId() + { + $pattern = '/^[VJGECP]-?\d{8}-?\d$/'; + $rif = $this->faker->taxpayerIdentificationNumber; + $this->assertRegExp($pattern, $rif); + + $rif = $this->faker->taxpayerIdentificationNumber('-'); + $this->assertRegExp($pattern, $rif); + } + + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php new file mode 100644 index 0000000..bb42cd7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php @@ -0,0 +1,43 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * national Id format validator + */ + public function testNationalId() + { + $pattern = '/(?:^V-?\d{5,9}$)|(?:^E-?\d{8,9}$)/'; + + $cedula = $this->faker->nationalId; + $this->assertRegExp($pattern, $cedula); + + $cedula = $this->faker->nationalId('-'); + $this->assertRegExp($pattern, $cedula); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php new file mode 100644 index 0000000..6009bbd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php new file mode 100644 index 0000000..b979666 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php @@ -0,0 +1,82 @@ +addProvider(new DateTime($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function provideSeedAndExpectedReturn() + { + return array( + array(1, '1800-01-01', '010100+5207'), + array(2, '1930-08-08', '080830-508R'), + array(3, '1999-12-31', '311299-409D'), + array(4, '2000-01-01', '010100A039P'), + array(5, '2015-06-17', '170615A690X') + ); + } + + /** + * @dataProvider provideSeedAndExpectedReturn + */ + public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected) + { + $faker = $this->faker; + $faker->seed($seed); + $pin = $faker->personalIdentityNumber(\DateTime::createFromFormat('Y-m-d', $birthdate)); + $this->assertEquals($expected, $pin); + } + + public function testPersonalIdentityNumberGeneratesCompliantNumbers() + { + if (strtotime('1800-01-01 00:00:00')) { + $min="1900"; + $max="2099"; + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween('1800-01-01 00:00:00', '1899-12-31 23:59:59'); + $pin = $this->faker->personalIdentityNumber($birthdate, NULL, true); + $this->assertRegExp('/^[0-9]{6}\+[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + } else { // timestamp limit for 32-bit computer + $min="1902"; + $max="2037"; + } + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween("$min-01-01 00:00:00", '1999-12-31 23:59:59'); + $pin = $this->faker->personalIdentityNumber($birthdate); + $this->assertRegExp('/^[0-9]{6}-[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween('2000-01-01 00:00:00', "$max-12-31 23:59:59"); + $pin = $this->faker->personalIdentityNumber($birthdate); + $this->assertRegExp('/^[0-9]{6}A[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + } + + public function testPersonalIdentityNumberGeneratesOddValuesForMales() + { + $pin = $this->faker->personalIdentityNumber(null, 'male'); + $this->assertEquals(1, $pin{9} % 2); + } + + public function testPersonalIdentityNumberGeneratesEvenValuesForFemales() + { + $pin = $this->faker->personalIdentityNumber(null, 'female'); + $this->assertEquals(0, $pin{9} % 2); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php new file mode 100644 index 0000000..6944c55 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php @@ -0,0 +1,30 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BE 0\d{9})$/', $vat); + $this->assertRegExp('/^(BE0\d{9})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php new file mode 100644 index 0000000..217ac9f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php new file mode 100644 index 0000000..f4e9484 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php new file mode 100644 index 0000000..7bfcca7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php new file mode 100644 index 0000000..50b40f4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php @@ -0,0 +1,33 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function testSecondaryAddress() + { + $secondaryAdress = $this->faker->secondaryAddress(); + $this->assertNotEmpty($secondaryAdress); + $this->assertInternalType('string', $secondaryAdress); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php new file mode 100644 index 0000000..83e54d9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php @@ -0,0 +1,75 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testSiretReturnsAValidSiret() + { + $siret = $this->faker->siret(false); + $this->assertRegExp("/^\d{14}$/", $siret); + $this->assertTrue(Luhn::isValid($siret)); + } + + public function testSiretReturnsAWellFormattedSiret() + { + $siret = $this->faker->siret(); + $this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}\s\d{5}$/", $siret); + $siret = str_replace(' ', '', $siret); + $this->assertTrue(Luhn::isValid($siret)); + } + + public function testSirenReturnsAValidSiren() + { + $siren = $this->faker->siren(false); + $this->assertRegExp("/^\d{9}$/", $siren); + $this->assertTrue(Luhn::isValid($siren)); + } + + public function testSirenReturnsAWellFormattedSiren() + { + $siren = $this->faker->siren(); + $this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}$/", $siren); + $siren = str_replace(' ', '', $siren); + $this->assertTrue(Luhn::isValid($siren)); + } + + public function testCatchPhraseReturnsValidCatchPhrase() + { + $this->assertTrue(TestableCompany::isCatchPhraseValid($this->faker->catchPhrase())); + } + + public function testIsCatchPhraseValidReturnsFalseWhenAWordsAppearsTwice() + { + $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute sécurité'); + $this->assertFalse($isCatchPhraseValid); + } + + public function testIsCatchPhraseValidReturnsTrueWhenNoWordAppearsTwice() + { + $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute simplicité'); + $this->assertTrue($isCatchPhraseValid); + } +} + +class TestableCompany extends Company +{ + public static function isCatchPhraseValid($catchPhrase) + { + return parent::isCatchPhraseValid($catchPhrase); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php new file mode 100644 index 0000000..d00a7c8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php @@ -0,0 +1,49 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testFormattedVat() + { + $vat = $this->faker->vat(true); + $this->assertRegExp("/^FR\s\w{2}\s\d{3}\s\d{3}\s\d{3}$/", $vat); + + $vat = str_replace(' ', '', $vat); + $siren = substr($vat, 4, 12); + $this->assertTrue(Luhn::isValid($siren)); + + $key = (int) substr($siren, 2, 2); + if ($key === 0) { + $this->assertEqual($key, (12 + 3 * ($siren % 97)) % 97); + } + } + + public function testUnformattedVat() + { + $vat = $this->faker->vat(false); + $this->assertRegExp("/^FR\w{2}\d{9}$/", $vat); + + $siren = substr($vat, 4, 12); + $this->assertTrue(Luhn::isValid($siren)); + + $key = (int) substr($siren, 2, 2); + if ($key === 0) { + $this->assertEqual($key, (12 + 3 * ($siren % 97)) % 97); + } + } +} \ No newline at end of file diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php new file mode 100644 index 0000000..8c5fc65 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php @@ -0,0 +1,37 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testNIRReturnsTheRightGender() + { + $nir = $this->faker->nir(\Faker\Provider\Person::GENDER_MALE); + $this->assertStringStartsWith('1', $nir); + } + + public function testNIRReturnsTheRightPattern() + { + $nir = $this->faker->nir; + $this->assertRegExp("/^[12]\d{5}[0-9A-B]\d{8}$/", $nir); + } + + public function testNIRFormattedReturnsTheRightPattern() + { + $nir = $this->faker->nir(null, true); + $this->assertRegExp("/^[12]\s\d{2}\s\d{2}\s\d{1}[0-9A-B]\s\d{3}\s\d{3}\s\d{2}$/", $nir); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php new file mode 100644 index 0000000..d417970 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php @@ -0,0 +1,57 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testMobileNumber() + { + $mobileNumber = $this->faker->mobileNumber(); + $this->assertRegExp('/^(\+33 |\+33 \(0\)|0)(6|7)(?:(\s{1})?\d{2}){4}$/', $mobileNumber); + } + + public function testMobileNumber07Format() + { + $mobileNumberFormat = $this->faker->phoneNumber07(); + $this->assertRegExp('/^([3-9]{1})\d(\d{2}){3}$/', $mobileNumberFormat); + } + + public function testMobileNumber07WithSeparatorFormat() + { + $mobileNumberFormat = $this->faker->phoneNumber07WithSeparator(); + $this->assertRegExp('/^([3-9]{1})\d( \d{2}){3}$/', $mobileNumberFormat); + } + + public function testServiceNumber() + { + $serviceNumber = $this->faker->serviceNumber(); + $this->assertRegExp('/^(\+33 |\+33 \(0\)|0)8(?:(\s{1})?\d{2}){4}$/', $serviceNumber); + } + + public function testServiceNumberFormat() + { + $serviceNumberFormat = $this->faker->phoneNumber08(); + $this->assertRegExp('/^((0|1|2)\d{1}|9[^46])\d{6}$/', $serviceNumberFormat); + } + + public function testServiceNumberWithSeparatorFormat() + { + $serviceNumberFormat = $this->faker->phoneNumber08WithSeparator(); + $this->assertRegExp('/^((0|1|2)\d{1}|9[^46])( \d{2}){3}$/', $serviceNumberFormat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php new file mode 100644 index 0000000..c9c7a4f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\fr_FR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À— ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À,')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À! ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À: ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php new file mode 100644 index 0000000..5ebfeee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php @@ -0,0 +1,41 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfFirstNameMaleCanReturnData() + { + $firstNameMale = $this->faker->firstNameMale(); + $this->assertNotEmpty($firstNameMale); + } + + public function testIfLastNameMaleCanReturnData() + { + $lastNameMale = $this->faker->lastNameMale(); + $this->assertNotEmpty($lastNameMale); + } + + public function testIfFirstNameFemaleCanReturnData() + { + $firstNameFemale = $this->faker->firstNameFemale(); + $this->assertNotEmpty($firstNameFemale); + } + + public function testIfLastNameFemaleCanReturnData() + { + $lastNameFemale = $this->faker->lastNameFemale(); + $this->assertNotEmpty($lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php new file mode 100644 index 0000000..0f0df5e --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php new file mode 100644 index 0000000..d46f6b7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php new file mode 100644 index 0000000..5cda534 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php new file mode 100644 index 0000000..33977e1 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php @@ -0,0 +1,24 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testIfTaxIdCanReturnData() + { + $vatId = $this->faker->vatId(); + $this->assertRegExp('/^IT[0-9]{11}$/', $vatId); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php new file mode 100644 index 0000000..3e7b1a4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php @@ -0,0 +1,24 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfTaxIdCanReturnData() + { + $taxId = $this->faker->taxId(); + $this->assertRegExp('/^[a-zA-Z]{6}[0-9]{2}[a-zA-Z][0-9]{2}[a-zA-Z][0-9]{3}[a-zA-Z]$/', $taxId); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php new file mode 100644 index 0000000..b4a19fd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php @@ -0,0 +1,28 @@ +addProvider(new Internet($faker)); + $faker->seed(1); + + $this->assertEquals('akira72', $faker->userName); + } + + public function testDomainName() + { + $faker = new Generator(); + $faker->addProvider(new Internet($faker)); + $faker->seed(1); + + $this->assertEquals('nakajima.com', $faker->domainName); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php new file mode 100644 index 0000000..e785482 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php @@ -0,0 +1,55 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('アオタ ミノル', $faker->kanaName('male')); + } + + public function testKanaNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('アオタ ミキ', $faker->kanaName('female')); + } + + public function testFirstKanaNameMaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('ヒデキ', $faker->firstKanaName('male')); + } + + public function testFirstKanaNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('マアヤ', $faker->firstKanaName('female')); + } + + public function testLastKanaNameReturnsNakajima() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('ナカジマ', $faker->lastKanaName); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php new file mode 100644 index 0000000..158718a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php @@ -0,0 +1,22 @@ +addProvider(new PhoneNumber($faker)); + + for ($i = 0; $i < 10; $i++) { + $phoneNumber = $faker->phoneNumber; + $this->assertNotEmpty($phoneNumber); + $this->assertRegExp('/^0\d{1,4}-\d{1,4}-\d{3,4}$/', $phoneNumber); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php new file mode 100644 index 0000000..0201cee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე ')) + ); + + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე— ')) + ); + + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე, ')) + ); + + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე! ')) + ); + + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე; ')) + ); + + $this->assertSame( + 'ჭეშმარიტია. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმარიტია. ჩვენც ისე: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php new file mode 100644 index 0000000..b6a3c06 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php @@ -0,0 +1,32 @@ +faker = new Generator(); + + $this->faker->addProvider(new Company($this->faker)); + } + + public function testBusinessIdentificationNumberIsValid() + { + $registrationDate = new \DateTime('now'); + $businessIdentificationNumber = $this->faker->businessIdentificationNumber($registrationDate); + $registrationDateAsString = $registrationDate->format('ym'); + + $this->assertRegExp( + "/^(" . $registrationDateAsString . ")([4-6]{1})([0-3]{1})(\\d{6})$/", + $businessIdentificationNumber + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php new file mode 100644 index 0000000..c565735 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php @@ -0,0 +1,30 @@ +faker = new Generator(); + + $this->faker->addProvider(new Person($this->faker)); + } + + public function testIndividualIdentificationNumberIsValid() + { + $birthDate = DateTime::dateTimeBetween('-30 years', '-10 years'); + $individualIdentificationNumber = $this->faker->individualIdentificationNumber($birthDate); + $controlDigit = Person::checkSum($individualIdentificationNumber); + + $this->assertSame($controlDigit, (int)substr($individualIdentificationNumber, 11, 1)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php new file mode 100644 index 0000000..2c78050 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\kk_KZ\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар ')) + ); + + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар— ')) + ); + + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар, ')) + ); + + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар! ')) + ); + + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар: ')) + ); + + $this->assertSame( + 'Арыстан баб кесенесі - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Арыстан баб кесенесі - көне Отырар; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php new file mode 100644 index 0000000..336acc8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가 ')) + ); + + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가—')) + ); + + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가,')) + ); + + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가! ')) + ); + + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가: ')) + ); + + $this->assertSame( + '최석(崔晳)으로부터 최후의 편지가.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최석(崔晳)으로부터 최후의 편지가; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php new file mode 100644 index 0000000..232f8f4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php @@ -0,0 +1,28 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertRegExp('/^[А-Я]{1}\.[\w\W]+$/u', $faker->name); + } + + public function testIdNumber() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(2); + + $this->assertRegExp('/^[А-Я]{2}\d{8}$/u', $faker->idNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php new file mode 100644 index 0000000..c35c698 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php @@ -0,0 +1,50 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @link https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + */ + public function testPersonalIdentityCardNumber() + { + $myKadNumber = $this->faker->myKadNumber; + + $yy = substr($myKadNumber, 0, 2); + //match any year from 00-99 + $this->assertRegExp("/^[0-9]{2}$/", $yy); + + $mm = substr($myKadNumber, 2, 2); + //match any month from 01-12 + $this->assertRegExp("/^0[1-9]|1[0-2]$/", $mm); + + $dd = substr($myKadNumber, 4, 2); + //match any date from 01-31 + $this->assertRegExp("/^0[1-9]|1[0-9]|2[0-9]|3[0-1]$/", $dd); + + $pb = substr($myKadNumber, 6, 2); + //match any valid place of birth code from 01-59 except 17-20 + $this->assertRegExp("/^(0[1-9]|1[0-6])|(2[1-9]|3[0-9]|4[0-9]|5[0-9])$/", $pb); + + $nnnn = substr($myKadNumber, 8, 4); + //match any number from 0000-9999 + $this->assertRegExp("/^[0-9]{4}$/", $nnnn); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php new file mode 100644 index 0000000..e844103 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php @@ -0,0 +1,30 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BE 0\d{9})$/', $vat); + $this->assertRegExp('/^(BE0\d{9})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php new file mode 100644 index 0000000..4885cc3 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php @@ -0,0 +1,54 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testRrnIsValid() + { + $rrn = $this->faker->rrn(); + + $this->assertEquals(11, strlen($rrn)); + + $ctrlNumber = substr($rrn, 9, 2); + $calcCtrl = 97 - (substr($rrn, 0, 9) % 97); + $altcalcCtrl = 97 - ((2 . substr($rrn, 0, 9)) % 97); + $this->assertContains($ctrlNumber, array($calcCtrl, $altcalcCtrl)); + + $middle = substr($rrn, 6, 3); + $this->assertGreaterThan(1, $middle); + $this->assertLessThan(997, $middle); + } + + public function testRrnIsMale() + { + $rrn = $this->faker->rrn('male'); + $this->assertEquals(substr($rrn, 6, 3) % 2, 1); + } + + public function testRrnIsFemale() + { + $rrn = $this->faker->rrn('female'); + $this->assertEquals(substr($rrn, 6, 3) % 2, 0); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php new file mode 100644 index 0000000..6d5484c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php @@ -0,0 +1,35 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testGenerateValidVatNumber() + { + $vatNo = $this->faker->vat(); + + $this->assertEquals(14, strlen($vatNo)); + $this->assertRegExp('/^NL[0-9]{9}B[0-9]{2}$/', $vatNo); + } + + public function testGenerateValidBtwNumberAlias() + { + $btwNo = $this->faker->btw(); + + $this->assertEquals(14, strlen($btwNo)); + $this->assertRegExp('/^NL[0-9]{9}B[0-9]{2}$/', $btwNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php new file mode 100644 index 0000000..c8735f5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testGenerateValidIdNumber() + { + $idNumber = $this->faker->idNumber(); + $this->assertEquals(9, strlen($idNumber)); + + + $sum = -1 * $idNumber % 10; + for ($multiplier = 2; $idNumber > 0; $multiplier++) { + $val = ($idNumber /= 10) % 10; + $sum += $multiplier * $val; + } + $this->assertTrue($sum != 0 && $sum % 11 == 0); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php new file mode 100644 index 0000000..bbfdf4d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php @@ -0,0 +1,32 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * Test the validity of state + */ + public function testState() + { + $state = $this->faker->state(); + $this->assertNotEmpty($state); + $this->assertInternalType('string', $state); + $this->assertRegExp('/[a-z]+/', $state); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php new file mode 100644 index 0000000..e5e0edc --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php @@ -0,0 +1,101 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testPeselLenght() + { + $pesel = $this->faker->pesel(); + + $this->assertEquals(11, strlen($pesel)); + } + + public function testPeselDate() + { + $date = new DateTime('1990-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('90', substr($pesel, 0, 2)); + $this->assertEquals('01', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2000() + { + $date = new DateTime('2001-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('21', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2100() + { + $date = new DateTime('2101-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('41', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2200() + { + $date = new DateTime('2201-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('61', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearBefore1900() + { + $date = new DateTime('1801-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('81', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselSex() + { + $male = $this->faker->pesel(null, 'M'); + $female = $this->faker->pesel(null, 'F'); + + $this->assertEquals(1, $male[9] % 2); + $this->assertEquals(0, $female[9] % 2); + } + + public function testPeselCheckSum() + { + $pesel = $this->faker->pesel(); + $weights = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1); + $sum = 0; + + foreach ($weights as $key => $weight) { + $sum += $pesel[$key] * $weight; + } + + $this->assertEquals(0, $sum % 10); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php new file mode 100644 index 0000000..b0feeca --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php @@ -0,0 +1,26 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testCnpjFormatIsValid() + { + $cnpj = $this->faker->cnpj(false); + $this->assertRegExp('/\d{8}\d{4}\d{2}/', $cnpj); + $cnpj = $this->faker->cnpj(true); + $this->assertRegExp('/\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}/', $cnpj); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php new file mode 100644 index 0000000..0b8318d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php @@ -0,0 +1,34 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testCpfFormatIsValid() + { + $cpf = $this->faker->cpf(false); + $this->assertRegExp('/\d{9}\d{2}/', $cpf); + $cpf = $this->faker->cpf(true); + $this->assertRegExp('/\d{3}\.\d{3}\.\d{3}-\d{2}/', $cpf); + } + + public function testRgFormatIsValid() + { + $rg = $this->faker->rg(false); + $this->assertRegExp('/\d{8}\d/', $rg); + $rg = $this->faker->rg(true); + $this->assertRegExp('/\d{2}\.\d{3}\.\d{3}-[0-9X]/', $rg); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php new file mode 100644 index 0000000..3783fd5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php @@ -0,0 +1,40 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testPostCodeIsValid() + { + $main = '[1-9]{1}[0-9]{2}[0,1,4,5,9]{1}'; + $pattern = "/^($main)|($main-[0-9]{3})+$/"; + $postcode = $this->faker->postcode(); + $this->assertSame(preg_match($pattern, $postcode), 1, $postcode); + } + + public function testAddressIsSingleLine() + { + $this->faker->addProvider(new Person($this->faker)); + + $address = $this->faker->address(); + $this->assertFalse(strstr($address, "\n")); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php new file mode 100644 index 0000000..662f12a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php @@ -0,0 +1,53 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testTaxpayerIdentificationNumberIsValid() + { + $tin = $this->faker->taxpayerIdentificationNumber(); + $this->assertTrue($this->isValidTin($tin), $tin); + } + + /** + * + * @link http://pt.wikipedia.org/wiki/N%C3%BAmero_de_identifica%C3%A7%C3%A3o_fiscal + * + * @param type $tin + * + * @return boolean + */ + public static function isValidTin($tin) + { + $regex = '(([1,2,3,5,6,8]{1}[0-9]{8})|((45)|(70)|(71)|(72)|(77)|(79)|(90|(98|(99))))[0-9]{7})'; + if (is_null($tin) || !is_numeric($tin) || !strlen($tin) == 9 || preg_match("/$regex/", $tin) !== 1) { + return false; + } + $n = str_split($tin); + // cd - Control Digit + $cd = ($n[0] * 9 + $n[1] * 8 + $n[2] * 7 + $n[3] * 6 + $n[4] * 5 + $n[5] * 4 + $n[6] * 3 + $n[7] * 2) % 11; + if ($cd === 0 || $cd === 1) { + $cd = 0; + } else { + $cd = 11 - $cd; + } + if ($cd === intval($n[8])) { + return true; + } + + return false; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php new file mode 100644 index 0000000..fd5d319 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php @@ -0,0 +1,26 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsPhoneNumberWithOrWithoutPrefix() + { + $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})|(2[0-9]{8})|(\+351 [2][0-9]{8})|(\+351 9[1,2,3,6][0-9]{7})/', $this->faker->phoneNumber()); + } + public function testMobileNumberReturnsMobileNumberWithOrWithoutPrefix() + { + $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php new file mode 100644 index 0000000..2c7fadc --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php @@ -0,0 +1,252 @@ +addProvider(new DateTime($faker)); + $faker->addProvider(new Person($faker)); + $faker->setDefaultTimezone('Europe/Bucharest'); + $this->faker = $faker; + } + + public function tearDown() + { + $this->faker->setDefaultTimezone(); + } + + public function invalidGenderProvider() + { + return array( + array('elf'), + array('ent'), + array('fmle'), + array('mal'), + ); + } + + public function invalidYearProvider() + { + return array( + array(1652), + array(1799), + array(2100), + array(2252), + ); + } + + public function validYearProvider() + { + return array( + array(null), + array(''), + array(1800), + array(1850), + array(1900), + array(1990), + array(2000), + array(2099), + ); + } + + public function validCountyCodeProvider() + { + return array( + array('AB'), array('AR'), array('AG'), array('B'), array('BC'), array('BH'), array('BN'), array('BT'), + array('BV'), array('BR'), array('BZ'), array('CS'), array('CL'), array('CJ'), array('CT'), array('CV'), + array('DB'), array('DJ'), array('GL'), array('GR'), array('GJ'), array('HR'), array('HD'), array('IL'), + array('IS'), array('IF'), array('MM'), array('MH'), array('MS'), array('NT'), array('OT'), array('PH'), + array('SM'), array('SJ'), array('SB'), array('SV'), array('TR'), array('TM'), array('TL'), array('VS'), + array('VL'), array('VN'), array('B1'), array('B2'), array('B3'), array('B4'), array('B5'), array('B6') + ); + } + + public function invalidCountyCodeProvider() + { + return array( + array('JK'), array('REW'), array('x'), array('FF'), array('aaaddadaada') + ); + } + + public function validInputDataProvider() + { + return array( + array(Person::GENDER_MALE, '1981-06-16','B2', true, '181061642'), + array(Person::GENDER_FEMALE, '1981-06-16','B2', true, '281061642'), + array(Person::GENDER_MALE, '1981-06-16','B2', false, '981061642'), + array(Person::GENDER_FEMALE, '1981-06-16','B2', false, '981061642'), + ); + } + /** + * + */ + public function test_allRandom_returnsValidCnp() + { + $cnp = $this->faker->cnp; + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated", $cnp) + ); + } + + /** + * + */ + public function test_validGender_returnsValidCnp() + { + $cnp = $this->faker->cnp(Person::GENDER_MALE); + $this->assertTrue( + $this->isValidMaleCnp($cnp), + sprintf("Invalid CNP '%' generated for '%s' gender", $cnp, Person::GENDER_MALE) + ); + + $cnp = $this->faker->cnp(Person::GENDER_FEMALE); + $this->assertTrue( + $this->isValidFemaleCnp($cnp), + sprintf("Invalid CNP '%' generated for '%s' gender", $cnp, Person::GENDER_FEMALE) + ); + } + + /** + * @param string $value + * + * @dataProvider invalidGenderProvider + */ + public function test_invalidGender_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp($value); + } + + /** + * @param string $value year of birth + * + * @dataProvider validYearProvider + */ + public function test_validYear_returnsValidCnp($value) + { + $cnp = $this->faker->cnp(null, $value); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for valid year '%s'", $cnp, $value) + ); + } + + /** + * @param string $value year of birth + * + * @dataProvider invalidYearProvider + */ + public function test_invalidYear_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp(null, $value); + } + + /** + * @param $value + * @dataProvider validCountyCodeProvider + */ + public function test_validCountyCode_returnsValidCnp($value) + { + $cnp = $this->faker->cnp(null, null, $value); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for valid year '%s'", $cnp, $value) + ); + } + + /** + * @param $value + * @dataProvider invalidCountyCodeProvider + */ + public function test_invalidCountyCode_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp(null, null, $value); + } + + /** + * + */ + public function test_nonResident_returnsValidCnp() + { + $cnp = $this->faker->cnp(null, null, null, false); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for non resident", $cnp) + ); + $this->assertStringStartsWith( + '9', + $cnp, + sprintf("Invalid CNP '%' generated for non resident (should start with 9)", $cnp) + ); + } + + /** + * + * @param $gender + * @param $dateOfBirth + * @param $county + * @param $isResident + * @param $expectedCnpStart + * + * @dataProvider validInputDataProvider + */ + public function test_validInputData_returnsValidCnp($gender, $dateOfBirth, $county, $isResident, $expectedCnpStart) + { + $cnp = $this->faker->cnp($gender, $dateOfBirth, $county, $isResident); + $this->assertStringStartsWith( + $expectedCnpStart, + $cnp, + sprintf("Invalid CNP '%' generated for non valid data", $cnp) + ); + } + + + protected function isValidFemaleCnp($value) + { + return $this->isValidCnp($value) && in_array($value[0], array(2, 4, 6, 8, 9)); + } + + protected function isValidMaleCnp($value) + { + return $this->isValidCnp($value) && in_array($value[0], array(1, 3, 5, 7, 9)); + } + + protected function isValidCnp($cnp) + { + if (preg_match(static::TEST_CNP_REGEX, $cnp) !== false) { + $checkNumber = 279146358279; + + $checksum = 0; + foreach (range(0, 11) as $digit) { + $checksum += (int)substr($cnp, $digit, 1) * (int)substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + $checksum = $checksum == 10 ? 1 : $checksum; + + if ($checksum == substr($cnp, -1)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php new file mode 100644 index 0000000..b7965cd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php @@ -0,0 +1,32 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsNormalPhoneNumber() + { + $this->assertRegExp('/^0(?:[23][13-7]|7\d)\d{7}$/', $this->faker->phoneNumber()); + } + + public function testTollFreePhoneNumberReturnsTollFreePhoneNumber() + { + $this->assertRegExp('/^08(?:0[01267]|70)\d{6}$/', $this->faker->tollFreePhoneNumber()); + } + + public function testPremiumRatePhoneNumberReturnsPremiumRatePhoneNumber() + { + $this->assertRegExp('/^090[036]\d{6}$/', $this->faker->premiumRatePhoneNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php new file mode 100644 index 0000000..8fbcf26 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php @@ -0,0 +1,37 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testINN() + { + $this->assertRegExp('/^[0-9]{10}$/', $this->faker->inn); + $this->assertEquals("77", substr($this->faker->inn("77"), 0, 2)); + $this->assertEquals("02", substr($this->faker->inn(2), 0, 2)); + } + + public function testKPP() + { + $this->assertRegExp('/^[0-9]{9}$/', $this->faker->kpp); + $this->assertEquals("01001", substr($this->faker->kpp, -5, 5)); + $inn = $this->faker->inn; + $this->assertEquals(substr($inn, 0, 4), substr($this->faker->kpp($inn), 0, 4)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php new file mode 100644 index 0000000..bbb0eae --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\ru_RU\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер ')) + ); + + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер—')) + ); + + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер,')) + ); + + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер! ')) + ); + + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер; ')) + ); + + $this->assertSame( + 'На другой день Чичиков отправился на обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('На другой день Чичиков отправился на обед и вечер: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php new file mode 100644 index 0000000..584998d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php @@ -0,0 +1,61 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function provideSeedAndExpectedReturn() + { + return array( + array(1, '720727', '720727-5798'), + array(2, '710414', '710414-5664'), + array(3, '591012', '591012-4519'), + array(4, '180307', '180307-0356'), + array(5, '820904', '820904-7748') + ); + } + + /** + * @dataProvider provideSeedAndExpectedReturn + */ + public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected) + { + $faker = $this->faker; + $faker->seed($seed); + $pin = $faker->personalIdentityNumber(\DateTime::createFromFormat('ymd', $birthdate)); + $this->assertEquals($expected, $pin); + } + + public function testPersonalIdentityNumberGeneratesLuhnCompliantNumbers() + { + $pin = str_replace('-', '', $this->faker->personalIdentityNumber()); + $this->assertTrue(Luhn::isValid($pin)); + } + + public function testPersonalIdentityNumberGeneratesOddValuesForMales() + { + $pin = $this->faker->personalIdentityNumber(null, 'male'); + $this->assertEquals(1, $pin{9} % 2); + } + + public function testPersonalIdentityNumberGeneratesEvenValuesForFemales() + { + $pin = $this->faker->personalIdentityNumber(null, 'female'); + $this->assertEquals(0, $pin{9} % 2); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php new file mode 100644 index 0000000..badf905 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php @@ -0,0 +1,28 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testCompany() + { + $company = $this->faker->companyField; + $this->assertNotNull($company); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php new file mode 100644 index 0000000..7c8ffdb --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php @@ -0,0 +1,29 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testBankAccountNumber() + { + $accNo = $this->faker->bankAccountNumber; + $this->assertEquals(substr($accNo, 0, 2), 'TR'); + $this->assertEquals(26, strlen($accNo)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php new file mode 100644 index 0000000..ad9db9c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php @@ -0,0 +1,34 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testTCNo() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->tcNo; + + $this->assertEquals(11, strlen($number)); + $this->assertTrue(TCNo::isValid($number)); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php new file mode 100644 index 0000000..0971d04 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php @@ -0,0 +1,34 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->phoneNumber; + $baseNumber = preg_replace('/ *x.*$/', '', $number); // Remove possible extension + $digits = array_values(array_filter(str_split($baseNumber), 'ctype_digit')); + + $this->assertGreaterThan(10, count($digits)); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php new file mode 100644 index 0000000..4c4a061 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php @@ -0,0 +1,81 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testPostCodeIsValid() + { + $main = '[0-9]{5}'; + $pattern = "/^($main)|($main-[0-9]{3})+$/"; + $postcode = $this->faker->postcode; + $this->assertRegExp($pattern, $postcode, 'Post code ' . $postcode . ' is wrong!'); + } + + public function testEmptySuffixes() + { + $this->assertEmpty($this->faker->citySuffix, 'City suffix should be empty!'); + $this->assertEmpty($this->faker->streetSuffix, 'Street suffix should be empty!'); + } + + public function testStreetCyrOnly() + { + $pattern = "/[0-9А-ЩЯІЇЄЮа-щяіїєюьIVXCM][0-9А-ЩЯІЇЄЮа-щяіїєюь \'-.]*[А-Яа-я.]/u"; + $streetName = $this->faker->streetName; + $this->assertSame( + preg_match($pattern, $streetName), + 1, + 'Street name ' . $streetName . ' is wrong!' + ); + } + + public function testCityNameCyrOnly() + { + $pattern = "/[А-ЩЯІЇЄЮа-щяіїєюь][0-9А-ЩЯІЇЄЮа-щяіїєюь \'-]*[А-Яа-я]/u"; + $city = $this->faker->city; + $this->assertSame( + preg_match($pattern, $city), + 1, + 'City name ' . $city . ' is wrong!' + ); + } + + public function testRegionNameCyrOnly() + { + $pattern = "/[А-ЩЯІЇЄЮ][А-ЩЯІЇЄЮа-щяіїєюь]*а$/u"; + $regionName = $this->faker->region; + $this->assertSame( + preg_match($pattern, $regionName), + 1, + 'Region name ' . $regionName . ' is wrong!' + ); + } + + public function testCountryCyrOnly() + { + $pattern = "/[А-ЩЯІЇЄЮа-щяіїєюьIVXCM][А-ЩЯІЇЄЮа-щяіїєюь \'-]*[А-Яа-я.]/u"; + $country = $this->faker->country; + $this->assertSame( + preg_match($pattern, $country), + 1, + 'Country name ' . $country . ' is wrong!' + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php new file mode 100644 index 0000000..a8d70f6 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php @@ -0,0 +1,57 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Максим', $faker->firstNameMale()); + } + + public function testFirstNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Людмила', $faker->firstNameFemale()); + } + + public function testMiddleNameMaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Миколайович', $faker->middleNameMale()); + } + + public function testMiddleNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Миколаївна', $faker->middleNameFemale()); + } + + public function testLastNameReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Броваренко', $faker->lastName()); + } + + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php new file mode 100644 index 0000000..f7f9f14 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $pattern = "/((\+38)(((\(\d{3}\))\d{7}|(\(\d{4}\))\d{6})|(\d{8})))|0\d{9}/"; + $phoneNumber = $this->faker->phoneNumber; + $this->assertSame( + preg_match($pattern, $phoneNumber), + 1, + 'Phone number format ' . $phoneNumber . ' is wrong!' + ); + + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php new file mode 100644 index 0000000..f2134b9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php @@ -0,0 +1,27 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testVAT() + { + $this->assertEquals(8, floor(log10($this->faker->VAT) + 1)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php new file mode 100644 index 0000000..167d0fa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php @@ -0,0 +1,45 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public function testPersonalIdentityNumber() + { + $id = $this->faker->personalIdentityNumber; + + $firstChar = substr($id, 0, 1); + $codesString = Person::$idBirthplaceCode[$firstChar] . substr($id, 1); + + // After transfer the first alphabet word into 2 digit number, there should be totally 11 numbers + $this->assertRegExp("/^[0-9]{11}$/", $codesString); + + $total = 0; + $codesArray = str_split($codesString); + foreach ($codesArray as $key => $code) { + $total += $code * Person::$idDigitValidator[$key]; + } + + // Validate + $this->assertEquals(0, ($total % 10)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php new file mode 100644 index 0000000..ab56f83 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php @@ -0,0 +1,79 @@ +textClass = new \ReflectionClass('Faker\Provider\zh_TW\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldExplodeTheStringToArray() + { + $this->assertSame( + array('中', '文', '測', '試', '真', '有', '趣'), + $this->getMethod('explode')->invokeArgs(null, array('中文測試真有趣')) + ); + + $this->assertSame( + array('標', '點', ',', '符', '號', '!'), + $this->getMethod('explode')->invokeArgs(null, array('標點,符號!')) + ); + } + + /** @test */ + function testItShouldReturnTheStringLength() + { + $this->assertContains( + $this->getMethod('strlen')->invokeArgs(null, array('中文測試真有趣')), + array(7, 21) + ); + } + + /** @test */ + function testItShouldReturnTheCharacterIsValidStartOrNot() + { + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('中'))); + + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('2'))); + + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('Hello'))); + + $this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('。'))); + + $this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('!'))); + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + '中文測試真有趣。', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣')) + ); + + $this->assertSame( + '中文測試真有趣。', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣,')) + ); + + $this->assertSame( + '中文測試真有趣!', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣!')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/documentor.php b/vendor/fzaninotto/faker/test/documentor.php new file mode 100644 index 0000000..1051ea2 --- /dev/null +++ b/vendor/fzaninotto/faker/test/documentor.php @@ -0,0 +1,16 @@ +seed(1); +$documentor = new Faker\Documentor($generator); +?> +getFormatters() as $provider => $formatters): ?> + +### `` + + $example): ?> + // + + +seed(5); + +echo ''; +?> + + + + +boolean(25)): ?> + + +
+ streetAddress ?> + city ?> + postcode ?> + state ?> +
+ +boolean(33)): ?> + bs ?> + +boolean(33)): ?> + + + +boolean(15)): ?> +
+text(400) ?> +]]> +
+ +
+ +
diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md new file mode 100644 index 0000000..8a3743d --- /dev/null +++ b/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -0,0 +1,246 @@ +# Change Log + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + + +## [1.6.0] + +### Added + +- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244) +- Added MIME type for WEBP image format (#246) +- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272) + +### Changed + +- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262) +- Accept port number 0 to be valid (#270) + +### Fixed + +- Fixed subsequent reads from `php://input` in ServerRequest (#247) +- Fixed readable/writable detection for certain stream modes (#248) +- Fixed encoding of special characters in the `userInfo` component of an URI (#253) + + +## [1.5.2] - 2018-12-04 + +### Fixed + +- Check body size when getting the message summary + + +## [1.5.1] - 2018-12-04 + +### Fixed + +- Get the summary of a body only if it is readable + + +## [1.5.0] - 2018-12-03 + +### Added + +- Response first-line to response string exception (fixes #145) +- A test for #129 behavior +- `get_message_body_summary` function in order to get the message summary +- `3gp` and `mkv` mime types + +### Changed + +- Clarify exception message when stream is detached + +### Deprecated + +- Deprecated parsing folded header lines as per RFC 7230 + +### Fixed + +- Fix `AppendStream::detach` to not close streams +- `InflateStream` preserves `isSeekable` attribute of the underlying stream +- `ServerRequest::getUriFromGlobals` to support URLs in query parameters + + +Several other fixes and improvements. + + +## [1.4.2] - 2017-03-20 + +### Fixed + +- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing + calls to `trigger_error` when deprecated methods are invoked. + + +## [1.4.1] - 2017-02-27 + +### Added + +- Rriggering of silenced deprecation warnings. + +### Fixed + +- Reverted BC break by reintroducing behavior to automagically fix a URI with a + relative path and an authority by adding a leading slash to the path. It's only + deprecated now. + + +## [1.4.0] - 2017-02-21 + +### Added + +- Added common URI utility methods based on RFC 3986 (see documentation in the readme): + - `Uri::isDefaultPort` + - `Uri::isAbsolute` + - `Uri::isNetworkPathReference` + - `Uri::isAbsolutePathReference` + - `Uri::isRelativePathReference` + - `Uri::isSameDocumentReference` + - `Uri::composeComponents` + - `UriNormalizer::normalize` + - `UriNormalizer::isEquivalent` + - `UriResolver::relativize` + +### Changed + +- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. +- Allow `parse_response` to parse a response without delimiting space and reason. +- Ensure each URI modification results in a valid URI according to PSR-7 discussions. + Invalid modifications will throw an exception instead of returning a wrong URI or + doing some magic. + - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE new file mode 100644 index 0000000..581d95f --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md new file mode 100644 index 0000000..c60a6a3 --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,745 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + + +[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) + + +# Stream implementation + +This package comes with a number of stream implementations and stream +decorators. + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\stream_for('abc, '); +$b = Psr7\stream_for('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\stream_for(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\stream_for(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\stream_for('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. + +This stream decorator skips the first 10 bytes of the given stream to remove +the gzip header, converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + call_user_func($this->callback); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\stream_for('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Function API + +There are various functions available under the `GuzzleHttp\Psr7` namespace. + + +## `function str` + +`function str(MessageInterface $message)` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\str($request); +``` + + +## `function uri_for` + +`function uri_for($uri)` + +This function accepts a string or `Psr\Http\Message\UriInterface` and returns a +UriInterface for the given value. If the value is already a `UriInterface`, it +is returned as-is. + +```php +$uri = GuzzleHttp\Psr7\uri_for('http://example.com'); +assert($uri === GuzzleHttp\Psr7\uri_for($uri)); +``` + + +## `function stream_for` + +`function stream_for($resource = '', array $options = [])` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +* - metadata: Array of custom metadata. +* - size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\stream_for('foo'); +$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\stream_for($generator(100)); +``` + + +## `function parse_header` + +`function parse_header($header)` + +Parse an array of header values containing ";" separated data into an array of +associative arrays representing the header key value pair data of the header. +When a parameter does not contain a value, but just contains a key, this +function will inject a key with a '' string value. + + +## `function normalize_header` + +`function normalize_header($header)` + +Converts an array of header values that may contain comma separated headers +into an array of headers with no comma separated values. + + +## `function modify_request` + +`function modify_request(RequestInterface $request, array $changes)` + +Clone and modify a request with the given changes. This method is useful for +reducing the number of clones needed to mutate a message. + +The changes can be one of: + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `function rewind_body` + +`function rewind_body(MessageInterface $message)` + +Attempts to rewind a message body and throws an exception on failure. The body +of the message will only be rewound if a call to `tell()` returns a value other +than `0`. + + +## `function try_fopen` + +`function try_fopen($filename, $mode)` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an error +handler that checks for errors and throws an exception instead. + + +## `function copy_to_string` + +`function copy_to_string(StreamInterface $stream, $maxLen = -1)` + +Copy the contents of a stream into a string until the given number of bytes +have been read. + + +## `function copy_to_stream` + +`function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)` + +Copy the contents of a stream into another stream until the given number of +bytes have been read. + + +## `function hash` + +`function hash(StreamInterface $stream, $algo, $rawOutput = false)` + +Calculate a hash of a Stream. This method reads the entire stream to calculate +a rolling hash (based on PHP's hash_init functions). + + +## `function readline` + +`function readline(StreamInterface $stream, $maxLength = null)` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `function parse_request` + +`function parse_request($message)` + +Parses a request message string into a request object. + + +## `function parse_response` + +`function parse_response($message)` + +Parses a response message string into a response object. + + +## `function parse_query` + +`function parse_query($str, $urlEncoding = true)` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key value pair +will become an array. This function does not parse nested PHP style arrays into +an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into +`['foo[a]' => '1', 'foo[b]' => '2']`). + + +## `function build_query` + +`function build_query(array $params, $encoding = PHP_QUERY_RFC3986)` + +Build a query string from an array of key value pairs. + +This function can use the return value of parse_query() to build a query string. +This function does not modify the provided keys when an array is encountered +(like http_build_query would). + + +## `function mimetype_from_filename` + +`function mimetype_from_filename($filename)` + +Determines the mimetype of a file by looking at its extension. + + +## `function mimetype_from_extension` + +`function mimetype_from_extension($extension)` + +Maps a file extensions to a mimetype. + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called +manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers +do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 0000000..168a055 --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,49 @@ +{ + "name": "guzzlehttp/psr7", + "type": "library", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8", + "ext-zlib": "*" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000..472a0d6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,241 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + * + * {@inheritdoc} + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind() + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + . $i . ' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + $this->current++; + } + + $result = $this->streams[$this->current]->read($remaining); + + // Using a loose comparison here to match on '', false, and null + if ($result == null) { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000..af4d4c2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,137 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + // TODO: What should happen here? + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000..ed68f08 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,138 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence == SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } + + private function cacheEntireStream() + { + $target = new FnStream(['write' => 'strlen']); + copy_to_stream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..8935c80 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php new file mode 100644 index 0000000..73daea6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -0,0 +1,158 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * @throws \LogicException + */ + public function __wakeup() + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind() + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET) + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000..5e4f602 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,52 @@ +read(10); + $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); + // Skip the header, that is 10 + length of filename + 1 (nil) bytes + $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); + $resource = StreamWrapper::getResource($stream); + stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } + + /** + * @param StreamInterface $stream + * @param $header + * @return int + */ + private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) + { + $filename_header_length = 0; + + if (substr(bin2hex($header), 6, 2) === '08') { + // we have a filename, read until nil + $filename_header_length = 1; + while ($stream->read(1) !== chr(0)) { + $filename_header_length++; + } + } + + return $filename_header_length; + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000..02cec3a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,39 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return stream_for(try_fopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000..e4f239e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,155 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset %s with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit($limit) + { + $this->limit = $limit; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000..a7966d1 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,213 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header) + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (is_int($header)) { + // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec + // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. + $header = (string) $header; + } + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + private function normalizeHeaderValue($value) + { + if (!is_array($value)) { + return $this->trimHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimHeaderValues($value); + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return trim((string) $value, " \t"); + }, $values); + } + + private function assertHeader($header) + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if ($header === '') { + throw new \InvalidArgumentException('Header name can not be empty.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000..c0fd584 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,153 @@ +boundary = $boundary ?: sha1(uniqid('', true)); + $this->stream = $this->createStream($elements); + } + + /** + * Get the boundary + * + * @return string + */ + public function getBoundary() + { + return $this->boundary; + } + + public function isWritable() + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + */ + private function getHeaders(array $headers) + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements) + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(stream_for("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element) + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = stream_for($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if (substr($uri, 0, 6) !== 'php://') { + $element['filename'] = $uri; + } + } + + list($body, $headers) = $this->createElement( + $element['name'], + $element['contents'], + isset($element['filename']) ? $element['filename'] : null, + isset($element['headers']) ? $element['headers'] : [] + ); + + $stream->addStream(stream_for($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(stream_for("\r\n")); + } + + /** + * @return array + */ + private function createElement($name, StreamInterface $stream, $filename, array $headers) + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf('form-data; name="%s"; filename="%s"', + $name, + basename($filename)) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = mimetype_from_filename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000..2332218 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,22 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + try { + return copy_to_string($this); + } catch (\Exception $e) { + return ''; + } + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000..59f337d --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,151 @@ +assertMethod($method); + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + } + + public function getRequestTarget() + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target == '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget) + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + public function getMethod() + { + return $this->method; + } + + public function withMethod($method) + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri() + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false) + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri() + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + private function assertMethod($method) + { + if (!is_string($method) || $method === '') { + throw new \InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000..e7e04d8 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,154 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase = ''; + + /** @var int */ + private $statusCode = 200; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|null|resource|StreamInterface $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + $status = 200, + array $headers = [], + $body = null, + $version = '1.1', + $reason = null + ) { + $this->assertStatusCodeIsInteger($status); + $status = (int) $status; + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::$phrases[$this->statusCode])) { + $this->reasonPhrase = self::$phrases[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = '') + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { + $reasonPhrase = self::$phrases[$new->statusCode]; + } + $new->reasonPhrase = $reasonPhrase; + return $new; + } + + private function assertStatusCodeIsInteger($statusCode) + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange($statusCode) + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000..505e474 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,18 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000..1a09a6c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,376 @@ +serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files A array which respect $_FILES structure + * @throws InvalidArgumentException for unrecognized values + * @return array + */ + public static function normalizeFiles(array $files) + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * @return array|UploadedFileInterface + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @param array $files + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []) + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key], + 'error' => $files['error'][$key], + 'name' => $files['name'][$key], + 'type' => $files['type'][$key], + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + * + * @return ServerRequestInterface + */ + public static function fromGlobals() + { + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority($authority) + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = isset($parts['host']) ? $parts['host'] : null; + $port = isset($parts['port']) ? $parts['port'] : null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + * + * @return UriInterface + */ + public static function getUriFromGlobals() + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + + /** + * {@inheritdoc} + */ + public function getServerParams() + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles() + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + */ + public function withUploadedFiles(array $uploadedFiles) + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams() + { + return $this->cookieParams; + } + + /** + * {@inheritdoc} + */ + public function withCookieParams(array $cookies) + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams() + { + return $this->queryParams; + } + + /** + * {@inheritdoc} + */ + public function withQueryParams(array $query) + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + */ + public function withParsedBody($data) + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + /** + * {@inheritdoc} + */ + public function withAttribute($attribute, $value) + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutAttribute($attribute) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000..d9e7409 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,267 @@ +size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + try { + $this->seek(0); + return (string) stream_get_contents($this->stream); + } catch (\Exception $e) { + return ''; + } + } + + public function getContents() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $contents = stream_get_contents($this->stream); + + if ($contents === false) { + throw new \RuntimeException('Unable to read stream contents'); + } + + return $contents; + } + + public function close() + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $whence = (int) $whence; + + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + . $offset . ' with whence ' . var_export($whence, true)); + } + } + + public function read($length) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + $string = fread($this->stream, $length); + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000..daec6f5 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,149 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @param string $name Name of the property (allows "stream" only). + * + * @return StreamInterface + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array([$this->stream, $method], $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000..0f3a285 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,161 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @param StreamInterface $stream + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream] + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + $this->stream->seek($offset, $whence); + + return true; + } + + public function stream_cast($cast_as) + { + $stream = clone($this->stream); + + return $stream->detach(); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } + + public function url_stat($path, $flags) + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000..968b725 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,325 @@ +setError($errorStatus); + $this->setSize($size); + $this->setClientFilename($clientFilename); + $this->setClientMediaType($clientMediaType); + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param mixed $streamOrFile + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile) + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @param int $error + * @throws InvalidArgumentException + */ + private function setError($error) + { + if (false === is_int($error)) { + throw new InvalidArgumentException( + 'Upload file error status must be an integer' + ); + } + + if (false === in_array($error, UploadedFile::$errors)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + /** + * @param int $size + * @throws InvalidArgumentException + */ + private function setSize($size) + { + if (false === is_int($size)) { + throw new InvalidArgumentException( + 'Upload file size must be an integer' + ); + } + + $this->size = $size; + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringOrNull($param) + { + return in_array(gettype($param), ['string', 'NULL']); + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringNotEmpty($param) + { + return is_string($param) && false === empty($param); + } + + /** + * @param string|null $clientFilename + * @throws InvalidArgumentException + */ + private function setClientFilename($clientFilename) + { + if (false === $this->isStringOrNull($clientFilename)) { + throw new InvalidArgumentException( + 'Upload file client filename must be a string or null' + ); + } + + $this->clientFilename = $clientFilename; + } + + /** + * @param string|null $clientMediaType + * @throws InvalidArgumentException + */ + private function setClientMediaType($clientMediaType) + { + if (false === $this->isStringOrNull($clientMediaType)) { + throw new InvalidArgumentException( + 'Upload file client media type must be a string or null' + ); + } + + $this->clientMediaType = $clientMediaType; + } + + /** + * Return true if there is no upload error + * + * @return boolean + */ + private function isOk() + { + return $this->error === UPLOAD_ERR_OK; + } + + /** + * @return boolean + */ + public function isMoved() + { + //return false; + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive() + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + /** + * {@inheritdoc} + * @throws RuntimeException if the upload was not successful. + */ + public function getStream() + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + return new LazyOpenStream($this->file, 'r+'); + } + + /** + * {@inheritdoc} + * + * @see http://php.net/is_uploaded_file + * @see http://php.net/move_uploaded_file + * @param string $targetPath Path to which to move the uploaded file. + * @throws RuntimeException if the upload was not successful. + * @throws InvalidArgumentException if the $path specified is invalid. + * @throws RuntimeException on any error during the move operation, or on + * the second or subsequent call to the method. + */ + public function moveTo($targetPath) + { + $this->validateActive(); + + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + echo "if this file"; + die(); + $this->moved = php_sapi_name() == 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + echo "copy_to_stream"; + die(); + copy_to_stream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + //$targetPath = 'public/uploads/products/crepe1.jpg'; + //echo "targetPath = "; + //echo $targetPath; + //die(); + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + /** + * {@inheritdoc} + * + * @return int|null The file size in bytes or null if unknown. + */ + public function getSize() + { + return $this->size; + } + + /** + * {@inheritdoc} + * + * @see http://php.net/manual/en/features.file-upload.errors.php + * @return int One of PHP's UPLOAD_ERR_XXX constants. + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + * + * @return string|null The filename sent by the client or null if none + * was provided. + */ + public function getClientFilename() + { + return $this->clientFilename; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType() + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000..825a25e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,760 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; + private static $charSubDelims = '!\$&\'\(\)\*\+,;='; + private static $replaceQuery = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** + * @param string $uri URI to parse + */ + public function __construct($uri = '') + { + // weak type check to also accept null until we can add scalar type hints + if ($uri != '') { + $parts = parse_url($uri); + if ($parts === false) { + throw new \InvalidArgumentException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + public function __toString() + { + return self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @param string $scheme + * @param string $authority + * @param string $path + * @param string $query + * @param string $fragment + * + * @return string + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents($scheme, $authority, $path, $query, $fragment) + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + + if ($authority != ''|| $scheme === 'file') { + $uri .= '//' . $authority; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?' . $query; + } + + if ($fragment != '') { + $uri .= '#' . $fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + * + * @param UriInterface $uri + * + * @return bool + */ + public static function isDefaultPort(UriInterface $uri) + { + return $uri->getPort() === null + || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @param UriInterface $uri + * + * @return bool + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Removes dot segments from a path and returns the new path. + * + * @param string $path + * + * @return string + * + * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. + * @see UriResolver::removeDotSegments + */ + public static function removeDotSegments($path) + { + return UriResolver::removeDotSegments($path); + } + + /** + * Converts the relative URI into a new URI that is resolved against the base URI. + * + * @param UriInterface $base Base URI + * @param string|UriInterface $rel Relative URI + * + * @return UriInterface + * + * @deprecated since version 1.4. Use UriResolver::resolve instead. + * @see UriResolver::resolve + */ + public static function resolve(UriInterface $base, $rel) + { + if (!($rel instanceof UriInterface)) { + $rel = new self($rel); + } + + return UriResolver::resolve($base, $rel); + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + * + * @return UriInterface + */ + public static function withoutQueryValue(UriInterface $uri, $key) + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + * + * @return UriInterface + */ + public static function withQueryValue(UriInterface $uri, $key, $value) + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + * + * @return UriInterface + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString($key, $value); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @param array $parts + * + * @return UriInterface + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws \InvalidArgumentException If the components do not form a valid URI. + */ + public static function fromParts(array $parts) + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme() + { + return $this->scheme; + } + + public function getAuthority() + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo() + { + return $this->userInfo; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + + public function getPath() + { + return $this->path; + } + + public function getQuery() + { + return $this->query; + } + + public function getFragment() + { + return $this->fragment; + } + + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null) + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->validateState(); + + return $new; + } + + public function withHost($host) + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->validateState(); + + return $new; + } + + public function withPort($port) + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path) + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->validateState(); + + return $new; + } + + public function withQuery($query) + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + public function withFragment($fragment) + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts) + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + } + + $this->removeDefaultPort(); + } + + /** + * @param string $scheme + * + * @return string + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme) + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return strtolower($scheme); + } + + /** + * @param string $component + * + * @return string + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component) + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param string $host + * + * @return string + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host) + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return strtolower($host); + } + + /** + * @param int|null $port + * + * @return int|null + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port) + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (0 > $port || 0xffff < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param UriInterface $uri + * @param array $keys + * + * @return array + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + /** + * @param string $key + * @param string|null $value + * + * @return string + */ + private static function generateQueryString($key, $value) + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::$replaceQuery); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::$replaceQuery); + } + + return $queryString; + } + + private function removeDefaultPort() + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param string $path + * + * @return string + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path) + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param string $str + * + * @return string + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str) + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match) + { + return rawurlencode($match[0]); + } + + private function validateState() + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && $this->path[0] !== '/') { + @trigger_error( + 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . + 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', + E_USER_DEPRECATED + ); + $this->path = '/'. $this->path; + //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000..384c29e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,216 @@ +getPath() === '' && + ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri) + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match) { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri) + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000..c1cb8a2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,219 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + * + * @param UriInterface $base Base URI + * @param UriInterface $target Target URI + * + * @return UriInterface The relative URI reference + */ + public static function relativize(UriInterface $base, UriInterface $target) + { + if ($target->getScheme() !== '' && + ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target) + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php new file mode 100644 index 0000000..8e6dafe --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -0,0 +1,899 @@ +getMethod() . ' ' + . $message->getRequestTarget()) + . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' + . $message->getStatusCode() . ' ' + . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + + return "{$msg}\r\n\r\n" . $message->getBody(); +} + +/** + * Returns a UriInterface for the given value. + * + * This function accepts a string or {@see Psr\Http\Message\UriInterface} and + * returns a UriInterface for the given value. If the value is already a + * `UriInterface`, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @return UriInterface + * @throws \InvalidArgumentException + */ +function uri_for($uri) +{ + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); +} + +/** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param array $options Additional options + * + * @return StreamInterface + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ +function stream_for($resource = '', array $options = []) +{ + if (is_scalar($resource)) { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + return new Stream($resource, $options); + case 'object': + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return stream_for((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(fopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); +} + +/** + * Parse an array of header values containing ";" separated data into an + * array of associative arrays representing the header key value pair + * data of the header. When a parameter does not contain a value, but just + * contains a key, this function will inject a key with a '' string value. + * + * @param string|array $header Header to parse into components. + * + * @return array Returns the parsed header values. + */ +function parse_header($header) +{ + static $trimmed = "\"' \n\t\r"; + $params = $matches = []; + + foreach (normalize_header($header) as $val) { + $part = []; + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + + return $params; +} + +/** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @return array Returns the normalized header field values. + */ +function normalize_header($header) +{ + if (!is_array($header)) { + return array_map('trim', explode(',', $header)); + } + + $result = []; + foreach ($header as $value) { + foreach ((array) $value as $v) { + if (strpos($v, ',') === false) { + $result[] = $v; + continue; + } + foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { + $result[] = trim($vv); + } + } + } + + return $result; +} + +/** + * Clone and modify a request with the given changes. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + * + * @return RequestInterface + */ +function modify_request(RequestInterface $request, array $changes) +{ + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = _caseless_remove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + return (new ServerRequest( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + } + + return new Request( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion() + ); +} + +/** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` returns a + * value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ +function rewind_body(MessageInterface $message) +{ + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } +} + +/** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * @throws \RuntimeException if the file cannot be opened + */ +function try_fopen($filename, $mode) +{ + $ex = null; + set_error_handler(function () use ($filename, $mode, &$ex) { + $ex = new \RuntimeException(sprintf( + 'Unable to open %s using mode %s: %s', + $filename, + $mode, + func_get_args()[1] + )); + }); + + $handle = fopen($filename, $mode); + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; +} + +/** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * @return string + * @throws \RuntimeException on error. + */ +function copy_to_string(StreamInterface $stream, $maxLen = -1) +{ + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; +} + +/** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ +function copy_to_stream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 +) { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } +} + +/** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws \RuntimeException on error. + */ +function hash( + StreamInterface $stream, + $algo, + $rawOutput = false +) { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; +} + +/** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * + * @return string + */ +function readline(StreamInterface $stream, $maxLength = null) +{ + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + // Using a loose equality here to match on '' and false. + if (null == ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; +} + +/** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + * + * @return Request + */ +function parse_request($message) +{ + $data = _parse_message($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); +} + +/** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + * + * @return Response + */ +function parse_response($message) +{ + $data = _parse_message($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + isset($parts[2]) ? $parts[2] : null + ); +} + +/** + * Parse a query string into an associative array. + * + * If multiple values are found for the same key, the value of that key + * value pair will become an array. This function does not parse nested + * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will + * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + * + * @return array + */ +function parse_query($str, $urlEncoding = true) +{ + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { return $str; }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!isset($result[$key])) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; +} + +/** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of parse_query() to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like http_build_query would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + * @return string + */ +function build_query(array $params, $encoding = PHP_QUERY_RFC3986) +{ + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function ($str) { return $str; }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder($k); + if (!is_array($v)) { + $qs .= $k; + if ($v !== null) { + $qs .= '=' . $encoder($v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + if ($vv !== null) { + $qs .= '=' . $encoder($vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; +} + +/** + * Determines the mimetype of a file by looking at its extension. + * + * @param $filename + * + * @return null|string + */ +function mimetype_from_filename($filename) +{ + return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); +} + +/** + * Maps a file extensions to a mimetype. + * + * @param $extension string The file extension. + * + * @return string|null + * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types + */ +function mimetype_from_extension($extension) +{ + static $mimetypes = [ + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aac' => 'audio/x-aac', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'asc' => 'text/plain', + 'asf' => 'video/x-ms-asf', + 'atom' => 'application/atom+xml', + 'avi' => 'video/x-msvideo', + 'bmp' => 'image/bmp', + 'bz2' => 'application/x-bzip2', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'deb' => 'application/x-debian-package', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dvi' => 'application/x-dvi', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'etx' => 'text/x-setext', + 'flac' => 'audio/flac', + 'flv' => 'video/x-flv', + 'gif' => 'image/gif', + 'gz' => 'application/gzip', + 'htm' => 'text/html', + 'html' => 'text/html', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ini' => 'text/plain', + 'iso' => 'application/x-iso9660-image', + 'jar' => 'application/java-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'text/javascript', + 'json' => 'application/json', + 'latex' => 'application/x-latex', + 'log' => 'text/plain', + 'm4a' => 'audio/mp4', + 'm4v' => 'video/mp4', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mov' => 'video/quicktime', + 'mkv' => 'video/x-matroska', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4v' => 'video/mp4', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'pbm' => 'image/x-portable-bitmap', + 'pdf' => 'application/pdf', + 'pgm' => 'image/x-portable-graymap', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'ppm' => 'image/x-portable-pixmap', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'ps' => 'application/postscript', + 'qt' => 'video/quicktime', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'svg' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 'tar' => 'application/x-tar', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'torrent' => 'application/x-bittorrent', + 'ttf' => 'application/x-font-ttf', + 'txt' => 'text/plain', + 'wav' => 'audio/x-wav', + 'webm' => 'video/webm', + 'webp' => 'image/webp', + 'wma' => 'audio/x-ms-wma', + 'wmv' => 'video/x-ms-wmv', + 'woff' => 'application/x-font-woff', + 'wsdl' => 'application/wsdl+xml', + 'xbm' => 'image/x-xbitmap', + 'xls' => 'application/vnd.ms-excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'yaml' => 'text/yaml', + 'yml' => 'text/yaml', + 'zip' => 'application/zip', + ]; + + $extension = strtolower($extension); + + return isset($mimetypes[$extension]) + ? $mimetypes[$extension] + : null; +} + +/** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + * + * @return array + * @internal + */ +function _parse_message($message) +{ + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + list($rawHeaders, $body) = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + list($startLine, $rawHeaders) = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; +} + +/** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + * + * @return string + * @internal + */ +function _parse_request_uri($path, array $headers) +{ + $hostKey = array_filter(array_keys($headers), function ($k) { + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); +} + +/** + * Get a short summary of the message body + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + * + * @return null|string + */ +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) +{ + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; +} + +/** @internal */ +function _caseless_remove($keys, array $data) +{ + $result = []; + + foreach ($keys as &$key) { + $key = strtolower($key); + } + + foreach ($data as $k => $v) { + if (!in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; +} diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php new file mode 100644 index 0000000..96a4a83 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions_include.php @@ -0,0 +1,6 @@ +=5.3.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Interop\\Http\\Factory\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/http-interop/http-factory/src/RequestFactoryInterface.php b/vendor/http-interop/http-factory/src/RequestFactoryInterface.php new file mode 100644 index 0000000..802b489 --- /dev/null +++ b/vendor/http-interop/http-factory/src/RequestFactoryInterface.php @@ -0,0 +1,19 @@ + + +### 6.2 Sponsors + +* Paul M Jones, (Coordinator) +* Jason Coward, (Sponsor) + +### 6.3 Contributors + +* Rasmus Schultz, +* Matthew Weier O'Phinney, + +7. Votes +-------- + +* [Entrance Vote](https://groups.google.com/d/msg/php-fig/v9AijALWJhI/04XCwqgIEAAJ) +* **Acceptance Vote:** _(not yet taken)_ + +8. Relevant Links +----------------- + +_**Note:** Order descending chronologically._ + +* [PHP-FIG mailing list thread](https://groups.google.com/d/msg/php-fig/vTtGxdIuBX8/NXKieN9vDQAJ) +* [The PHP League middleware proposal](https://groups.google.com/d/msg/thephpleague/jyztj-Nz_rw/I4lHVFigAAAJ) +* [PHP-FIG discussion of FrameInterface](https://groups.google.com/d/msg/php-fig/V12AAcT_SxE/aRXmNnIVCwAJ) +* [PHP-FIG discussion about client vs server side middleware](https://groups.google.com/d/msg/php-fig/vBk0BRgDe2s/GTaT0yKNBgAJ) + +9. Errata +--------- + +... diff --git a/vendor/http-interop/http-middleware/composer.json b/vendor/http-interop/http-middleware/composer.json new file mode 100644 index 0000000..35c6ab5 --- /dev/null +++ b/vendor/http-interop/http-middleware/composer.json @@ -0,0 +1,35 @@ +{ + "name": "http-interop/http-middleware", + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "psr", + "psr-7", + "psr-17", + "http", + "factory", + "middleware", + "request", + "response" + ], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Interop\\Http\\ServerMiddleware\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/http-interop/http-middleware/src/DelegateInterface.php b/vendor/http-interop/http-middleware/src/DelegateInterface.php new file mode 100644 index 0000000..6f3b4ae --- /dev/null +++ b/vendor/http-interop/http-middleware/src/DelegateInterface.php @@ -0,0 +1,18 @@ +createResponse(404); + +// Send headers and body. +send($notFound); +``` + +## License + +MIT diff --git a/vendor/http-interop/response-sender/composer.json b/vendor/http-interop/response-sender/composer.json new file mode 100644 index 0000000..9f45d09 --- /dev/null +++ b/vendor/http-interop/response-sender/composer.json @@ -0,0 +1,26 @@ +{ + "name": "http-interop/response-sender", + "description": "A function to convert PSR-7 Response to HTTP output", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" + } + ], + "minimum-stability": "stable", + "require": { + "psr/http-message": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.6", + "guzzlehttp/psr7": "^1.4", + "php-mock/php-mock-phpunit": "^1.1" + }, + "autoload": { + "files": [ + "src/functions.php" + ] + } +} diff --git a/vendor/http-interop/response-sender/phpunit.xml.dist b/vendor/http-interop/response-sender/phpunit.xml.dist new file mode 100644 index 0000000..35b3b80 --- /dev/null +++ b/vendor/http-interop/response-sender/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + ./tests + + + + + ./src + + + + + + + + diff --git a/vendor/http-interop/response-sender/src/functions.php b/vendor/http-interop/response-sender/src/functions.php new file mode 100644 index 0000000..a15f635 --- /dev/null +++ b/vendor/http-interop/response-sender/src/functions.php @@ -0,0 +1,38 @@ +getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + header($http_line, true, $response->getStatusCode()); + + foreach ($response->getHeaders() as $name => $values) { + foreach ($values as $value) { + header("$name: $value", false); + } + } + + $stream = $response->getBody(); + + if ($stream->isSeekable()) { + $stream->rewind(); + } + + while (!$stream->eof()) { + echo $stream->read(1024 * 8); + } +} + diff --git a/vendor/http-interop/response-sender/tests/SendTest.php b/vendor/http-interop/response-sender/tests/SendTest.php new file mode 100644 index 0000000..edea080 --- /dev/null +++ b/vendor/http-interop/response-sender/tests/SendTest.php @@ -0,0 +1,52 @@ + 'text/plain', + ], + $body = uniqid(true), + $version = '1.1' + ); + + $sent_headers = []; + $header = $this->getFunctionMock(__NAMESPACE__, 'header'); + $header->expects($this->any())->will($this->returnCallback( + function ($header, $replace) use (&$sent_headers) { + return $sent_headers[] = $header; + } + )); + + $output = $this->captureSend($response); + + $this->assertSame([ + "HTTP/$version $status OK", + "Content-Type: text/plain", + ], $sent_headers); + + $this->assertSame($body, $output); + } + + private function mockHeaderCalls() + { + } + + private function captureSend(Response $response) + { + ob_start(); + send($response); + return ob_get_clean(); + } +} diff --git a/vendor/intervention/image/LICENSE b/vendor/intervention/image/LICENSE new file mode 100644 index 0000000..bc444ba --- /dev/null +++ b/vendor/intervention/image/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2014 Oliver Vogel + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/intervention/image/composer.json b/vendor/intervention/image/composer.json new file mode 100644 index 0000000..136d7b2 --- /dev/null +++ b/vendor/intervention/image/composer.json @@ -0,0 +1,47 @@ +{ + "name": "intervention/image", + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": ["image", "gd", "imagick", "laravel", "watermark", "thumbnail"], + "license": "MIT", + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "require": { + "php": ">=5.4.0", + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.7", + "mockery/mockery": "~0.9.2" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "minimum-stability": "stable" +} diff --git a/vendor/intervention/image/provides.json b/vendor/intervention/image/provides.json new file mode 100644 index 0000000..a8cd1b6 --- /dev/null +++ b/vendor/intervention/image/provides.json @@ -0,0 +1,11 @@ +{ + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": [ + { + "alias": "Image", + "facade": "Intervention\\Image\\Facades\\Image" + } + ] +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractColor.php b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php new file mode 100644 index 0000000..5927920 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php @@ -0,0 +1,226 @@ +parse($value); + } + + /** + * Parses given value as color + * + * @param mixed $value + * @return \Intervention\Image\AbstractColor + */ + public function parse($value) + { + switch (true) { + + case is_string($value): + $this->initFromString($value); + break; + + case is_int($value): + $this->initFromInteger($value); + break; + + case is_array($value): + $this->initFromArray($value); + break; + + case is_object($value): + $this->initFromObject($value); + break; + + case is_null($value): + $this->initFromArray(array(255, 255, 255, 0)); + break; + + default: + throw new \Intervention\Image\Exception\NotReadableException( + "Color format ({$value}) cannot be read." + ); + } + + return $this; + } + + /** + * Formats current color instance into given format + * + * @param string $type + * @return mixed + */ + public function format($type) + { + switch (strtolower($type)) { + + case 'rgba': + return $this->getRgba(); + + case 'hex': + return $this->getHex('#'); + + case 'int': + case 'integer': + return $this->getInt(); + + case 'array': + return $this->getArray(); + + case 'obj': + case 'object': + return $this; + + default: + throw new \Intervention\Image\Exception\NotSupportedException( + "Color format ({$type}) is not supported." + ); + } + } + + /** + * Reads RGBA values from string into array + * + * @param string $value + * @return array + */ + protected function rgbaFromString($value) + { + $result = false; + + // parse color string in hexidecimal format like #cccccc or cccccc or ccc + $hexPattern = '/^#?([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i'; + + // parse color string in format rgb(140, 140, 140) + $rgbPattern = '/^rgb ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3})\)$/i'; + + // parse color string in format rgba(255, 0, 0, 0.5) + $rgbaPattern = '/^rgba ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9.]{1,4})\)$/i'; + + if (preg_match($hexPattern, $value, $matches)) { + $result = array(); + $result[0] = strlen($matches[1]) == '1' ? hexdec($matches[1].$matches[1]) : hexdec($matches[1]); + $result[1] = strlen($matches[2]) == '1' ? hexdec($matches[2].$matches[2]) : hexdec($matches[2]); + $result[2] = strlen($matches[3]) == '1' ? hexdec($matches[3].$matches[3]) : hexdec($matches[3]); + $result[3] = 1; + } elseif (preg_match($rgbPattern, $value, $matches)) { + $result = array(); + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = 1; + } elseif (preg_match($rgbaPattern, $value, $matches)) { + $result = array(); + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0; + } else { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to read color ({$value})." + ); + } + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php new file mode 100644 index 0000000..ac93cf0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php @@ -0,0 +1,358 @@ +data = $data; + } + + /** + * Init from fiven URL + * + * @param string $url + * @return \Intervention\Image\Image + */ + public function initFromUrl($url) + { + + $options = array( + 'http' => array( + 'method'=>"GET", + 'header'=>"Accept-language: en\r\n". + "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n" + ) + ); + + $context = stream_context_create($options); + + + if ($data = @file_get_contents($url, false, $context)) { + return $this->initFromBinary($data); + } + + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to init from given url (".$url.")." + ); + } + + /** + * Init from given stream + * + * @param StreamInterface|resource $stream + * @return \Intervention\Image\Image + */ + public function initFromStream($stream) + { + if (!$stream instanceof StreamInterface) { + $stream = new Stream($stream); + } + + try { + $offset = $stream->tell(); + } catch (\RuntimeException $e) { + $offset = 0; + } + + $shouldAndCanSeek = $offset !== 0 && $stream->isSeekable(); + + if ($shouldAndCanSeek) { + $stream->rewind(); + } + + try { + $data = $stream->getContents(); + } catch (\RuntimeException $e) { + $data = null; + } + + if ($shouldAndCanSeek) { + $stream->seek($offset); + } + + if ($data) { + return $this->initFromBinary($data); + } + + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to init from given stream" + ); + } + + /** + * Determines if current source data is GD resource + * + * @return boolean + */ + public function isGdResource() + { + if (is_resource($this->data)) { + return (get_resource_type($this->data) == 'gd'); + } + + return false; + } + + /** + * Determines if current source data is Imagick object + * + * @return boolean + */ + public function isImagick() + { + return is_a($this->data, 'Imagick'); + } + + /** + * Determines if current source data is Intervention\Image\Image object + * + * @return boolean + */ + public function isInterventionImage() + { + return is_a($this->data, '\Intervention\Image\Image'); + } + + /** + * Determines if current data is SplFileInfo object + * + * @return boolean + */ + public function isSplFileInfo() + { + return is_a($this->data, 'SplFileInfo'); + } + + /** + * Determines if current data is Symfony UploadedFile component + * + * @return boolean + */ + public function isSymfonyUpload() + { + return is_a($this->data, 'Symfony\Component\HttpFoundation\File\UploadedFile'); + } + + /** + * Determines if current source data is file path + * + * @return boolean + */ + public function isFilePath() + { + if (is_string($this->data)) { + try { + return is_file($this->data); + } catch (\Exception $e) { + return false; + } + } + + return false; + } + + /** + * Determines if current source data is url + * + * @return boolean + */ + public function isUrl() + { + return (bool) filter_var($this->data, FILTER_VALIDATE_URL); + } + + /** + * Determines if current source data is a stream resource + * + * @return boolean + */ + public function isStream() + { + if ($this->data instanceof StreamInterface) return true; + if (!is_resource($this->data)) return false; + if (get_resource_type($this->data) !== 'stream') return false; + + return true; + } + + /** + * Determines if current source data is binary data + * + * @return boolean + */ + public function isBinary() + { + if (is_string($this->data)) { + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $this->data); + return (substr($mime, 0, 4) != 'text' && $mime != 'application/x-empty'); + } + + return false; + } + + /** + * Determines if current source data is data-url + * + * @return boolean + */ + public function isDataUrl() + { + $data = $this->decodeDataUrl($this->data); + + return is_null($data) ? false : true; + } + + /** + * Determines if current source data is base64 encoded + * + * @return boolean + */ + public function isBase64() + { + if (!is_string($this->data)) { + return false; + } + + return base64_encode(base64_decode($this->data)) === $this->data; + } + + /** + * Initiates new Image from Intervention\Image\Image + * + * @param Image $object + * @return \Intervention\Image\Image + */ + public function initFromInterventionImage($object) + { + return $object; + } + + /** + * Parses and decodes binary image data from data-url + * + * @param string $data_url + * @return string + */ + private function decodeDataUrl($data_url) + { + if (!is_string($data_url)) { + return null; + } + + $pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P.+)$/"; + preg_match($pattern, $data_url, $matches); + + if (is_array($matches) && array_key_exists('data', $matches)) { + return base64_decode($matches['data']); + } + + return null; + } + + /** + * Initiates new image from mixed data + * + * @param mixed $data + * @return \Intervention\Image\Image + */ + public function init($data) + { + $this->data = $data; + + switch (true) { + + case $this->isGdResource(): + return $this->initFromGdResource($this->data); + + case $this->isImagick(): + return $this->initFromImagick($this->data); + + case $this->isInterventionImage(): + return $this->initFromInterventionImage($this->data); + + case $this->isSplFileInfo(): + return $this->initFromPath($this->data->getRealPath()); + + case $this->isBinary(): + return $this->initFromBinary($this->data); + + case $this->isUrl(): + return $this->initFromUrl($this->data); + + case $this->isStream(): + return $this->initFromStream($this->data); + + case $this->isDataUrl(): + return $this->initFromBinary($this->decodeDataUrl($this->data)); + + case $this->isFilePath(): + return $this->initFromPath($this->data); + + // isBase64 has to be after isFilePath to prevent false positives + case $this->isBase64(): + return $this->initFromBinary(base64_decode($this->data)); + + default: + throw new Exception\NotReadableException("Image source not readable"); + } + } + + /** + * Decoder object transforms to string source data + * + * @return string + */ + public function __toString() + { + return (string) $this->data; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php new file mode 100644 index 0000000..dfa1649 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php @@ -0,0 +1,132 @@ +decoder->init($data); + } + + /** + * Encodes given image + * + * @param Image $image + * @param string $format + * @param integer $quality + * @return \Intervention\Image\Image + */ + public function encode($image, $format, $quality) + { + return $this->encoder->process($image, $format, $quality); + } + + /** + * Executes named command on given image + * + * @param Image $image + * @param string $name + * @param array $arguments + * @return \Intervention\Image\Commands\AbstractCommand + */ + public function executeCommand($image, $name, $arguments) + { + $commandName = $this->getCommandClassName($name); + $command = new $commandName($arguments); + $command->execute($image); + + return $command; + } + + /** + * Returns classname of given command name + * + * @param string $name + * @return string + */ + private function getCommandClassName($name) + { + $drivername = $this->getDriverName(); + $classnameLocal = sprintf('\Intervention\Image\%s\Commands\%sCommand', $drivername, ucfirst($name)); + $classnameGlobal = sprintf('\Intervention\Image\Commands\%sCommand', ucfirst($name)); + + if (class_exists($classnameLocal)) { + return $classnameLocal; + } elseif (class_exists($classnameGlobal)) { + return $classnameGlobal; + } + + throw new \Intervention\Image\Exception\NotSupportedException( + "Command ({$name}) is not available for driver ({$drivername})." + ); + } + + /** + * Returns name of current driver instance + * + * @return string + */ + public function getDriverName() + { + $reflect = new \ReflectionClass($this); + $namespace = $reflect->getNamespaceName(); + + return substr(strrchr($namespace, "\\"), 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php new file mode 100644 index 0000000..0b56db5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php @@ -0,0 +1,234 @@ +setImage($image); + $this->setFormat($format); + $this->setQuality($quality); + + switch (strtolower($this->format)) { + + case 'data-url': + $this->result = $this->processDataUrl(); + break; + + case 'gif': + case 'image/gif': + $this->result = $this->processGif(); + break; + + case 'png': + case 'image/png': + case 'image/x-png': + $this->result = $this->processPng(); + break; + + case 'jpg': + case 'jpeg': + case 'image/jpg': + case 'image/jpeg': + case 'image/pjpeg': + $this->result = $this->processJpeg(); + break; + + case 'tif': + case 'tiff': + case 'image/tiff': + case 'image/tif': + case 'image/x-tif': + case 'image/x-tiff': + $this->result = $this->processTiff(); + break; + + case 'bmp': + case 'image/bmp': + case 'image/ms-bmp': + case 'image/x-bitmap': + case 'image/x-bmp': + case 'image/x-ms-bmp': + case 'image/x-win-bitmap': + case 'image/x-windows-bmp': + case 'image/x-xbitmap': + $this->result = $this->processBmp(); + break; + + case 'ico': + case 'image/x-ico': + case 'image/x-icon': + case 'image/vnd.microsoft.icon': + $this->result = $this->processIco(); + break; + + case 'psd': + case 'image/vnd.adobe.photoshop': + $this->result = $this->processPsd(); + break; + + case 'webp': + case 'image/webp': + case 'image/x-webp': + $this->result = $this->processWebp(); + break; + + default: + throw new \Intervention\Image\Exception\NotSupportedException( + "Encoding format ({$format}) is not supported." + ); + } + + $this->setImage(null); + + return $image->setEncoded($this->result); + } + + /** + * Processes and returns encoded image as data-url string + * + * @return string + */ + protected function processDataUrl() + { + $mime = $this->image->mime ? $this->image->mime : 'image/png'; + + return sprintf('data:%s;base64,%s', + $mime, + base64_encode($this->process($this->image, $mime, $this->quality)) + ); + } + + /** + * Sets image to process + * + * @param Image $image + */ + protected function setImage($image) + { + $this->image = $image; + } + + /** + * Determines output format + * + * @param string $format + */ + protected function setFormat($format = null) + { + if ($format == '' && $this->image instanceof Image) { + $format = $this->image->mime; + } + + $this->format = $format ? $format : 'jpg'; + + return $this; + } + + /** + * Determines output quality + * + * @param integer $quality + */ + protected function setQuality($quality) + { + $quality = is_null($quality) ? 90 : $quality; + $quality = $quality === 0 ? 1 : $quality; + + if ($quality < 0 || $quality > 100) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + 'Quality must range from 0 to 100.' + ); + } + + $this->quality = intval($quality); + + return $this; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractFont.php b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php new file mode 100644 index 0000000..8bcf3b2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php @@ -0,0 +1,260 @@ +text = $text; + } + + /** + * Set text to be written + * + * @param String $text + * @return void + */ + public function text($text) + { + $this->text = $text; + + return $this; + } + + /** + * Get text to be written + * + * @return String + */ + public function getText() + { + return $this->text; + } + + /** + * Set font size in pixels + * + * @param integer $size + * @return void + */ + public function size($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get font size in pixels + * + * @return integer + */ + public function getSize() + { + return $this->size; + } + + /** + * Set color of text to be written + * + * @param mixed $color + * @return void + */ + public function color($color) + { + $this->color = $color; + + return $this; + } + + /** + * Get color of text + * + * @return mixed + */ + public function getColor() + { + return $this->color; + } + + /** + * Set rotation angle of text + * + * @param integer $angle + * @return void + */ + public function angle($angle) + { + $this->angle = $angle; + + return $this; + } + + /** + * Get rotation angle of text + * + * @return integer + */ + public function getAngle() + { + return $this->angle; + } + + /** + * Set horizontal text alignment + * + * @param string $align + * @return void + */ + public function align($align) + { + $this->align = $align; + + return $this; + } + + /** + * Get horizontal text alignment + * + * @return string + */ + public function getAlign() + { + return $this->align; + } + + /** + * Set vertical text alignment + * + * @param string $valign + * @return void + */ + public function valign($valign) + { + $this->valign = $valign; + + return $this; + } + + /** + * Get vertical text alignment + * + * @return string + */ + public function getValign() + { + return $this->valign; + } + + /** + * Set path to font file + * + * @param string $file + * @return void + */ + public function file($file) + { + $this->file = $file; + + return $this; + } + + /** + * Get path to font file + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Checks if current font has access to an applicable font file + * + * @return boolean + */ + protected function hasApplicableFontFile() + { + if (is_string($this->file)) { + return file_exists($this->file); + } + + return false; + } + + /** + * Counts lines of text to be written + * + * @return integer + */ + public function countLines() + { + return count(explode(PHP_EOL, $this->text)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractShape.php b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php new file mode 100644 index 0000000..0ffc59e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php @@ -0,0 +1,71 @@ +background = $color; + } + + /** + * Set border width and color of current shape + * + * @param integer $width + * @param string $color + * @return void + */ + public function border($width, $color = null) + { + $this->border_width = is_numeric($width) ? intval($width) : 0; + $this->border_color = is_null($color) ? '#000000' : $color; + } + + /** + * Determines if current shape has border + * + * @return boolean + */ + public function hasBorder() + { + return ($this->border_width >= 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php new file mode 100644 index 0000000..daa79bc --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php @@ -0,0 +1,79 @@ +arguments = $arguments; + } + + /** + * Creates new argument instance from given argument key + * + * @param integer $key + * @return \Intervention\Image\Commands\Argument + */ + public function argument($key) + { + return new \Intervention\Image\Commands\Argument($this, $key); + } + + /** + * Returns output data of current command + * + * @return mixed + */ + public function getOutput() + { + return $this->output ? $this->output : null; + } + + /** + * Determines if current instance has output data + * + * @return boolean + */ + public function hasOutput() + { + return ! is_null($this->output); + } + + /** + * Sets output data of current command + * + * @param mixed $value + */ + public function setOutput($value) + { + $this->output = $value; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php new file mode 100644 index 0000000..ee33dce --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php @@ -0,0 +1,225 @@ +command = $command; + $this->key = $key; + } + + /** + * Returns name of current arguments command + * + * @return string + */ + public function getCommandName() + { + preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches); + return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method'; + } + + /** + * Returns value of current argument + * + * @param mixed $default + * @return mixed + */ + public function value($default = null) + { + $arguments = $this->command->arguments; + + if (is_array($arguments)) { + return isset($arguments[$this->key]) ? $arguments[$this->key] : $default; + } + + return $default; + } + + /** + * Defines current argument as required + * + * @return \Intervention\Image\Commands\Argument + */ + public function required() + { + if ( ! array_key_exists($this->key, $this->command->arguments)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName()) + ); + } + + return $this; + } + + /** + * Determines that current argument must be of given type + * + * @return \Intervention\Image\Commands\Argument + */ + public function type($type) + { + $fail = false; + + $value = $this->value(); + + if (is_null($value)) { + return $this; + } + + switch (strtolower($type)) { + + case 'bool': + case 'boolean': + $fail = ! is_bool($value); + $message = sprintf('%s accepts only boolean values as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'int': + case 'integer': + $fail = ! is_integer($value); + $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'num': + case 'numeric': + $fail = ! is_numeric($value); + $message = sprintf('%s accepts only numeric values as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'str': + case 'string': + $fail = ! is_string($value); + $message = sprintf('%s accepts only string values as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'array': + $fail = ! is_array($value); + $message = sprintf('%s accepts only array as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'closure': + $fail = ! is_a($value, '\Closure'); + $message = sprintf('%s accepts only Closure as argument %d.', $this->getCommandName(), $this->key + 1); + break; + + case 'digit': + $fail = ! $this->isDigit($value); + $message = sprintf('%s accepts only integer values as argument %d.', $this->getCommandName(), $this->key + 1); + break; + } + + if ($fail) { + + $message = isset($message) ? $message : sprintf("Missing argument for %d.", $this->key); + + throw new \Intervention\Image\Exception\InvalidArgumentException( + $message + ); + } + + return $this; + } + + /** + * Determines that current argument value must be numeric between given values + * + * @return \Intervention\Image\Commands\Argument + */ + public function between($x, $y) + { + $value = $this->type('numeric')->value(); + + if (is_null($value)) { + return $this; + } + + $alpha = min($x, $y); + $omega = max($x, $y); + + if ($value < $alpha || $value > $omega) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y) + ); + } + + return $this; + } + + /** + * Determines that current argument must be over a minimum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function min($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v < $value) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + sprintf('Argument %d must be at least %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Determines that current argument must be under a maxiumum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function max($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v > $value) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + sprintf('Argument %d may not be greater than %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Checks if value is "PHP" integer (120 but also 120.0) + * + * @param mixed $value + * @return boolean + */ + private function isDigit($value) + { + return is_numeric($value) ? intval($value) == $value : false; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php new file mode 100644 index 0000000..f8944bf --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php @@ -0,0 +1,29 @@ +getSize(); + + for ($x=0; $x <= ($size->width-1); $x++) { + for ($y=0; $y <= ($size->height-1); $y++) { + $colors[] = $image->pickColor($x, $y, 'array'); + } + } + + $this->setOutput(md5(serialize($colors))); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php new file mode 100644 index 0000000..2fc38dd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php @@ -0,0 +1,35 @@ +argument(0)->type('numeric')->required()->value(); + $x = $this->argument(1)->type('numeric')->required()->value(); + $y = $this->argument(2)->type('numeric')->required()->value(); + $callback = $this->argument(3)->type('closure')->value(); + + $circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape', + $image->getDriver()->getDriverName()); + + $circle = new $circle_classname($diameter); + + if ($callback instanceof Closure) { + $callback($circle); + } + + $circle->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php new file mode 100644 index 0000000..4f364ec --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $height = $this->argument(1)->type('numeric')->required()->value(); + $x = $this->argument(2)->type('numeric')->required()->value(); + $y = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape', + $image->getDriver()->getDriverName()); + + $ellipse = new $ellipse_classname($width, $height); + + if ($callback instanceof Closure) { + $callback($ellipse); + } + + $ellipse->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php new file mode 100644 index 0000000..2986cae --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php @@ -0,0 +1,37 @@ +argument(0)->value(); + + // try to read exif data from image file + $data = @exif_read_data($image->dirname .'/'. $image->basename); + + if (! is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + $this->setOutput($data); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php new file mode 100644 index 0000000..43239ed --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php @@ -0,0 +1,64 @@ +argument(0)->value(); + + $info = array(); + @getimagesize($image->dirname .'/'. $image->basename, $info); + + $data = array(); + + if (array_key_exists('APP13', $info)) { + $iptc = iptcparse($info['APP13']); + + if (is_array($iptc)) { + $data['DocumentTitle'] = isset($iptc["2#005"][0]) ? $iptc["2#005"][0] : null; + $data['Urgency'] = isset($iptc["2#010"][0]) ? $iptc["2#010"][0] : null; + $data['Category'] = isset($iptc["2#015"][0]) ? $iptc["2#015"][0] : null; + $data['Subcategories'] = isset($iptc["2#020"][0]) ? $iptc["2#020"][0] : null; + $data['Keywords'] = isset($iptc["2#025"][0]) ? $iptc["2#025"] : null; + $data['SpecialInstructions'] = isset($iptc["2#040"][0]) ? $iptc["2#040"][0] : null; + $data['CreationDate'] = isset($iptc["2#055"][0]) ? $iptc["2#055"][0] : null; + $data['CreationTime'] = isset($iptc["2#060"][0]) ? $iptc["2#060"][0] : null; + $data['AuthorByline'] = isset($iptc["2#080"][0]) ? $iptc["2#080"][0] : null; + $data['AuthorTitle'] = isset($iptc["2#085"][0]) ? $iptc["2#085"][0] : null; + $data['City'] = isset($iptc["2#090"][0]) ? $iptc["2#090"][0] : null; + $data['SubLocation'] = isset($iptc["2#092"][0]) ? $iptc["2#092"][0] : null; + $data['State'] = isset($iptc["2#095"][0]) ? $iptc["2#095"][0] : null; + $data['Country'] = isset($iptc["2#101"][0]) ? $iptc["2#101"][0] : null; + $data['OTR'] = isset($iptc["2#103"][0]) ? $iptc["2#103"][0] : null; + $data['Headline'] = isset($iptc["2#105"][0]) ? $iptc["2#105"][0] : null; + $data['Source'] = isset($iptc["2#110"][0]) ? $iptc["2#110"][0] : null; + $data['PhotoSource'] = isset($iptc["2#115"][0]) ? $iptc["2#115"][0] : null; + $data['Copyright'] = isset($iptc["2#116"][0]) ? $iptc["2#116"][0] : null; + $data['Caption'] = isset($iptc["2#120"][0]) ? $iptc["2#120"][0] : null; + $data['CaptionWriter'] = isset($iptc["2#122"][0]) ? $iptc["2#122"][0] : null; + } + } + + if (! is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + $this->setOutput($data); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php new file mode 100644 index 0000000..0089c64 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape', + $image->getDriver()->getDriverName()); + + $line = new $line_classname($x2, $y2); + + if ($callback instanceof Closure) { + $callback($line); + } + + $line->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php new file mode 100644 index 0000000..552482c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php @@ -0,0 +1,48 @@ +exif('Orientation')) { + + case 2: + $image->flip(); + break; + + case 3: + $image->rotate(180); + break; + + case 4: + $image->rotate(180)->flip(); + break; + + case 5: + $image->rotate(270)->flip(); + break; + + case 6: + $image->rotate(270); + break; + + case 7: + $image->rotate(90)->flip(); + break; + + case 8: + $image->rotate(90); + break; + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php new file mode 100644 index 0000000..e46e3ff --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php @@ -0,0 +1,48 @@ +argument(0)->type('array')->required()->value(); + $callback = $this->argument(1)->type('closure')->value(); + + $vertices_count = count($points); + + // check if number if coordinates is even + if ($vertices_count % 2 !== 0) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "The number of given polygon vertices must be even." + ); + } + + if ($vertices_count < 6) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "You must have at least 3 points in your array." + ); + } + + $polygon_classname = sprintf('\Intervention\Image\%s\Shapes\PolygonShape', + $image->getDriver()->getDriverName()); + + $polygon = new $polygon_classname($points); + + if ($callback instanceof Closure) { + $callback($polygon); + } + + $polygon->applyToImage($image); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php new file mode 100644 index 0000000..ab47be1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php @@ -0,0 +1,45 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + //Encoded property will be populated at this moment + $stream = $image->stream($format, $quality); + + $mimetype = finfo_buffer( + finfo_open(FILEINFO_MIME_TYPE), + $image->getEncoded() + ); + + $this->setOutput(new Response( + 200, + array( + 'Content-Type' => $mimetype, + 'Content-Length' => strlen($image->getEncoded()) + ), + $stream + )); + + return true; + } +} \ No newline at end of file diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php new file mode 100644 index 0000000..3a2074c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape', + $image->getDriver()->getDriverName()); + + $rectangle = new $rectangle_classname($x1, $y1, $x2, $y2); + + if ($callback instanceof Closure) { + $callback($rectangle); + } + + $rectangle->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php new file mode 100644 index 0000000..7903b5a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php @@ -0,0 +1,26 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + $response = new Response($image, $format, $quality); + + $this->setOutput($response->make()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php new file mode 100644 index 0000000..111c475 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + $this->setOutput(\GuzzleHttp\Psr7\stream_for( + $image->encode($format, $quality)->getEncoded() + )); + + return true; + } +} \ No newline at end of file diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php new file mode 100644 index 0000000..4aebd8e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php @@ -0,0 +1,34 @@ +argument(0)->required()->value(); + $x = $this->argument(1)->type('numeric')->value(0); + $y = $this->argument(2)->type('numeric')->value(0); + $callback = $this->argument(3)->type('closure')->value(); + + $fontclassname = sprintf('\Intervention\Image\%s\Font', + $image->getDriver()->getDriverName()); + + $font = new $fontclassname($text); + + if ($callback instanceof Closure) { + $callback($font); + } + + $font->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Constraint.php b/vendor/intervention/image/src/Intervention/Image/Constraint.php new file mode 100644 index 0000000..7352354 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Constraint.php @@ -0,0 +1,92 @@ +size = $size; + } + + /** + * Returns current size of constraint + * + * @return \Intervention\Image\Size + */ + public function getSize() + { + return $this->size; + } + + /** + * Fix the given argument in current constraint + * + * @param integer $type + * @return void + */ + public function fix($type) + { + $this->fixed = ($this->fixed & ~(1 << $type)) | (1 << $type); + } + + /** + * Checks if given argument is fixed in current constraint + * + * @param integer $type + * @return boolean + */ + public function isFixed($type) + { + return (bool) ($this->fixed & (1 << $type)); + } + + /** + * Fixes aspect ratio in current constraint + * + * @return void + */ + public function aspectRatio() + { + $this->fix(self::ASPECTRATIO); + } + + /** + * Fixes possibility to size up in current constraint + * + * @return void + */ + public function upsize() + { + $this->fix(self::UPSIZE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php new file mode 100644 index 0000000..83e6b91 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php @@ -0,0 +1,8 @@ +dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null; + $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null; + $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null; + $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null; + + if (file_exists($path) && is_file($path)) { + $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + return $this; + } + + /** + * Get file size + * + * @return mixed + */ + public function filesize() + { + $path = $this->basePath(); + + if (file_exists($path) && is_file($path)) { + return filesize($path); + } + + return false; + } + + /** + * Get fully qualified path + * + * @return string + */ + public function basePath() + { + if ($this->dirname && $this->basename) { + return ($this->dirname .'/'. $this->basename); + } + + return null; + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php new file mode 100644 index 0000000..17e926e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php @@ -0,0 +1,42 @@ +size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE; + } + + /** + * Applies filter effects to given image + * + * @param \Intervention\Image\Image $image + * @return \Intervention\Image\Image + */ + public function applyFilter(\Intervention\Image\Image $image) + { + $image->pixelate($this->size); + $image->greyscale(); + + return $image; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php new file mode 100644 index 0000000..27c0bee --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php @@ -0,0 +1,14 @@ +a = ($value >> 24) & 0xFF; + $this->r = ($value >> 16) & 0xFF; + $this->g = ($value >> 8) & 0xFF; + $this->b = $value & 0xFF; + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + $this->a = $this->alpha2gd($a); + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $this->a = 0; + + } + + $this->r = $r; + $this->g = $g; + $this->b = $b; + } + + /** + * Initiates color object from given string + * + * @param string $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->r = $color[0]; + $this->g = $color[1]; + $this->b = $color[2]; + $this->a = $this->alpha2gd($color[3]); + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param integer $r + * @param integer $g + * @param integer $b + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = 0; + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param integer $r + * @param integer $g + * @param integer $b + * @param float $a + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a = 1) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = $this->alpha2gd($a); + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "GD colors cannot init from ImagickPixel objects." + ); + } + + /** + * Calculates integer value of current color instance + * + * @return integer + */ + public function getInt() + { + return ($this->a << 24) + ($this->r << 16) + ($this->g << 8) + $this->b; + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, $this->r, $this->g, $this->b); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return array($this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)); + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', $this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param integer $tolerance + * @return boolean + */ + public function differs(AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance * 1.27); + + $delta = array( + 'r' => abs($color->r - $this->r), + 'g' => abs($color->g - $this->g), + 'b' => abs($color->b - $this->b), + 'a' => abs($color->a - $this->a) + ); + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Convert rgba alpha (0-1) value to gd value (0-127) + * + * @param float $input + * @return int + */ + private function alpha2gd($input) + { + $oldMin = 0; + $oldMax = 1; + + $newMin = 127; + $newMax = 0; + + return ceil(((($input- $oldMin) * ($newMax - $newMin)) / ($oldMax - $oldMin)) + $newMin); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php new file mode 100644 index 0000000..347daea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php @@ -0,0 +1,32 @@ +argument(0)->value(); + + // clone current image resource + $size = $image->getSize(); + $clone = imagecreatetruecolor($size->width, $size->height); + imagealphablending($clone, false); + imagesavealpha($clone, true); + $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127); + imagefill($clone, 0, 0, $transparency); + + // copy image to clone + imagecopy($clone, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height); + + $image->setBackup($clone, $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php new file mode 100644 index 0000000..d53f59d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php @@ -0,0 +1,23 @@ +argument(0)->between(0, 100)->value(1); + + for ($i=0; $i < intval($amount); $i++) { + imagefilter($image->getCore(), IMG_FILTER_GAUSSIAN_BLUR); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php new file mode 100644 index 0000000..de4263f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_BRIGHTNESS, ($level * 2.55)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php new file mode 100644 index 0000000..8f53963 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php @@ -0,0 +1,27 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = round($red * 2.55); + $green = round($green * 2.55); + $blue = round($blue * 2.55); + + // apply filter + return imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $red, $green, $blue); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php new file mode 100644 index 0000000..e43b761 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php new file mode 100644 index 0000000..b7f5954 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php @@ -0,0 +1,40 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + return $this->modify($image, 0, 0, $position->x, $position->y, $cropped->width, $cropped->height, $cropped->width, $cropped->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php new file mode 100644 index 0000000..403e8b8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php @@ -0,0 +1,25 @@ +getCore()); + + // destroy backups + foreach ($image->getBackups() as $backup) { + imagedestroy($backup); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php new file mode 100644 index 0000000..aaecb7f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php @@ -0,0 +1,68 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $width = $image->getWidth(); + $height = $image->getHeight(); + $resource = $image->getCore(); + + try { + + // set image tile filling + $source = new Decoder; + $tile = $source->init($filling); + imagesettile($image->getCore(), $tile->getCore()); + $filling = IMG_COLOR_TILED; + + } catch (\Intervention\Image\Exception\NotReadableException $e) { + + // set solid color filling + $color = new Color($filling); + $filling = $color->getInt(); + } + + imagealphablending($resource, true); + + if (is_int($x) && is_int($y)) { + + // resource should be visible through transparency + $base = $image->getDriver()->newImage($width, $height)->getCore(); + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // floodfill if exact position is defined + imagefill($resource, $x, $y, $filling); + + // copy filled original over base + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // set base as new resource-core + $image->setCore($base); + imagedestroy($resource); + + } else { + // fill whole image otherwise + imagefilledrectangle($resource, 0, 0, $width - 1, $height - 1, $filling); + } + + isset($tile) ? imagedestroy($tile->getCore()) : null; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php new file mode 100644 index 0000000..d861ad9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php @@ -0,0 +1,32 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, $cropped->pivot->x, $cropped->pivot->y, $resized->getWidth(), $resized->getHeight(), $cropped->getWidth(), $cropped->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php new file mode 100644 index 0000000..aa8f230 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php @@ -0,0 +1,37 @@ +argument(0)->value('h'); + + $size = $image->getSize(); + $dst = clone $size; + + switch (strtolower($mode)) { + case 2: + case 'v': + case 'vert': + case 'vertical': + $size->pivot->y = $size->height - 1; + $size->height = $size->height * (-1); + break; + + default: + $size->pivot->x = $size->width - 1; + $size->width = $size->width * (-1); + break; + } + + return $this->modify($image, 0, 0, $size->pivot->x, $size->pivot->y, $dst->width, $dst->height, $size->width, $size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php new file mode 100644 index 0000000..366f118 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php @@ -0,0 +1,19 @@ +argument(0)->type('numeric')->required()->value(); + + return imagegammacorrect($image->getCore(), 1, $gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php new file mode 100644 index 0000000..89ee284 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php @@ -0,0 +1,24 @@ +setOutput(new Size( + imagesx($image->getCore()), + imagesy($image->getCore()) + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php new file mode 100644 index 0000000..ded8e0d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php @@ -0,0 +1,17 @@ +getCore(), IMG_FILTER_GRAYSCALE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php new file mode 100644 index 0000000..51e0abd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php new file mode 100644 index 0000000..eba75f0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php @@ -0,0 +1,32 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + imagealphablending($image->getCore(), true); + return imagecopy($image->getCore(), $watermark->getCore(), $target->x, $target->y, 0, 0, $watermark_size->width, $watermark_size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php new file mode 100644 index 0000000..e8f4b18 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('bool')->value(true); + + imageinterlace($image->getCore(), $mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php new file mode 100644 index 0000000..f72e7e3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php @@ -0,0 +1,17 @@ +getCore(), IMG_FILTER_NEGATE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php new file mode 100644 index 0000000..27955e7 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php @@ -0,0 +1,51 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // create empty canvas + $resource = imagecreatetruecolor($size->width, $size->height); + + // define matte + if (is_null($matte)) { + $matte = imagecolorallocatealpha($resource, 255, 255, 255, 127); + } else { + $matte = $image->getDriver()->parseColor($matte)->getInt(); + } + + // fill with matte and copy original image + imagefill($resource, 0, 0, $matte); + + // set transparency + imagecolortransparent($resource, $matte); + + // copy original image + imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height); + + if (is_numeric($count) && $count <= 256) { + // decrease colors + imagetruecolortopalette($resource, true, $count); + } + + // set new resource + $image->setCore($resource); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php new file mode 100644 index 0000000..944f044 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php @@ -0,0 +1,81 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + $image_size = $image->getSize(); + + // create empty canvas + $canvas = $image->getDriver()->newImage($image_size->width, $image_size->height, array(0,0,0,0)); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + $mask_size = $mask->getSize(); + + // resize mask to size of current image (if necessary) + if ($mask_size != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + imagealphablending($canvas->getCore(), false); + + if ( ! $mask_w_alpha) { + // mask from greyscale image + imagefilter($mask->getCore(), IMG_FILTER_GRAYSCALE); + } + + // redraw old image pixel by pixel considering alpha map + for ($x=0; $x < $image_size->width; $x++) { + for ($y=0; $y < $image_size->height; $y++) { + + $color = $image->pickColor($x, $y, 'array'); + $alpha = $mask->pickColor($x, $y, 'array'); + + if ($mask_w_alpha) { + $alpha = $alpha[3]; // use alpha channel as mask + } else { + + if ($alpha[3] == 0) { // transparent as black + $alpha = 0; + } else { + + // $alpha = floatval(round((($alpha[0] + $alpha[1] + $alpha[3]) / 3) / 255, 2)); + + // image is greyscale, so channel doesn't matter (use red channel) + $alpha = floatval(round($alpha[0] / 255, 2)); + } + + } + + // preserve alpha of original image... + if ($color[3] < $alpha) { + $alpha = $color[3]; + } + + // replace alpha value + $color[3] = $alpha; + + // redraw pixel + $canvas->pixel($color, $x, $y); + } + } + + + // replace current image with masked instance + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php new file mode 100644 index 0000000..081e68a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php @@ -0,0 +1,29 @@ +argument(0)->between(0, 100)->required()->value(); + + // get size of image + $size = $image->getSize(); + + // build temp alpha mask + $mask_color = sprintf('rgba(0, 0, 0, %.1F)', $transparency / 100); + $mask = $image->getDriver()->newImage($size->width, $size->height, $mask_color); + + // mask image + $image->mask($mask->getCore(), true); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php new file mode 100644 index 0000000..9fb4bb4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = imagecolorat($image->getCore(), $x, $y); + + if ( ! imageistruecolor($image->getCore())) { + $color = imagecolorsforindex($image->getCore(), $color); + $color['alpha'] = round(1 - $color['alpha'] / 127, 2); + } + + $color = new Color($color); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php new file mode 100644 index 0000000..67f3e3b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php @@ -0,0 +1,24 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + return imagesetpixel($image->getCore(), $x, $y, $color->getInt()); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php new file mode 100644 index 0000000..2e2093d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php @@ -0,0 +1,19 @@ +argument(0)->type('digit')->value(10); + + return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php new file mode 100644 index 0000000..c8d2e4a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php @@ -0,0 +1,35 @@ +argument(0)->value(); + + if (is_resource($backup = $image->getBackup($backupName))) { + + // destroy current resource + imagedestroy($image->getCore()); + + // clone backup + $backup = $image->getDriver()->cloneCore($backup); + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new \Intervention\Image\Exception\RuntimeException( + "Backup not available. Call backup() before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php new file mode 100644 index 0000000..70739ff --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -0,0 +1,81 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $transparent = imagecolorallocatealpha($canvas->getCore(), 255, 255, 255, 127); + imagealphablending($canvas->getCore(), false); // do not blend / just overwrite + imagefilledrectangle($canvas->getCore(), $dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1, $transparent); + + // copy image into new canvas + imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php new file mode 100644 index 0000000..2b5700f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php @@ -0,0 +1,82 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, 0, 0, $resized->getWidth(), $resized->getHeight(), $image->getWidth(), $image->getHeight()); + + return true; + } + + /** + * Wrapper function for 'imagecopyresampled' + * + * @param Image $image + * @param integer $dst_x + * @param integer $dst_y + * @param integer $src_x + * @param integer $src_y + * @param integer $dst_w + * @param integer $dst_h + * @param integer $src_w + * @param integer $src_h + * @return boolean + */ + protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) + { + // create new image + $modified = imagecreatetruecolor($dst_w, $dst_h); + + // get current image + $resource = $image->getCore(); + + // preserve transparency + $transIndex = imagecolortransparent($resource); + + if ($transIndex != -1) { + $rgba = imagecolorsforindex($modified, $transIndex); + $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127); + imagefill($modified, 0, 0, $transColor); + imagecolortransparent($modified, $transColor); + } else { + imagealphablending($modified, false); + imagesavealpha($modified, true); + } + + // copy content from resource + $result = imagecopyresampled( + $modified, + $resource, + $dst_x, + $dst_y, + $src_x, + $src_y, + $dst_w, + $dst_h, + $src_w, + $src_h + ); + + // set new content as recource + $image->setCore($modified); + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php new file mode 100644 index 0000000..26a460d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php @@ -0,0 +1,26 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // rotate image + $image->setCore(imagerotate($image->getCore(), $angle, $color->getInt())); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php new file mode 100644 index 0000000..9c1ca20 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php @@ -0,0 +1,32 @@ +argument(0)->between(0, 100)->value(10); + + // build matrix + $min = $amount >= 10 ? $amount * -0.01 : 0; + $max = $amount * -0.025; + $abs = ((4 * $min + 4 * $max) * -1) + 1; + $div = 1; + + $matrix = array( + array($min, $max, $min), + array($max, $abs, $max), + array($min, $max, $min) + ); + + // apply the matrix + return imageconvolution($image->getCore(), $matrix, $div, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php new file mode 100644 index 0000000..49a9ac6 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php @@ -0,0 +1,176 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + // default values + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = array('top', 'right', 'bottom', 'left'); + } elseif (is_string($away)) { + $away = array($away); + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $color = new Color; // color will only be used to compare alpha channel + } else { + $color = $image->pickColor($base_x, $base_y, 'object'); + } + + $top_x = 0; + $top_y = 0; + $bottom_x = $width; + $bottom_y = $height; + + // search upper part of image for colors to trim away + if (in_array('top', $away)) { + + for ($y=0; $y < ceil($height/2); $y++) { + for ($x=0; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_y = max(0, $y - $feather); + break 2; + } + + } + } + + } + + // search left part of image for colors to trim away + if (in_array('left', $away)) { + + for ($x=0; $x < ceil($width/2); $x++) { + for ($y=$top_y; $y < $height; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_x = max(0, $x - $feather); + break 2; + } + + } + } + + } + + // search lower part of image for colors to trim away + if (in_array('bottom', $away)) { + + for ($y=($height-1); $y >= floor($height/2)-1; $y--) { + for ($x=$top_x; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_y = min($height, $y+1 + $feather); + break 2; + } + + } + } + + } + + // search right part of image for colors to trim away + if (in_array('right', $away)) { + + for ($x=($width-1); $x >= floor($width/2)-1; $x--) { + for ($y=$top_y; $y < $bottom_y; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_x = min($width, $x+1 + $feather); + break 2; + } + + } + } + + } + + + // trim parts of image + return $this->modify($image, 0, 0, $top_x, $top_y, ($bottom_x-$top_x), ($bottom_y-$top_y), ($bottom_x-$top_x), ($bottom_y-$top_y)); + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php new file mode 100644 index 0000000..c7d396f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php new file mode 100644 index 0000000..25f91a5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php @@ -0,0 +1,153 @@ +gdResourceToTruecolor($core); + + // build image + $image = $this->initFromGdResource($core); + $image->mime = $mime; + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + return new Image(new Driver, $resource); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "Gd driver is unable to init from Imagick object." + ); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $resource = @imagecreatefromstring($binary); + + if ($resource === false) { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to init from given binary data." + ); + } + + $image = $this->initFromGdResource($resource); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Transform GD resource into Truecolor version + * + * @param resource $resource + * @return bool + */ + public function gdResourceToTruecolor(&$resource) + { + $width = imagesx($resource); + $height = imagesy($resource); + + // new canvas + $canvas = imagecreatetruecolor($width, $height); + + // fill with transparent color + imagealphablending($canvas, false); + $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127); + imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent); + imagecolortransparent($canvas, $transparent); + imagealphablending($canvas, true); + + // copy original + imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height); + imagedestroy($resource); + + $resource = $canvas; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php new file mode 100644 index 0000000..6179f08 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php @@ -0,0 +1,84 @@ +coreAvailable()) { + throw new \Intervention\Image\Exception\NotSupportedException( + "GD Library extension not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param integer $width + * @param integer $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + // create empty resource + $core = imagecreatetruecolor($width, $height); + $image = new \Intervention\Image\Image(new static, $core); + + // set background color + $background = new Color($background); + imagefill($image->getCore(), 0, 0, $background->getInt()); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('gd') && function_exists('gd_info')); + } + + /** + * Returns clone of given core + * + * @return mixed + */ + public function cloneCore($core) + { + $width = imagesx($core); + $height = imagesy($core); + $clone = imagecreatetruecolor($width, $height); + imagealphablending($clone, false); + imagesavealpha($clone, true); + + imagecopy($clone, $core, 0, 0, 0, 0, $width, $height); + + return $clone; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php new file mode 100644 index 0000000..a3fd2f1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php @@ -0,0 +1,122 @@ +image->getCore(), null, $this->quality); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_JPEG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + ob_start(); + $resource = $this->image->getCore(); + imagealphablending($resource, false); + imagesavealpha($resource, true); + imagepng($resource, null, -1); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + ob_start(); + imagegif($this->image->getCore()); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + protected function processWebp() + { + if ( ! function_exists('imagewebp')) { + throw new \Intervention\Image\Exception\NotSupportedException( + "Webp format is not supported by PHP installation." + ); + } + + ob_start(); + imagewebp($this->image->getCore(), null, $this->quality); + $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp'; + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + throw new \Intervention\Image\Exception\NotSupportedException( + "TIFF format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + throw new \Intervention\Image\Exception\NotSupportedException( + "BMP format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + throw new \Intervention\Image\Exception\NotSupportedException( + "ICO format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + throw new \Intervention\Image\Exception\NotSupportedException( + "PSD format is not supported by Gd Driver." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Font.php b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php new file mode 100644 index 0000000..df2d082 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php @@ -0,0 +1,255 @@ +size * 0.75)); + } + + /** + * Filter function to access internal integer font values + * + * @return integer + */ + private function getInternalFont() + { + $internalfont = is_null($this->file) ? 1 : $this->file; + $internalfont = is_numeric($internalfont) ? $internalfont : false; + + if ( ! in_array($internalfont, array(1, 2, 3, 4, 5))) { + throw new \Intervention\Image\Exception\NotSupportedException( + sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont) + ); + } + + return intval($internalfont); + } + + /** + * Get width of an internal font character + * + * @return integer + */ + private function getInternalFontWidth() + { + return $this->getInternalFont() + 4; + } + + /** + * Get height of an internal font character + * + * @return integer + */ + private function getInternalFontHeight() + { + switch ($this->getInternalFont()) { + case 1: + return 8; + + case 2: + return 14; + + case 3: + return 14; + + case 4: + return 16; + + case 5: + return 16; + } + } + + /** + * Calculates bounding box of current font setting + * + * @return Array + */ + public function getBoxSize() + { + $box = array(); + + if ($this->hasApplicableFontFile()) { + + // get bounding box with angle 0 + $box = imagettfbbox($this->getPointSize(), 0, $this->file, $this->text); + + // rotate points manually + if ($this->angle != 0) { + + $angle = pi() * 2 - $this->angle * pi() * 2 / 360; + + for ($i=0; $i<4; $i++) { + $x = $box[$i * 2]; + $y = $box[$i * 2 + 1]; + $box[$i * 2] = cos($angle) * $x - sin($angle) * $y; + $box[$i * 2 + 1] = sin($angle) * $x + cos($angle) * $y; + } + } + + $box['width'] = intval(abs($box[4] - $box[0])); + $box['height'] = intval(abs($box[5] - $box[1])); + + } else { + + // get current internal font size + $width = $this->getInternalFontWidth(); + $height = $this->getInternalFontHeight(); + + if (strlen($this->text) == 0) { + // no text -> no boxsize + $box['width'] = 0; + $box['height'] = 0; + } else { + // calculate boxsize + $box['width'] = strlen($this->text) * $width; + $box['height'] = $height; + } + } + + return $box; + } + + /** + * Draws font to given image at given position + * + * @param Image $image + * @param integer $posx + * @param integer $posy + * @return void + */ + public function applyToImage(Image $image, $posx = 0, $posy = 0) + { + // parse text color + $color = new Color($this->color); + + if ($this->hasApplicableFontFile()) { + + if ($this->angle != 0 || is_string($this->align) || is_string($this->valign)) { + + $box = $this->getBoxSize(); + + $align = is_null($this->align) ? 'left' : strtolower($this->align); + $valign = is_null($this->valign) ? 'bottom' : strtolower($this->valign); + + // correction on position depending on v/h alignment + switch ($align.'-'.$valign) { + + case 'center-top': + $posx = $posx - round(($box[6]+$box[4])/2); + $posy = $posy - round(($box[7]+$box[5])/2); + break; + + case 'right-top': + $posx = $posx - $box[4]; + $posy = $posy - $box[5]; + break; + + case 'left-top': + $posx = $posx - $box[6]; + $posy = $posy - $box[7]; + break; + + case 'center-center': + case 'center-middle': + $posx = $posx - round(($box[0]+$box[4])/2); + $posy = $posy - round(($box[1]+$box[5])/2); + break; + + case 'right-center': + case 'right-middle': + $posx = $posx - round(($box[2]+$box[4])/2); + $posy = $posy - round(($box[3]+$box[5])/2); + break; + + case 'left-center': + case 'left-middle': + $posx = $posx - round(($box[0]+$box[6])/2); + $posy = $posy - round(($box[1]+$box[7])/2); + break; + + case 'center-bottom': + $posx = $posx - round(($box[0]+$box[2])/2); + $posy = $posy - round(($box[1]+$box[3])/2); + break; + + case 'right-bottom': + $posx = $posx - $box[2]; + $posy = $posy - $box[3]; + break; + + case 'left-bottom': + $posx = $posx - $box[0]; + $posy = $posy - $box[1]; + break; + } + } + + // enable alphablending for imagettftext + imagealphablending($image->getCore(), true); + + // draw ttf text + imagettftext($image->getCore(), $this->getPointSize(), $this->angle, $posx, $posy, $color->getInt(), $this->file, $this->text); + + } else { + + // get box size + $box = $this->getBoxSize(); + $width = $box['width']; + $height = $box['height']; + + // internal font specific position corrections + if ($this->getInternalFont() == 1) { + $top_correction = 1; + $bottom_correction = 2; + } elseif ($this->getInternalFont() == 3) { + $top_correction = 2; + $bottom_correction = 4; + } else { + $top_correction = 3; + $bottom_correction = 4; + } + + // x-position corrections for horizontal alignment + switch (strtolower($this->align)) { + case 'center': + $posx = ceil($posx - ($width / 2)); + break; + + case 'right': + $posx = ceil($posx - $width) + 1; + break; + } + + // y-position corrections for vertical alignment + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + $posy = ceil($posy - ($height / 2)); + break; + + case 'top': + $posy = ceil($posy - $top_correction); + break; + + default: + case 'bottom': + $posy = round($posy - $height + $bottom_correction); + break; + } + + // draw text + imagestring($image->getCore(), $this->getInternalFont(), $posx, $posy, $this->text, $color->getInt()); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php new file mode 100644 index 0000000..c512d86 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php new file mode 100644 index 0000000..ae5de95 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php @@ -0,0 +1,64 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + // parse background color + $background = new Color($this->background); + + if ($this->hasBorder()) { + // slightly smaller ellipse to keep 1px bordered edges clean + imagefilledellipse($image->getCore(), $x, $y, $this->width-1, $this->height-1, $background->getInt()); + + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + + // gd's imageellipse doesn't respect imagesetthickness so i use imagearc with 359.9 degrees here + imagearc($image->getCore(), $x, $y, $this->width, $this->height, 0, 359.99, $border_color->getInt()); + } else { + imagefilledellipse($image->getCore(), $x, $y, $this->width, $this->height, $background->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php new file mode 100644 index 0000000..92e2401 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php @@ -0,0 +1,89 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param integer $width + * @return void + */ + public function width($width) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "Line width is not supported by GD driver." + ); + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $color = new Color($this->color); + imageline($image->getCore(), $x, $y, $this->x, $this->y, $color->getInt()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php new file mode 100644 index 0000000..c739fbb --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php @@ -0,0 +1,48 @@ +points = $points; + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php new file mode 100644 index 0000000..757eb5d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php @@ -0,0 +1,75 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledrectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagerectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Image.php b/vendor/intervention/image/src/Intervention/Image/Image.php new file mode 100644 index 0000000..c1b4c2f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Image.php @@ -0,0 +1,363 @@ +driver = $driver; + $this->core = $core; + } + + /** + * Magic method to catch all image calls + * usually any AbstractCommand + * + * @param string $name + * @param Array $arguments + * @return mixed + */ + public function __call($name, $arguments) + { + $command = $this->driver->executeCommand($this, $name, $arguments); + return $command->hasOutput() ? $command->getOutput() : $this; + } + + /** + * Starts encoding of current image + * + * @param string $format + * @param integer $quality + * @return \Intervention\Image\Image + */ + public function encode($format = null, $quality = 90) + { + return $this->driver->encode($this, $format, $quality); + } + + /** + * Saves encoded image in filesystem + * + * @param string $path + * @param integer $quality + * @return \Intervention\Image\Image + */ + public function save($path = null, $quality = null) + { + $path = is_null($path) ? $this->basePath() : $path; + + if (is_null($path)) { + throw new Exception\NotWritableException( + "Can't write to undefined path." + ); + } + + $data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality); + $saved = @file_put_contents($path, $data); + + if ($saved === false) { + throw new Exception\NotWritableException( + "Can't write image data to path ({$path})" + ); + } + + // set new file info + $this->setFileInfoFromPath($path); + + return $this; + } + + /** + * Runs a given filter on current image + * + * @param FiltersFilterInterface $filter + * @return \Intervention\Image\Image + */ + public function filter(Filters\FilterInterface $filter) + { + return $filter->applyFilter($this); + } + + /** + * Returns current image driver + * + * @return \Intervention\Image\AbstractDriver + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Sets current image driver + * @param AbstractDriver $driver + */ + public function setDriver(AbstractDriver $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * Returns current image resource/obj + * + * @return mixed + */ + public function getCore() + { + return $this->core; + } + + /** + * Sets current image resource + * + * @param mixed $core + */ + public function setCore($core) + { + $this->core = $core; + + return $this; + } + + /** + * Returns current image backup + * + * @param string $name + * @return mixed + */ + public function getBackup($name = null) + { + $name = is_null($name) ? 'default' : $name; + + if ( ! $this->backupExists($name)) { + throw new \Intervention\Image\Exception\RuntimeException( + "Backup with name ({$name}) not available. Call backup() before reset()." + ); + } + + return $this->backups[$name]; + } + + /** + * Returns all backups attached to image + * + * @return array + */ + public function getBackups() + { + return $this->backups; + } + + /** + * Sets current image backup + * + * @param mixed $resource + * @param string $name + * @return self + */ + public function setBackup($resource, $name = null) + { + $name = is_null($name) ? 'default' : $name; + + $this->backups[$name] = $resource; + + return $this; + } + + /** + * Checks if named backup exists + * + * @param string $name + * @return bool + */ + private function backupExists($name) + { + return array_key_exists($name, $this->backups); + } + + /** + * Checks if current image is already encoded + * + * @return boolean + */ + public function isEncoded() + { + return ! empty($this->encoded); + } + + /** + * Returns encoded image data of current image + * + * @return string + */ + public function getEncoded() + { + return $this->encoded; + } + + /** + * Sets encoded image buffer + * + * @param string $value + */ + public function setEncoded($value) + { + $this->encoded = $value; + + return $this; + } + + /** + * Calculates current image width + * + * @return integer + */ + public function getWidth() + { + return $this->getSize()->width; + } + + /** + * Alias of getWidth() + * + * @return integer + */ + public function width() + { + return $this->getWidth(); + } + + /** + * Calculates current image height + * + * @return integer + */ + public function getHeight() + { + return $this->getSize()->height; + } + + /** + * Alias of getHeight + * + * @return integer + */ + public function height() + { + return $this->getHeight(); + } + + /** + * Reads mime type + * + * @return string + */ + public function mime() + { + return $this->mime; + } + + /** + * Returns encoded image data in string conversion + * + * @return string + */ + public function __toString() + { + return $this->encoded; + } + + /** + * Cloning an image + */ + public function __clone() + { + $this->core = $this->driver->cloneCore($this->core); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManager.php b/vendor/intervention/image/src/Intervention/Image/ImageManager.php new file mode 100644 index 0000000..168949e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManager.php @@ -0,0 +1,139 @@ + 'gd' + 'driver' => 'imagick' + ); + + /** + * Creates new instance of Image Manager + * + * @param array $config + */ + public function __construct(array $config = array()) + { + $this->checkRequirements(); + $this->configure($config); + } + + /** + * Overrides configuration settings + * + * @param array $config + */ + public function configure(array $config = array()) + { + $this->config = array_replace($this->config, $config); + + return $this; + } + + /** + * Initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + */ + public function make($data) + { + return $this->createDriver()->init($data); + } + + /** + * Creates an empty image canvas + * + * @param integer $width + * @param integer $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public function canvas($width, $height, $background = null) + { + return $this->createDriver()->newImage($width, $height, $background); + } + + /** + * Create new cached image and run callback + * (requires additional package intervention/imagecache) + * + * @param Closure $callback + * @param integer $lifetime + * @param boolean $returnObj + * + * @return Image + */ + public function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + if (class_exists('Intervention\\Image\\ImageCache')) { + // create imagecache + $imagecache = new ImageCache($this); + + // run callback + if (is_callable($callback)) { + $callback($imagecache); + } + + return $imagecache->get($lifetime, $returnObj); + } + + throw new \Intervention\Image\Exception\MissingDependencyException( + "Please install package intervention/imagecache before running this function." + ); + } + + /** + * Creates a driver instance according to config settings + * + * @return \Intervention\Image\AbstractDriver + */ + private function createDriver() + { + if (is_string($this->config['driver'])) { + $drivername = ucfirst($this->config['driver']); + $driverclass = sprintf('Intervention\\Image\\%s\\Driver', $drivername); + + if (class_exists($driverclass)) { + return new $driverclass; + } + + throw new \Intervention\Image\Exception\NotSupportedException( + "Driver ({$drivername}) could not be instantiated." + ); + } + + if ($this->config['driver'] instanceof AbstractDriver) { + return $this->config['driver']; + } + + throw new \Intervention\Image\Exception\NotSupportedException( + "Unknown driver type." + ); + } + + /** + * Check if all requirements are available + * + * @return void + */ + private function checkRequirements() + { + if ( ! function_exists('finfo_buffer')) { + throw new \Intervention\Image\Exception\MissingDependencyException( + "PHP Fileinfo extension must be installed/enabled to use Intervention Image." + ); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php new file mode 100644 index 0000000..3088bf5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php @@ -0,0 +1,87 @@ +configure($config); + } + + /** + * Statically initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + */ + public static function make($data) + { + return self::getManager()->make($data); + } + + /** + * Statically creates an empty image canvas + * + * @param integer $width + * @param integer $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public static function canvas($width, $height, $background = null) + { + return self::getManager()->canvas($width, $height, $background); + } + + /** + * Create new cached image and run callback statically + * + * @param Closure $callback + * @param integer $lifetime + * @param boolean $returnObj + * + * @return mixed + */ + public static function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + return self::getManager()->cache($callback, $lifetime, $returnObj); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php new file mode 100644 index 0000000..e61e6a4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php @@ -0,0 +1,85 @@ +provider = $this->getProvider(); + } + + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + if (method_exists($this->provider, 'boot')) { + return $this->provider->boot(); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + return $this->provider->register(); + } + + /** + * Return ServiceProvider according to Laravel version + * + * @return \Intervention\Image\Provider\ProviderInterface + */ + private function getProvider() + { + if ($this->app instanceof \Laravel\Lumen\Application) { + $provider = '\Intervention\Image\ImageServiceProviderLumen'; + } elseif (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) { + $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; + } else { + $provider = '\Intervention\Image\ImageServiceProviderLaravel5'; + } + + return new $provider($this->app); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('image'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php new file mode 100644 index 0000000..6c73a20 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php @@ -0,0 +1,112 @@ +package('intervention/image'); + + // try to create imagecache route only if imagecache is present + if (class_exists('Intervention\\Image\\ImageCache')) { + + $app = $this->app; + + // load imagecache config + $app['config']->package('intervention/imagecache', __DIR__.'/../../../../imagecache/src/config', 'imagecache'); + $config = $app['config']; + + // create dynamic manipulation route + if (is_string($config->get('imagecache::route'))) { + + // add original to route templates + $config->set('imagecache::templates.original', null); + + // setup image manipulator route + $app['router']->get($config->get('imagecache::route').'/{template}/{filename}', array('as' => 'imagecache', function ($template, $filename) use ($app, $config) { + + // disable session cookies for image route + $app['config']->set('session.driver', 'array'); + + // find file + foreach ($config->get('imagecache::paths') as $path) { + // don't allow '..' in filenames + $image_path = $path.'/'.str_replace('..', '', $filename); + if (file_exists($image_path) && is_file($image_path)) { + break; + } else { + $image_path = false; + } + } + + // abort if file not found + if ($image_path === false) { + $app->abort(404); + } + + // define template callback + $callback = $config->get("imagecache::templates.{$template}"); + + if (is_callable($callback) || class_exists($callback)) { + + // image manipulation based on callback + $content = $app['image']->cache(function ($image) use ($image_path, $callback) { + + switch (true) { + case is_callable($callback): + return $callback($image->make($image_path)); + break; + + case class_exists($callback): + return $image->make($image_path)->filter(new $callback); + break; + } + + }, $config->get('imagecache::lifetime')); + + } else { + + // get original image file contents + $content = file_get_contents($image_path); + } + + // define mime type + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content); + + // return http response + return new IlluminateResponse($content, 200, array( + 'Content-Type' => $mime, + 'Cache-Control' => 'max-age='.($config->get('imagecache::lifetime')*60).', public', + 'Etag' => md5($content) + )); + + }))->where(array('template' => join('|', array_keys($config->get('imagecache::templates'))), 'filename' => '[ \w\\.\\/\\-]+')); + } + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + $app['image'] = $app->share(function ($app) { + return new ImageManager($app['config']->get('image::config')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php new file mode 100644 index 0000000..04cfc22 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php @@ -0,0 +1,89 @@ +publishes(array( + __DIR__.'/../../config/config.php' => config_path('image.php') + )); + + // setup intervention/imagecache if package is installed + $this->cacheIsInstalled() ? $this->bootstrapImageCache() : null; + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // create image + $app->singleton('image', function ($app) { + return new ImageManager($app['config']->get('image')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } + + /** + * Bootstrap imagecache + * + * @return void + */ + private function bootstrapImageCache() + { + $app = $this->app; + $config = __DIR__.'/../../../../imagecache/src/config/config.php'; + + $this->publishes(array( + $config => config_path('imagecache.php') + )); + + // merge default config + $this->mergeConfigFrom( + $config, + 'imagecache' + ); + + // imagecache route + if (is_string(config('imagecache.route'))) { + + $filename_pattern = '[ \w\\.\\/\\-\\@\(\)]+'; + + // route to access template applied image file + $app['router']->get(config('imagecache.route').'/{template}/{filename}', array( + 'uses' => 'Intervention\Image\ImageCacheController@getResponse', + 'as' => 'imagecache' + ))->where(array('filename' => $filename_pattern)); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php new file mode 100644 index 0000000..621ccd1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php @@ -0,0 +1,42 @@ +config = $config; + } + + /** + * Register the server provider. + * + * @return void + */ + public function register() + { + $this->getContainer()->share('Intervention\Image\ImageManager', function () { + return new ImageManager($this->config); + }); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php new file mode 100644 index 0000000..4a381cc --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php @@ -0,0 +1,34 @@ +app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // set configuration + $app->configure('image'); + + // create image + $app->singleton('image',function ($app) { + return new ImageManager($app['config']->get('image')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php new file mode 100644 index 0000000..3940993 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php @@ -0,0 +1,277 @@ +> 24) & 0xFF; + $r = ($value >> 16) & 0xFF; + $g = ($value >> 8) & 0xFF; + $b = $value & 0xFF; + $a = $this->rgb2alpha($a); + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $a = 1; + } + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given string + * + * @param string $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->setPixel($color[0], $color[1], $color[2], $color[3]); + } + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + if (is_a($value, '\ImagickPixel')) { + $this->pixel = $value; + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param integer $r + * @param integer $g + * @param integer $b + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->setPixel($r, $g, $b); + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param integer $r + * @param integer $g + * @param integer $b + * @param float $a + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a) + { + $this->setPixel($r, $g, $b, $a); + } + + /** + * Calculates integer value of current color instance + * + * @return integer + */ + public function getInt() + { + $r = $this->getRedValue(); + $g = $this->getGreenValue(); + $b = $this->getBlueValue(); + $a = intval(round($this->getAlphaValue() * 255)); + + return intval(($a << 24) + ($r << 16) + ($g << 8) + $b); + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue() + ); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return array( + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ); + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param integer $tolerance + * @return boolean + */ + public function differs(\Intervention\Image\AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance); + + $delta = array( + 'r' => abs($color->getRedValue() - $this->getRedValue()), + 'g' => abs($color->getGreenValue() - $this->getGreenValue()), + 'b' => abs($color->getBlueValue() - $this->getBlueValue()), + 'a' => abs($color->getAlphaValue() - $this->getAlphaValue()) + ); + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Returns RGB red value of current color + * + * @return integer + */ + public function getRedValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_RED) * 255)); + } + + /** + * Returns RGB green value of current color + * + * @return integer + */ + public function getGreenValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_GREEN) * 255)); + } + + /** + * Returns RGB blue value of current color + * + * @return integer + */ + public function getBlueValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_BLUE) * 255)); + } + + /** + * Returns RGB alpha value of current color + * + * @return float + */ + public function getAlphaValue() + { + return round($this->pixel->getColorValue(\Imagick::COLOR_ALPHA), 2); + } + + /** + * Initiates ImagickPixel from given RGBA values + * + * @return \ImagickPixel + */ + private function setPixel($r, $g, $b, $a = null) + { + $a = is_null($a) ? 1 : $a; + + return $this->pixel = new \ImagickPixel( + sprintf('rgba(%d, %d, %d, %.2F)', $r, $g, $b, $a) + ); + } + + /** + * Returns current color as ImagickPixel + * + * @return \ImagickPixel + */ + public function getPixel() + { + return $this->pixel; + } + + /** + * Calculates RGA integer alpha value into float value + * + * @param integer $value + * @return float + */ + private function rgb2alpha($value) + { + // (255 -> 1.0) / (0 -> 0.0) + return (float) round($value/255, 2); + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php new file mode 100644 index 0000000..90f2d72 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php @@ -0,0 +1,22 @@ +argument(0)->value(); + + // clone current image resource + $image->setBackup(clone $image->getCore(), $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php new file mode 100644 index 0000000..b037c15 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(0, 100)->value(1); + + return $image->getCore()->blurImage(1 * $amount, 0.5 * $amount); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php new file mode 100644 index 0000000..eefb180 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->modulateImage(100 + $level, 100, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php new file mode 100644 index 0000000..51142be --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php @@ -0,0 +1,42 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = $this->normalizeLevel($red); + $green = $this->normalizeLevel($green); + $blue = $this->normalizeLevel($blue); + + $qrange = $image->getCore()->getQuantumRange(); + + // apply + $image->getCore()->levelImage(0, $red, $qrange['quantumRangeLong'], \Imagick::CHANNEL_RED); + $image->getCore()->levelImage(0, $green, $qrange['quantumRangeLong'], \Imagick::CHANNEL_GREEN); + $image->getCore()->levelImage(0, $blue, $qrange['quantumRangeLong'], \Imagick::CHANNEL_BLUE); + + return true; + } + + private function normalizeLevel($level) + { + if ($level > 0) { + return $level/5; + } else { + return ($level+100)/100; + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php new file mode 100644 index 0000000..113a218 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->sigmoidalContrastImage($level > 0, $level / 4, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php new file mode 100644 index 0000000..21c7184 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php @@ -0,0 +1,43 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + $image->getCore()->cropImage($cropped->width, $cropped->height, $position->x, $position->y); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php new file mode 100644 index 0000000..28b9a4c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php @@ -0,0 +1,25 @@ +getCore()->clear(); + + // destroy backups + foreach ($image->getBackups() as $backup) { + $backup->clear(); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php new file mode 100644 index 0000000..924522c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php @@ -0,0 +1,62 @@ +preferExtension = false; + } + + /** + * Read Exif data from the given image + * + * @param \Intervention\Image\Image $image + * @return boolean + */ + public function execute($image) + { + if ($this->preferExtension && function_exists('exif_read_data')) { + return parent::execute($image); + } + + $core = $image->getCore(); + + if ( ! method_exists($core, 'getImageProperties')) { + throw new \Intervention\Image\Exception\NotSupportedException( + "Reading Exif data is not supported by this PHP installation." + ); + } + + $requestedKey = $this->argument(0)->value(); + if ($requestedKey !== null) { + $this->setOutput($core->getImageProperty('exif:' . $requestedKey)); + return true; + } + + $exif = []; + $properties = $core->getImageProperties(); + foreach ($properties as $key => $value) { + if (substr($key, 0, 5) !== 'exif:') { + continue; + } + + $exif[substr($key, 5)] = $value; + } + + $this->setOutput($exif); + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php new file mode 100644 index 0000000..bfac75f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php @@ -0,0 +1,103 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $imagick = $image->getCore(); + + try { + // set image filling + $source = new Decoder; + $filling = $source->init($filling); + + } catch (\Intervention\Image\Exception\NotReadableException $e) { + + // set solid color filling + $filling = new Color($filling); + } + + // flood fill if coordinates are set + if (is_int($x) && is_int($y)) { + + // flood fill with texture + if ($filling instanceof Image) { + + // create tile + $tile = clone $image->getCore(); + + // mask away color at position + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // create canvas + $canvas = clone $image->getCore(); + + // fill canvas with texture + $canvas = $canvas->textureImage($filling->getCore()); + + // merge canvas and tile + $canvas->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // replace image core + $image->setCore($canvas); + + // flood fill with color + } elseif ($filling instanceof Color) { + + // create canvas with filling + $canvas = new \Imagick; + $canvas->newImage($image->getWidth(), $image->getHeight(), $filling->getPixel(), 'png'); + + // create tile to put on top + $tile = clone $image->getCore(); + + // mask away color at pos. + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // save alpha channel of original image + $alpha = clone $image->getCore(); + + // merge original with canvas and tile + $image->getCore()->compositeImage($canvas, \Imagick::COMPOSITE_DEFAULT, 0, 0); + $image->getCore()->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // restore alpha channel of original image + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + } + + } else { + + if ($filling instanceof Image) { + + // fill whole image with texture + $image->setCore($image->getCore()->textureImage($filling->getCore())); + + } elseif ($filling instanceof Color) { + + // fill whole image with color + $draw = new \ImagickDraw(); + $draw->setFillColor($filling->getPixel()); + $draw->rectangle(0, 0, $image->getWidth(), $image->getHeight()); + $image->getCore()->drawImage($draw); + } + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php new file mode 100644 index 0000000..f2c60d2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php @@ -0,0 +1,41 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // crop image + $image->getCore()->cropImage( + $cropped->width, + $cropped->height, + $cropped->pivot->x, + $cropped->pivot->y + ); + + // resize image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php new file mode 100644 index 0000000..746650c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php @@ -0,0 +1,25 @@ +argument(0)->value('h'); + + if (in_array(strtolower($mode), array(2, 'v', 'vert', 'vertical'))) { + // flip vertical + return $image->getCore()->flipImage(); + } else { + // flip horizontal + return $image->getCore()->flopImage(); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php new file mode 100644 index 0000000..e70cbdd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php @@ -0,0 +1,19 @@ +argument(0)->type('numeric')->required()->value(); + + return $image->getCore()->gammaImage($gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php new file mode 100644 index 0000000..65b1078 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php @@ -0,0 +1,27 @@ +getCore(); + + $this->setOutput(new Size( + $core->getImageWidth(), + $core->getImageHeight() + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php new file mode 100644 index 0000000..bb3f472 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php @@ -0,0 +1,17 @@ +getCore()->modulateImage(100, 0, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php new file mode 100644 index 0000000..9d10973 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php new file mode 100644 index 0000000..542feb2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php @@ -0,0 +1,31 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + return $image->getCore()->compositeImage($watermark->getCore(), \Imagick::COMPOSITE_DEFAULT, $target->x, $target->y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php new file mode 100644 index 0000000..82cddd4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php @@ -0,0 +1,27 @@ +argument(0)->type('bool')->value(true); + + if ($mode) { + $mode = \Imagick::INTERLACE_LINE; + } else { + $mode = \Imagick::INTERLACE_NO; + } + + $image->getCore()->setInterlaceScheme($mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php new file mode 100644 index 0000000..125fbdd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php @@ -0,0 +1,17 @@ +getCore()->negateImage(false); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php new file mode 100644 index 0000000..7308180 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php @@ -0,0 +1,57 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // build 2 color alpha mask from original alpha + $alpha = clone $image->getCore(); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->transparentPaintImage('#ffffff', 0, 0, false); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->negateImage(false); + + if ($matte) { + + // get matte color + $mattecolor = $image->getDriver()->parseColor($matte)->getPixel(); + + // create matte image + $canvas = new \Imagick; + $canvas->newImage($size->width, $size->height, $mattecolor, 'png'); + + // lower colors of original and copy to matte + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $canvas->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // copy new alpha to canvas + $canvas->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // replace core + $image->setCore($canvas); + + } else { + + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + } + + return true; + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php new file mode 100644 index 0000000..2dfc697 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php @@ -0,0 +1,58 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + // get imagick + $imagick = $image->getCore(); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + + // resize mask to size of current image (if necessary) + $image_size = $image->getSize(); + if ($mask->getSize() != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + $imagick->setImageMatte(true); + + if ($mask_w_alpha) { + + // just mask with alpha map + $imagick->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DSTIN, 0, 0); + + } else { + + // get alpha channel of original as greyscale image + $original_alpha = clone $imagick; + $original_alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + + // use red channel from mask ask alpha + $mask_alpha = clone $mask->getCore(); + $mask_alpha->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + // $mask_alpha->setImageAlphaChannel(\Imagick::ALPHACHANNEL_DEACTIVATE); + $mask_alpha->separateImageChannel(\Imagick::CHANNEL_ALL); + + // combine both alphas from original and mask + $original_alpha->compositeImage($mask_alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // mask the image with the alpha combination + $imagick->compositeImage($original_alpha, \Imagick::COMPOSITE_DSTIN, 0, 0); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php new file mode 100644 index 0000000..57ed006 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(0, 100)->required()->value(); + + $transparency = $transparency > 0 ? (100 / $transparency) : 1000; + + return $image->getCore()->evaluateImage(\Imagick::EVALUATE_DIVIDE, $transparency, \Imagick::CHANNEL_ALPHA); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php new file mode 100644 index 0000000..8daa0f9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php @@ -0,0 +1,29 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = new Color($image->getCore()->getImagePixelColor($x, $y)); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php new file mode 100644 index 0000000..b9e6d39 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php @@ -0,0 +1,30 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + // prepare pixel + $draw = new \ImagickDraw; + $draw->setFillColor($color->getPixel()); + $draw->point($x, $y); + + // apply pixel + return $image->getCore()->drawImage($draw); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php new file mode 100644 index 0000000..75f2218 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php @@ -0,0 +1,25 @@ +argument(0)->type('digit')->value(10); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size))); + $image->getCore()->scaleImage($width, $height); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php new file mode 100644 index 0000000..ee5a2cd --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php @@ -0,0 +1,37 @@ +argument(0)->value(); + + $backup = $image->getBackup($backupName); + + if ($backup instanceof \Imagick) { + + // destroy current core + $image->getCore()->clear(); + + // clone backup + $backup = clone $backup; + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new \Intervention\Image\Exception\RuntimeException( + "Backup not available. Call backup({$backupName}) before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php new file mode 100644 index 0000000..f394c15 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -0,0 +1,89 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $rect = new \ImagickDraw; + $fill = $canvas->pickColor(0, 0, 'hex'); + $fill = $fill == '#ff0000' ? '#00ff00' : '#ff0000'; + $rect->setFillColor($fill); + $rect->rectangle($dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1); + $canvas->getCore()->drawImage($rect); + $canvas->getCore()->transparentPaintImage($fill, 0, 0, false); + + $canvas->getCore()->setImageColorspace($image->getCore()->getImageColorspace()); + + // copy image into new canvas + $image->getCore()->cropImage($src_w, $src_h, $src_x, $src_y); + $canvas->getCore()->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, $dst_x, $dst_y); + $canvas->getCore()->setImagePage(0,0,0,0); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php new file mode 100644 index 0000000..9ccc202 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php @@ -0,0 +1,27 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php new file mode 100644 index 0000000..3d0eb99 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php @@ -0,0 +1,26 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // rotate image + $image->getCore()->rotateImage($color->getPixel(), ($angle * -1)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php new file mode 100644 index 0000000..4f2fc8c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php @@ -0,0 +1,19 @@ +argument(0)->between(0, 100)->value(10); + + return $image->getCore()->unsharpMaskImage(1, 1, $amount / 6.25, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php new file mode 100644 index 0000000..f2ee46a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php @@ -0,0 +1,120 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = array('top', 'right', 'bottom', 'left'); + } elseif (is_string($away)) { + $away = array($away); + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $base_color = new Color; // color will only be used to compare alpha channel + } else { + $base_color = $image->pickColor($base_x, $base_y, 'object'); + } + + // trim on clone to get only coordinates + $trimed = clone $image->getCore(); + + // add border to trim specific color + $trimed->borderImage($base_color->getPixel(), 1, 1); + + // trim image + $trimed->trimImage(65850 / 100 * $tolerance); + + // get coordinates of trim + $imagePage = $trimed->getImagePage(); + list($crop_x, $crop_y) = array($imagePage['x']-1, $imagePage['y']-1); + // $trimed->setImagePage(0, 0, 0, 0); + list($crop_width, $crop_height) = array($trimed->width, $trimed->height); + + // adjust settings if right should not be trimed + if ( ! in_array('right', $away)) { + $crop_width = $crop_width + ($width - ($width - $crop_x)); + } + + // adjust settings if bottom should not be trimed + if ( ! in_array('bottom', $away)) { + $crop_height = $crop_height + ($height - ($height - $crop_y)); + } + + // adjust settings if left should not be trimed + if ( ! in_array('left', $away)) { + $crop_width = $crop_width + $crop_x; + $crop_x = 0; + } + + // adjust settings if top should not be trimed + if ( ! in_array('top', $away)) { + $crop_height = $crop_height + $crop_y; + $crop_y = 0; + } + + // add feather + $crop_width = min($width, ($crop_width + $feather * 2)); + $crop_height = min($height, ($crop_height + $feather * 2)); + $crop_x = max(0, ($crop_x - $feather)); + $crop_y = max(0, ($crop_y - $feather)); + + // finally crop based on page + $image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y); + $image->getCore()->setImagePage(0,0,0,0); + + $trimed->destroy(); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php new file mode 100644 index 0000000..467fe80 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php new file mode 100644 index 0000000..6b2b40d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php @@ -0,0 +1,120 @@ +setBackgroundColor(new \ImagickPixel('transparent')); + $core->readImage($path); + $core->setImageType(defined('\Imagick::IMGTYPE_TRUECOLORALPHA') ? \Imagick::IMGTYPE_TRUECOLORALPHA : \Imagick::IMGTYPE_TRUECOLORMATTE); + + } catch (\ImagickException $e) { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to read image from path ({$path}).", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + throw new \Intervention\Image\Exception\NotSupportedException( + 'Imagick driver is unable to init from GD resource.' + ); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + // currently animations are not supported + // so all images are turned into static + $object = $this->removeAnimation($object); + + // reset image orientation + $object->setImageOrientation(\Imagick::ORIENTATION_UNDEFINED); + + return new Image(new Driver, $object); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $core = new \Imagick; + + try { + + $core->readImageBlob($binary); + + } catch (\ImagickException $e) { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to read image from binary data.", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Turns object into one frame Imagick object + * by removing all frames except first + * + * @param Imagick $object + * @return Imagick + */ + private function removeAnimation(\Imagick $object) + { + $imagick = new \Imagick; + + foreach ($object as $frame) { + $imagick->addImage($frame->getImage()); + break; + } + + $object->destroy(); + + return $imagick; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php new file mode 100644 index 0000000..1c72e5a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php @@ -0,0 +1,70 @@ +coreAvailable()) { + throw new \Intervention\Image\Exception\NotSupportedException( + "ImageMagick module not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param integer $width + * @param integer $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + $background = new Color($background); + + // create empty core + $core = new \Imagick; + $core->newImage($width, $height, $background->getPixel(), 'png'); + $core->setType(\Imagick::IMGTYPE_UNDEFINED); + $core->setImageType(\Imagick::IMGTYPE_UNDEFINED); + $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED); + + // build image + $image = new \Intervention\Image\Image(new static, $core); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('imagick') && class_exists('Imagick')); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php new file mode 100644 index 0000000..44452f2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php @@ -0,0 +1,168 @@ +image->getCore(); + $imagick->setImageBackgroundColor('white'); + $imagick->setBackgroundColor('white'); + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + $format = 'png'; + $compression = \Imagick::COMPRESSION_ZIP; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + $format = 'gif'; + $compression = \Imagick::COMPRESSION_LZW; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + protected function processWebp() + { + if ( ! \Imagick::queryFormats('WEBP')) { + throw new \Intervention\Image\Exception\NotSupportedException( + "Webp format is not supported by Imagick installation." + ); + } + + $format = 'webp'; + $compression = \Imagick::COMPRESSION_JPEG; + + $imagick = $this->image->getCore(); + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + $format = 'tiff'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + $format = 'bmp'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + $format = 'ico'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + $format = 'psd'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php new file mode 100644 index 0000000..9ae2f97 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php @@ -0,0 +1,78 @@ +setStrokeAntialias(true); + $draw->setTextAntialias(true); + + // set font file + if ($this->hasApplicableFontFile()) { + $draw->setFont($this->file); + } else { + throw new \Intervention\Image\Exception\RuntimeException( + "Font file must be provided to apply text to image." + ); + } + + // parse text color + $color = new Color($this->color); + + $draw->setFontSize($this->size); + $draw->setFillColor($color->getPixel()); + + // align horizontal + switch (strtolower($this->align)) { + case 'center': + $align = \Imagick::ALIGN_CENTER; + break; + + case 'right': + $align = \Imagick::ALIGN_RIGHT; + break; + + default: + $align = \Imagick::ALIGN_LEFT; + break; + } + + $draw->setTextAlignment($align); + + // align vertical + if (strtolower($this->valign) != 'bottom') { + + // calculate box size + $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text); + + // corrections on y-position + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + $posy = $posy + $dimensions['textHeight'] * 0.65 / 2; + break; + + case 'top': + $posy = $posy + $dimensions['textHeight'] * 0.65; + break; + } + } + + // apply to image + $image->getCore()->annotateImage($draw, $posx, $posy, $this->angle * (-1), $this->text); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php new file mode 100644 index 0000000..ebf85a9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php new file mode 100644 index 0000000..a543124 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php @@ -0,0 +1,65 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $circle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $circle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $circle->setStrokeWidth($this->border_width); + $circle->setStrokeColor($border_color->getPixel()); + } + + $circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360); + + $image->getCore()->drawImage($circle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php new file mode 100644 index 0000000..3e40363 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php @@ -0,0 +1,93 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param integer $width + * @return void + */ + public function width($width) + { + $this->width = $width; + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $line = new \ImagickDraw; + + $color = new Color($this->color); + $line->setStrokeColor($color->getPixel()); + $line->setStrokeWidth($this->width); + + $line->line($this->x, $this->y, $x, $y); + $image->getCore()->drawImage($line); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php new file mode 100644 index 0000000..1fa167d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php @@ -0,0 +1,80 @@ +points = $this->formatPoints($points); + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $polygon = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $polygon->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $polygon->setStrokeWidth($this->border_width); + $polygon->setStrokeColor($border_color->getPixel()); + } + + $polygon->polygon($this->points); + + $image->getCore()->drawImage($polygon); + + return true; + } + + /** + * Format polygon points to Imagick format + * + * @param Array $points + * @return Array + */ + private function formatPoints($points) + { + $ipoints = array(); + $count = 1; + + foreach ($points as $key => $value) { + if ($count%2 === 0) { + $y = $value; + $ipoints[] = array('x' => $x, 'y' => $y); + } else { + $x = $value; + } + $count++; + } + + return $ipoints; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php new file mode 100644 index 0000000..ad23019 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php @@ -0,0 +1,83 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param integer $x + * @param integer $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $rectangle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $rectangle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $rectangle->setStrokeWidth($this->border_width); + $rectangle->setStrokeColor($border_color->getPixel()); + } + + $rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2); + + $image->getCore()->drawImage($rectangle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Point.php b/vendor/intervention/image/src/Intervention/Image/Point.php new file mode 100644 index 0000000..bb17fb7 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Point.php @@ -0,0 +1,64 @@ +x = is_numeric($x) ? intval($x) : 0; + $this->y = is_numeric($y) ? intval($y) : 0; + } + + /** + * Sets X coordinate + * + * @param integer $x + */ + public function setX($x) + { + $this->x = intval($x); + } + + /** + * Sets Y coordinate + * + * @param integer $y + */ + public function setY($y) + { + $this->y = intval($y); + } + + /** + * Sets both X and Y coordinate + * + * @param integer $x + * @param integer $y + */ + public function setPosition($x, $y) + { + $this->setX($x); + $this->setY($y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Response.php b/vendor/intervention/image/src/Intervention/Image/Response.php new file mode 100644 index 0000000..ce27e79 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Response.php @@ -0,0 +1,69 @@ +image = $image; + $this->format = $format ? $format : $image->mime; + $this->quality = $quality ? $quality : 90; + } + + /** + * Builds response according to settings + * + * @return mixed + */ + public function make() + { + $this->image->encode($this->format, $this->quality); + $data = $this->image->getEncoded(); + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data); + $length = strlen($data); + + if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) { + + $response = \Illuminate\Support\Facades\Response::make($data); + $response->header('Content-Type', $mime); + $response->header('Content-Length', $length); + + } else { + + header('Content-Type: ' . $mime); + header('Content-Length: ' . $length); + $response = $data; + } + + return $response; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Size.php b/vendor/intervention/image/src/Intervention/Image/Size.php new file mode 100644 index 0000000..f2babe1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Size.php @@ -0,0 +1,373 @@ +width = is_numeric($width) ? intval($width) : 1; + $this->height = is_numeric($height) ? intval($height) : 1; + $this->pivot = $pivot ? $pivot : new Point; + } + + /** + * Set the width and height absolutely + * + * @param integer $width + * @param integer $height + */ + public function set($width, $height) + { + $this->width = $width; + $this->height = $height; + } + + /** + * Set current pivot point + * + * @param Point $point + */ + public function setPivot(Point $point) + { + $this->pivot = $point; + } + + /** + * Get the current width + * + * @return integer + */ + public function getWidth() + { + return $this->width; + } + + /** + * Get the current height + * + * @return integer + */ + public function getHeight() + { + return $this->height; + } + + /** + * Calculate the current aspect ratio + * + * @return float + */ + public function getRatio() + { + return $this->width / $this->height; + } + + /** + * Resize to desired width and/or height + * + * @param integer $width + * @param integer $height + * @param Closure $callback + * @return Size + */ + public function resize($width, $height, Closure $callback = null) + { + if (is_null($width) && is_null($height)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "Width or height needs to be defined." + ); + } + + // new size with dominant width + $dominant_w_size = clone $this; + $dominant_w_size->resizeHeight($height, $callback); + $dominant_w_size->resizeWidth($width, $callback); + + // new size with dominant height + $dominant_h_size = clone $this; + $dominant_h_size->resizeWidth($width, $callback); + $dominant_h_size->resizeHeight($height, $callback); + + // decide which size to use + if ($dominant_h_size->fitsInto(new self($width, $height))) { + $this->set($dominant_h_size->width, $dominant_h_size->height); + } else { + $this->set($dominant_w_size->width, $dominant_w_size->height); + } + + return $this; + } + + /** + * Scale size according to given constraints + * + * @param integer $width + * @param Closure $callback + * @return Size + */ + private function resizeWidth($width, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($width)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($width > $max_width) ? $max_width : $width; + } else { + $this->width = $width; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $h = intval(round($this->width / $constraint->getSize()->getRatio())); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($h > $max_height) ? $max_height : $h; + } else { + $this->height = $h; + } + } + } + } + + /** + * Scale size according to given constraints + * + * @param integer $height + * @param Closure $callback + * @return Size + */ + private function resizeHeight($height, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($height)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($height > $max_height) ? $max_height : $height; + } else { + $this->height = $height; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $w = intval(round($this->height * $constraint->getSize()->getRatio())); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($w > $max_width) ? $max_width : $w; + } else { + $this->width = $w; + } + } + } + } + + /** + * Calculate the relative position to another Size + * based on the pivot point settings of both sizes. + * + * @param Size $size + * @return \Intervention\Image\Point + */ + public function relativePosition(Size $size) + { + $x = $this->pivot->x - $size->pivot->x; + $y = $this->pivot->y - $size->pivot->y; + + return new Point($x, $y); + } + + /** + * Resize given Size to best fitting size of current size. + * + * @param Size $size + * @return \Intervention\Image\Size + */ + public function fit(Size $size, $position = 'center') + { + // create size with auto height + $auto_height = clone $size; + + $auto_height->resize($this->width, null, function ($constraint) { + $constraint->aspectRatio(); + }); + + // decide which version to use + if ($auto_height->fitsInto($this)) { + + $size = $auto_height; + + } else { + + // create size with auto width + $auto_width = clone $size; + + $auto_width->resize(null, $this->height, function ($constraint) { + $constraint->aspectRatio(); + }); + + $size = $auto_width; + } + + $this->align($position); + $size->align($position); + $size->setPivot($this->relativePosition($size)); + + return $size; + } + + /** + * Checks if given size fits into current size + * + * @param Size $size + * @return boolean + */ + public function fitsInto(Size $size) + { + return ($this->width <= $size->width) && ($this->height <= $size->height); + } + + /** + * Aligns current size's pivot point to given position + * and moves point automatically by offset. + * + * @param string $position + * @param integer $offset_x + * @param integer $offset_y + * @return \Intervention\Image\Size + */ + public function align($position, $offset_x = 0, $offset_y = 0) + { + switch (strtolower($position)) { + + case 'top': + case 'top-center': + case 'top-middle': + case 'center-top': + case 'middle-top': + $x = intval($this->width / 2); + $y = 0 + $offset_y; + break; + + case 'top-right': + case 'right-top': + $x = $this->width - $offset_x; + $y = 0 + $offset_y; + break; + + case 'left': + case 'left-center': + case 'left-middle': + case 'center-left': + case 'middle-left': + $x = 0 + $offset_x; + $y = intval($this->height / 2); + break; + + case 'right': + case 'right-center': + case 'right-middle': + case 'center-right': + case 'middle-right': + $x = $this->width - $offset_x; + $y = intval($this->height / 2); + break; + + case 'bottom-left': + case 'left-bottom': + $x = 0 + $offset_x; + $y = $this->height - $offset_y; + break; + + case 'bottom': + case 'bottom-center': + case 'bottom-middle': + case 'center-bottom': + case 'middle-bottom': + $x = intval($this->width / 2); + $y = $this->height - $offset_y; + break; + + case 'bottom-right': + case 'right-bottom': + $x = $this->width - $offset_x; + $y = $this->height - $offset_y; + break; + + case 'center': + case 'middle': + case 'center-center': + case 'middle-middle': + $x = intval($this->width / 2); + $y = intval($this->height / 2); + break; + + default: + case 'top-left': + case 'left-top': + $x = 0 + $offset_x; + $y = 0 + $offset_y; + break; + } + + $this->pivot->setPosition($x, $y); + + return $this; + } + + /** + * Runs constraints on current size + * + * @param Closure $callback + * @return \Intervention\Image\Constraint + */ + private function getConstraint(Closure $callback = null) + { + $constraint = new Constraint(clone $this); + + if (is_callable($callback)) { + $callback($constraint); + } + + return $constraint; + } +} diff --git a/vendor/intervention/image/src/config/config.php b/vendor/intervention/image/src/config/config.php new file mode 100644 index 0000000..b106809 --- /dev/null +++ b/vendor/intervention/image/src/config/config.php @@ -0,0 +1,20 @@ + 'gd' + +); diff --git a/vendor/middlewares/utils/CHANGELOG.md b/vendor/middlewares/utils/CHANGELOG.md new file mode 100644 index 0000000..b538dc2 --- /dev/null +++ b/vendor/middlewares/utils/CHANGELOG.md @@ -0,0 +1,137 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [0.11.1] - 2017-05-06 + +### Changed + +* `Middlewares\Utils\CallableHandler` expects one of the following values returned by the callable: + * A `Psr\Http\Message\ResponseInterface` + * `null` or scalar + * an object with `__toString` method implemented + + Otherwise, throws an `UnexpectedValueException` +* `Middlewares\Helpers::fixContentLength` only modifies or removes the `Content-Length` header, but does not add it if didn't exist previously. + +## [0.11.0] - 2017-03-25 + +### Added + +* New class `Middlewares\Utils\Helpers` with common helpers to manipulate PSR-7 messages +* New helper `Middlewares\Utils\Helpers::fixContentLength` used to add/modify/remove the `Content-Length` header of a http message. + +### Changed + +* Updated `http-interop/http-factory` to `0.3` + +## [0.10.1] - 2017-02-27 + +### Fixed + +* Fixed changelog file + +## [0.10.0] - 2017-02-27 + +### Changed + +* Replaced deprecated `container-interop` by `psr/contaienr` (PSR-11). +* `Middlewares\Utils\Dispatcher` throws exceptions if the middlewares does not implement `Interop\Http\ServerMiddleware\MiddlewareInterface` or does not return an instance of `Psr\Http\Message\ResponseInterface`. +* Moved the default factories to `Middlewares\Utils\Factory` namespace. +* Minor code improvements. + +## [0.9.0] - 2017-02-05 + +### Added + +* Callable resolves to create callables from various representations + +### Removed + +* `Middlewares\Utils\CallableHandler::resolve` + +## [0.8.0] - 2016-12-22 + +### Changed + +* Updated `http-interop/http-middleware` to `0.4` +* Updated `friendsofphp/php-cs-fixer` to `2.0` + +## [0.7.0] - 2016-12-06 + +### Added + +* New static helper `Middlewares\Utils\Dispatcher::run` to create and dispatch a request easily + +## [0.6.1] - 2016-12-06 + +### Fixed + +* Ensure that the body of the serverRequest is writable and seekable. + +## [0.6.0] - 2016-12-06 + +### Added + +* ServerRequest factory +* `Middlewares\Utils\Dispatcher` accepts `Closure` as middleware components + +### Changed + +* `Middlewares\Utils\Dispatcher` creates automatically a response if the stack is exhausted + +## [0.5.0] - 2016-11-22 + +### Added + +* `Middlewares\Utils\CallableMiddleware` class, to create middlewares from callables +* `Middlewares\Utils\Dispatcher` class, to execute the middleware stack and return a response. + +## [0.4.0] - 2016-11-13 + +### Changed + +* Updated `http-interop/http-factory` to `0.2` + +## [0.3.1] - 2016-10-03 + +### Fixed + +* Bug in CallableHandler that resolve to the declaring class of a method instead the final class. + +## [0.3.0] - 2016-10-03 + +### Added + +* `Middlewares\Utils\CallableHandler` class, allowing to resolve and execute callables safely. + +## [0.2.0] - 2016-10-01 + +### Added + +* Uri factory + +## 0.1.0 - 2016-09-30 + +### Added + +* Response factory +* Stream factory + +[0.11.1]: https://github.com/middlewares/utils/compare/v0.11.0...v0.11.1 +[0.11.0]: https://github.com/middlewares/utils/compare/v0.10.1...v0.11.0 +[0.10.1]: https://github.com/middlewares/utils/compare/v0.10.0...v0.10.1 +[0.10.0]: https://github.com/middlewares/utils/compare/v0.9.0...v0.10.0 +[0.9.0]: https://github.com/middlewares/utils/compare/v0.8.0...v0.9.0 +[0.8.0]: https://github.com/middlewares/utils/compare/v0.7.0...v0.8.0 +[0.7.0]: https://github.com/middlewares/utils/compare/v0.6.1...v0.7.0 +[0.6.1]: https://github.com/middlewares/utils/compare/v0.6.0...v0.6.1 +[0.6.0]: https://github.com/middlewares/utils/compare/v0.5.0...v0.6.0 +[0.5.0]: https://github.com/middlewares/utils/compare/v0.4.0...v0.5.0 +[0.4.0]: https://github.com/middlewares/utils/compare/v0.3.1...v0.4.0 +[0.3.1]: https://github.com/middlewares/utils/compare/v0.3.0...v0.3.1 +[0.3.0]: https://github.com/middlewares/utils/compare/v0.2.0...v0.3.0 +[0.2.0]: https://github.com/middlewares/utils/compare/v0.1.0...v0.2.0 diff --git a/vendor/middlewares/utils/CONTRIBUTING.md b/vendor/middlewares/utils/CONTRIBUTING.md new file mode 100644 index 0000000..f0d8807 --- /dev/null +++ b/vendor/middlewares/utils/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing Guide + +This project adheres to [The Code Manifesto](http://codemanifesto.com) as its guidelines for contributor interactions. + +## The Code Manifesto + +We want to work in an ecosystem that empowers developers to reach their potential--one that encourages growth and effective collaboration. A space that is safe for all. + +A space such as this benefits everyone that participates in it. It encourages new developers to enter our field. It is through discussion and collaboration that we grow, and through growth that we improve. + +In the effort to create such a place, we hold to these values: + +1. **Discrimination limits us.** This includes discrimination on the basis of race, gender, sexual orientation, gender identity, age, nationality, technology and any other arbitrary exclusion of a group of people. +2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort levels. Remember that, and if brought to your attention, heed it. +3. **We are our biggest assets.** None of us were born masters of our trade. Each of us has been helped along the way. Return that favor, when and where you can. +4. **We are resources for the future.** As an extension of #3, share what you know. Make yourself a resource to help those that come after you. +5. **Respect defines us.** Treat others as you wish to be treated. Make your discussions, criticisms and debates from a position of respectfulness. Ask yourself, is it true? Is it necessary? Is it constructive? Anything less is unacceptable. +6. **Reactions require grace.** Angry responses are valid, but abusive language and vindictive actions are toxic. When something happens that offends you, handle it assertively, but be respectful. Escalate reasonably, and try to allow the offender an opportunity to explain themselves, and possibly correct the issue. +7. **Opinions are just that: opinions.** Each and every one of us, due to our background and upbringing, have varying opinions. That is perfectly acceptable. Remember this: if you respect your own opinions, you should respect the opinions of others. +8. **To err is human.** You might not intend it, but mistakes do happen and contribute to build experience. Tolerate honest mistakes, and don't hesitate to apologize if you make one yourself. + +## How to contribute + +This is a collaborative effort. We welcome all contributions submitted as pull requests. + +(Contributions on wording & style are also welcome.) + +### Bugs + +A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful – thank you! + +Please try to be as detailed as possible in your report. Include specific information about the environment – version of PHP, etc, and steps required to reproduce the issue. + +### Pull Requests + +Good pull requests – patches, improvements, new features – are a fantastic help. Before create a pull request, please follow these instructions: + +* The code must follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `composer cs-fix` to fix your code before commit. +* Write tests +* Document any change in `README.md` and `CHANGELOG.md` +* One pull request per feature. If you want to do more than one thing, send multiple pull request + +### Runing tests + +```sh +composer test +``` diff --git a/vendor/middlewares/utils/LICENSE b/vendor/middlewares/utils/LICENSE new file mode 100644 index 0000000..e35d995 --- /dev/null +++ b/vendor/middlewares/utils/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/middlewares/utils/README.md b/vendor/middlewares/utils/README.md new file mode 100644 index 0000000..bf13715 --- /dev/null +++ b/vendor/middlewares/utils/README.md @@ -0,0 +1,116 @@ +# middlewares/utils + +[![Latest Version on Packagist][ico-version]][link-packagist] +[![Software License][ico-license]](LICENSE) +[![Build Status][ico-travis]][link-travis] +[![Quality Score][ico-scrutinizer]][link-scrutinizer] +[![Total Downloads][ico-downloads]][link-downloads] +[![SensioLabs Insight][ico-sensiolabs]][link-sensiolabs] + +Common utilities used by the middlewares' packages: + +## Factory + +Used to create psr-7 instances of `ServerRequestInterface`, `ResponseInterface`, `StreamInterface` and `UriInterface`. Detects automatically [Diactoros](https://github.com/zendframework/zend-diactoros), [Guzzle](https://github.com/guzzle/psr7) and [Slim](https://github.com/slimphp/Slim) but you can register a different factory using the [http-interop/http-factory](https://github.com/http-interop/http-factory) interface. + +```php +use Middlewares\Utils\Factory; + +$request = Factory::createServerRequest(); +$response = Factory::createResponse(); +$stream = Factory::createStream(); +$uri = Factory::createUri('http://example.com'); + +//Register other factory +Factory::setResponseFactory(new FooResponseFactory()); + +$fooResponse = Factory::createResponse(); +``` + +## CallableHandler + +To execute a callable and return a response with the output. Useful to handle routes, etc: + +```php +use Middlewares\Utils\CallableHandler; + +$response = CallableHandler::execute(function () { + echo 'Hello world'; +}); + +echo $response->getBody(); //Hello world +``` + +## Dispatcher + +Minimalist PSR-15 compatible dispatcher. Used for testing purposes. + +```php +use Middlewares\Utils\Factory; +use Middlewares\Utils\Dispatcher; + +$dispatcher = new Dispatcher([ + new Middleware1(), + new Middleware2(), + new Middleware3(), + function ($request, $next) { + $response = $next->process($request); + return $response->withHeader('X-Foo', 'Bar'); + } +]); + +$response = $dispatcher->dispatch(Factory::createServerRequest()); +``` + +## CallableMiddleware + +A simple way to create middlewares using callables. Internally uses [CallableHandler](#callablehandler) so you can use `echo` or return `string` in the callables (the response is created automatically if it's not returned). +**Note:** You may not need use this directly in the `Dispatcher`, because is used automatically with instances of `Closure`. + +```php +use Middlewares\Utils\Dispatcher; +use Middlewares\Utils\CallableMiddleware; + +$dispatcher = new Dispatcher([ + new CallableMiddleware(function ($request, $delegate) { + $response = $delegate->process($request); + + return $response->withHeader('Content-Type', 'text/html'); + }), + //Providing a Closure directly, the dispatcher will convert to a CallableMiddleware automatically + function ($request, $delegate) { + echo '

Hello world

'; + } +]); + +$response = $dispatcher->dispatch(new Request()); +``` + +## Helpers + +A collection of helpers for psr-7 message manipulation. It contains the following methods: + +```php +Helpers::fixContentLength(MessageInterface $response): MessageInterface +``` + +Fixes the `Content-Length` header based in the body size. + +--- + +Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details. + +The MIT License (MIT). Please see [LICENSE](LICENSE) for more information. + +[ico-version]: https://img.shields.io/packagist/v/middlewares/utils.svg?style=flat-square +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square +[ico-travis]: https://img.shields.io/travis/middlewares/utils/master.svg?style=flat-square +[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/middlewares/utils.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/middlewares/utils.svg?style=flat-square +[ico-sensiolabs]: https://img.shields.io/sensiolabs/i/3dcb2b7c-8564-48ef-9af4-d1e974762c3a.svg?style=flat-square + +[link-packagist]: https://packagist.org/packages/middlewares/utils +[link-travis]: https://travis-ci.org/middlewares/utils +[link-scrutinizer]: https://scrutinizer-ci.com/g/middlewares/utils +[link-downloads]: https://packagist.org/packages/middlewares/utils +[link-sensiolabs]: https://insight.sensiolabs.com/projects/3dcb2b7c-8564-48ef-9af4-d1e974762c3a diff --git a/vendor/middlewares/utils/composer.json b/vendor/middlewares/utils/composer.json new file mode 100644 index 0000000..09675fe --- /dev/null +++ b/vendor/middlewares/utils/composer.json @@ -0,0 +1,52 @@ +{ + "name": "middlewares/utils", + "type": "library", + "description": "Common utils to create PSR-15 middleware packages", + "license": "MIT", + "keywords": [ + "psr-7", + "psr-15", + "psr-11", + "middleware", + "http" + ], + "homepage": "https://github.com/middlewares/utils", + "support": { + "issues": "https://github.com/middlewares/utils/issues" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0", + "http-interop/http-factory": "^0.3", + "http-interop/http-middleware": "^0.4" + }, + "require-dev": { + "phpunit/phpunit": "^5.5", + "zendframework/zend-diactoros": "^1.3", + "friendsofphp/php-cs-fixer": "^2.0", + "squizlabs/php_codesniffer": "^2.7", + "slim/slim": "^3.5", + "guzzlehttp/psr7": "^1.3", + "psr/container": "^1.0" + }, + "suggest": { + "psr/container": "Can be used to automatically resolve callables" + }, + "autoload": { + "psr-4": { + "Middlewares\\Utils\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Middlewares\\Tests\\": "tests/" + } + }, + "scripts": { + "test": [ + "phpunit", + "phpcs" + ], + "cs-fix": "php-cs-fixer fix ." + } +} diff --git a/vendor/middlewares/utils/src/CallableHandler.php b/vendor/middlewares/utils/src/CallableHandler.php new file mode 100644 index 0000000..ec0d7ba --- /dev/null +++ b/vendor/middlewares/utils/src/CallableHandler.php @@ -0,0 +1,62 @@ += $level) { + $return = ob_get_clean().$return; + } + + $body = $response->getBody(); + + if ($return !== '' && $body->isWritable()) { + $body->write($return); + } + + return $response; + } catch (\Exception $exception) { + while (ob_get_level() >= $level) { + ob_end_clean(); + } + + throw $exception; + } + } +} diff --git a/vendor/middlewares/utils/src/CallableMiddleware.php b/vendor/middlewares/utils/src/CallableMiddleware.php new file mode 100644 index 0000000..4fec4d6 --- /dev/null +++ b/vendor/middlewares/utils/src/CallableMiddleware.php @@ -0,0 +1,39 @@ +handler = $handler; + } + + /** + * Process a server request and return a response. + * + * @param ServerRequestInterface $request + * @param DelegateInterface $delegate + * + * @return ResponseInterface + */ + public function process(ServerRequestInterface $request, DelegateInterface $delegate) + { + return CallableHandler::execute($this->handler, [$request, $delegate]); + } +} diff --git a/vendor/middlewares/utils/src/CallableResolver/CallableResolverInterface.php b/vendor/middlewares/utils/src/CallableResolver/CallableResolverInterface.php new file mode 100644 index 0000000..6852f5c --- /dev/null +++ b/vendor/middlewares/utils/src/CallableResolver/CallableResolverInterface.php @@ -0,0 +1,23 @@ +container = $container; + } + + public function resolve($callable, array $args = []) + { + if (is_string($callable)) { + $callable = $this->resolveString($callable); + } + + if (is_string($callable)) { + $callable = $this->container->get($callable); + } elseif (is_array($callable) && is_string($callable[0])) { + $callable[0] = $this->container->get($callable[0]); + } + + if (is_callable($callable)) { + return $callable; + } + + throw new RuntimeException('Invalid callable provided'); + } +} diff --git a/vendor/middlewares/utils/src/CallableResolver/ReflectionResolver.php b/vendor/middlewares/utils/src/CallableResolver/ReflectionResolver.php new file mode 100644 index 0000000..ebd3321 --- /dev/null +++ b/vendor/middlewares/utils/src/CallableResolver/ReflectionResolver.php @@ -0,0 +1,65 @@ +resolveString($callable); + } + + if (is_string($callable)) { + if (!function_exists($callable)) { + $callable = $this->createClass($callable, $args); + } + } elseif (is_array($callable) && is_string($callable[0])) { + list($class, $method) = $callable; + + $refMethod = new ReflectionMethod($class, $method); + + if (!$refMethod->isStatic()) { + $class = $this->createClass($class, $args); + + $callable = [$class, $method]; + } + } + + if (is_callable($callable)) { + return $callable; + } + + throw new RuntimeException('Invalid callable provided'); + } + + /** + * Create a new class. + * + * @param string $class + * @param array $args + * + * @return object + */ + private function createClass($class, $args = []) + { + if (!class_exists($class)) { + throw new RuntimeException("The class {$class} does not exists"); + } + + $refClass = new ReflectionClass($class); + + if ($refClass->hasMethod('__construct')) { + return $refClass->newInstanceArgs($args); + } + + return $refClass->newInstance(); + } +} diff --git a/vendor/middlewares/utils/src/CallableResolver/Resolver.php b/vendor/middlewares/utils/src/CallableResolver/Resolver.php new file mode 100644 index 0000000..388c42c --- /dev/null +++ b/vendor/middlewares/utils/src/CallableResolver/Resolver.php @@ -0,0 +1,28 @@ +callback = $callback; + } + + /** + * @param ServerRequestInterface $request + * + * @return ResponseInterface + */ + public function process(ServerRequestInterface $request) + { + return call_user_func($this->callback, $request); + } +} diff --git a/vendor/middlewares/utils/src/Dispatcher.php b/vendor/middlewares/utils/src/Dispatcher.php new file mode 100644 index 0000000..4d4cf4f --- /dev/null +++ b/vendor/middlewares/utils/src/Dispatcher.php @@ -0,0 +1,86 @@ +dispatch($request); + } + + /** + * @param MiddlewareInterface[] $stack middleware stack (with at least one middleware component) + */ + public function __construct(array $stack) + { + $this->stack = $stack; + } + + /** + * Dispatches the middleware stack and returns the resulting `ResponseInterface`. + * + * @param ServerRequestInterface $request + * + * @return ResponseInterface + */ + public function dispatch(ServerRequestInterface $request) + { + $resolved = $this->resolve(0); + + return $resolved->process($request); + } + + /** + * @param int $index middleware stack index + * + * @return DelegateInterface + */ + private function resolve($index) + { + return new Delegate(function (ServerRequestInterface $request) use ($index) { + $middleware = isset($this->stack[$index]) ? $this->stack[$index] : new CallableMiddleware(function () { + }); + + if ($middleware instanceof Closure) { + $middleware = new CallableMiddleware($middleware); + } + + if (!($middleware instanceof MiddlewareInterface)) { + throw new RuntimeException('The middleware must be an instance of MiddlewareInterface'); + } + + $response = $middleware->process($request, $this->resolve($index + 1)); + + if (!($response instanceof ResponseInterface)) { + throw new RuntimeException('The middleware result must be an instance of ResponseInterface'); + } + + return $response; + }); + } +} diff --git a/vendor/middlewares/utils/src/Factory.php b/vendor/middlewares/utils/src/Factory.php new file mode 100644 index 0000000..e4a6fdb --- /dev/null +++ b/vendor/middlewares/utils/src/Factory.php @@ -0,0 +1,154 @@ +createResponse($code); + } + + /** + * Creates a Stream instance. + * + * @param resource $resource A resource returned by fopen + * + * @return StreamInterface + */ + public static function createStream($resource = null) + { + if (self::$streamFactory === null) { + self::$streamFactory = new Factory\StreamFactory(); + } + + if ($resource === null) { + return self::$streamFactory->createStream(); + } + + return self::$streamFactory->createStreamFromResource($resource); + } + + /** + * Creates an Uri instance. + * + * @param string $uri + * + * @return UriInterface + */ + public static function createUri($uri = '') + { + if (self::$uriFactory === null) { + self::$uriFactory = new Factory\UriFactory(); + } + + return self::$uriFactory->createUri($uri); + } + + /** + * Creates a ServerRequest instance. + * + * @param array $server + * @param string $method + * @param string $uri + * + * @return ServerRequestInterface + */ + public static function createServerRequest(array $server = [], $method = 'GET', $uri = '/') + { + if (self::$serverRequestFactory === null) { + self::$serverRequestFactory = new Factory\ServerRequestFactory(); + } + + if (is_string($uri)) { + $uri = self::createUri($uri); + } + + return self::$serverRequestFactory->createServerRequestFromArray($server) + ->withMethod($method) + ->withUri($uri); + } +} diff --git a/vendor/middlewares/utils/src/Factory/ResponseFactory.php b/vendor/middlewares/utils/src/Factory/ResponseFactory.php new file mode 100644 index 0000000..237c510 --- /dev/null +++ b/vendor/middlewares/utils/src/Factory/ResponseFactory.php @@ -0,0 +1,31 @@ +createStreamFromFile('php://temp', 'r+'); + $stream->write($content); + + return $stream; + } + + /** + * {@inheritdoc} + */ + public function createStreamFromFile($file, $mode = 'r') + { + return $this->createStreamFromResource(fopen($file, $mode)); + } + + /** + * {@inheritdoc} + */ + public function createStreamFromResource($resource) + { + if (class_exists('Zend\\Diactoros\\Stream')) { + return new \Zend\Diactoros\Stream($resource); + } + + if (class_exists('GuzzleHttp\\Psr7\\Stream')) { + return new \GuzzleHttp\Psr7\Stream($resource); + } + + if (class_exists('Slim\\Http\\Stream')) { + return new \Slim\Http\Stream($resource); + } + + throw new \RuntimeException('Unable to create a stream. No PSR-7 stream library detected'); + } +} diff --git a/vendor/middlewares/utils/src/Factory/UriFactory.php b/vendor/middlewares/utils/src/Factory/UriFactory.php new file mode 100644 index 0000000..a16d76f --- /dev/null +++ b/vendor/middlewares/utils/src/Factory/UriFactory.php @@ -0,0 +1,31 @@ +hasHeader('Content-Length')) { + return $response; + } + + if ($response->getBody()->getSize() !== null) { + return $response->withHeader('Content-Length', (string) $response->getBody()->getSize()); + } + + return $response->withoutHeader('Content-Length'); + } +} diff --git a/vendor/middlewares/whoops/CHANGELOG.md b/vendor/middlewares/whoops/CHANGELOG.md new file mode 100644 index 0000000..7769f4c --- /dev/null +++ b/vendor/middlewares/whoops/CHANGELOG.md @@ -0,0 +1,40 @@ +# Change Log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [0.4.1] - 2017-06-26 + +### Fixed + +* Fixed shutdown errors handling + +## [0.4.0] - 2017-03-18 + +### Added + +* Set the response content-type when an error is handled + +## [0.3.0] - 2016-12-26 + +### Changed + +* Updated tests +* Updated to `http-interop/http-middleware#0.4` +* Updated `friendsofphp/php-cs-fixer#2.0` + +## [0.2.0] - 2016-11-22 + +### Changed + +* Updated to `http-interop/http-middleware#0.3` + +## 0.1.0 - 2016-10-02 + +First version + +[0.4.1]: https://github.com/middlewares/whoops/compare/v0.4.0...v0.4.1 +[0.4.0]: https://github.com/middlewares/whoops/compare/v0.3.0...v0.4.0 +[0.3.0]: https://github.com/middlewares/whoops/compare/v0.2.0...v0.3.0 +[0.2.0]: https://github.com/middlewares/whoops/compare/v0.1.0...v0.2.0 diff --git a/vendor/middlewares/whoops/CONTRIBUTING.md b/vendor/middlewares/whoops/CONTRIBUTING.md new file mode 100644 index 0000000..f0d8807 --- /dev/null +++ b/vendor/middlewares/whoops/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing Guide + +This project adheres to [The Code Manifesto](http://codemanifesto.com) as its guidelines for contributor interactions. + +## The Code Manifesto + +We want to work in an ecosystem that empowers developers to reach their potential--one that encourages growth and effective collaboration. A space that is safe for all. + +A space such as this benefits everyone that participates in it. It encourages new developers to enter our field. It is through discussion and collaboration that we grow, and through growth that we improve. + +In the effort to create such a place, we hold to these values: + +1. **Discrimination limits us.** This includes discrimination on the basis of race, gender, sexual orientation, gender identity, age, nationality, technology and any other arbitrary exclusion of a group of people. +2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort levels. Remember that, and if brought to your attention, heed it. +3. **We are our biggest assets.** None of us were born masters of our trade. Each of us has been helped along the way. Return that favor, when and where you can. +4. **We are resources for the future.** As an extension of #3, share what you know. Make yourself a resource to help those that come after you. +5. **Respect defines us.** Treat others as you wish to be treated. Make your discussions, criticisms and debates from a position of respectfulness. Ask yourself, is it true? Is it necessary? Is it constructive? Anything less is unacceptable. +6. **Reactions require grace.** Angry responses are valid, but abusive language and vindictive actions are toxic. When something happens that offends you, handle it assertively, but be respectful. Escalate reasonably, and try to allow the offender an opportunity to explain themselves, and possibly correct the issue. +7. **Opinions are just that: opinions.** Each and every one of us, due to our background and upbringing, have varying opinions. That is perfectly acceptable. Remember this: if you respect your own opinions, you should respect the opinions of others. +8. **To err is human.** You might not intend it, but mistakes do happen and contribute to build experience. Tolerate honest mistakes, and don't hesitate to apologize if you make one yourself. + +## How to contribute + +This is a collaborative effort. We welcome all contributions submitted as pull requests. + +(Contributions on wording & style are also welcome.) + +### Bugs + +A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful – thank you! + +Please try to be as detailed as possible in your report. Include specific information about the environment – version of PHP, etc, and steps required to reproduce the issue. + +### Pull Requests + +Good pull requests – patches, improvements, new features – are a fantastic help. Before create a pull request, please follow these instructions: + +* The code must follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `composer cs-fix` to fix your code before commit. +* Write tests +* Document any change in `README.md` and `CHANGELOG.md` +* One pull request per feature. If you want to do more than one thing, send multiple pull request + +### Runing tests + +```sh +composer test +``` diff --git a/vendor/middlewares/whoops/LICENSE b/vendor/middlewares/whoops/LICENSE new file mode 100644 index 0000000..e35d995 --- /dev/null +++ b/vendor/middlewares/whoops/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/middlewares/whoops/README.md b/vendor/middlewares/whoops/README.md new file mode 100644 index 0000000..a364a3c --- /dev/null +++ b/vendor/middlewares/whoops/README.md @@ -0,0 +1,63 @@ +# middlewares/whoops + +[![Latest Version on Packagist][ico-version]][link-packagist] +[![Software License][ico-license]](LICENSE) +[![Build Status][ico-travis]][link-travis] +[![Quality Score][ico-scrutinizer]][link-scrutinizer] +[![Total Downloads][ico-downloads]][link-downloads] +[![SensioLabs Insight][ico-sensiolabs]][link-sensiolabs] + +Middleware to use [Whoops](https://github.com/filp/whoops) as error handler. + +## Requirements + +* PHP >= 5.6 +* A [PSR-7](https://packagist.org/providers/psr/http-message-implementation) http mesage implementation ([Diactoros](https://github.com/zendframework/zend-diactoros), [Guzzle](https://github.com/guzzle/psr7), [Slim](https://github.com/slimphp/Slim), etc...) +* A [PSR-15](https://github.com/http-interop/http-middleware) middleware dispatcher ([Middleman](https://github.com/mindplay-dk/middleman), etc...) + +## Installation + +This package is installable and autoloadable via Composer as [middlewares/whoops](https://packagist.org/packages/middlewares/whoops). + +```sh +composer require middlewares/whoops +``` + +## Example + +```php +$dispatcher = new Dispatcher([ + new Middlewares\Whoops() +]); + +$response = $dispatcher->dispatch(new ServerRequest()); +``` + +## Options + +#### `__construct(Whoops\Run $whoops = null, Whoops\Util\SystemFacade $system = null)` + +Allows to provide a custom `Whoops\Run` instance. If it's not defined, creates an instance automatically. You can provide also the `SystemFacade` used by the `Run` instance, in order to implement a special behaviour with fatal errors. + +#### `catchErrors(true)` + +To catch not only throwable exceptions, but also php errors. This makes whoops to be registered temporary in order to capture the errors using `set_error_handler`. It's enabled by default so, to disable it you have to use `->catchErrors(false)`; + +--- + +Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details. + +The MIT License (MIT). Please see [LICENSE](LICENSE) for more information. + +[ico-version]: https://img.shields.io/packagist/v/middlewares/whoops.svg?style=flat-square +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square +[ico-travis]: https://img.shields.io/travis/middlewares/whoops/master.svg?style=flat-square +[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/middlewares/whoops.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/middlewares/whoops.svg?style=flat-square +[ico-sensiolabs]: https://img.shields.io/sensiolabs/i/20d7a029-f575-4d2d-9d9a-9de9178ddedc.svg?style=flat-square + +[link-packagist]: https://packagist.org/packages/middlewares/whoops +[link-travis]: https://travis-ci.org/middlewares/whoops +[link-scrutinizer]: https://scrutinizer-ci.com/g/middlewares/whoops +[link-downloads]: https://packagist.org/packages/middlewares/whoops +[link-sensiolabs]: https://insight.sensiolabs.com/projects/20d7a029-f575-4d2d-9d9a-9de9178ddedc diff --git a/vendor/middlewares/whoops/composer.json b/vendor/middlewares/whoops/composer.json new file mode 100644 index 0000000..52771eb --- /dev/null +++ b/vendor/middlewares/whoops/composer.json @@ -0,0 +1,48 @@ +{ + "name": "middlewares/whoops", + "type": "library", + "description": "Middleware to use Whoops as error handler", + "license": "MIT", + "keywords": [ + "psr-7", + "psr-15", + "middleware", + "server", + "error", + "whoops", + "http" + ], + "homepage": "https://github.com/middlewares/whoops", + "support": { + "issues": "https://github.com/middlewares/whoops/issues" + }, + "require": { + "php": "^5.6 || ^7.0", + "http-interop/http-middleware": "^0.4", + "filp/whoops": "^2.1", + "middlewares/utils": "~0.10" + }, + "require-dev": { + "phpunit/phpunit": "^5.5", + "zendframework/zend-diactoros": "^1.3", + "friendsofphp/php-cs-fixer": "^2.0", + "squizlabs/php_codesniffer": "^2.7" + }, + "autoload": { + "psr-4": { + "Middlewares\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Middlewares\\Tests\\": "tests/" + } + }, + "scripts": { + "test": [ + "phpunit", + "phpcs" + ], + "cs-fix": "php-cs-fixer fix ." + } +} diff --git a/vendor/middlewares/whoops/src/Whoops.php b/vendor/middlewares/whoops/src/Whoops.php new file mode 100644 index 0000000..5660b31 --- /dev/null +++ b/vendor/middlewares/whoops/src/Whoops.php @@ -0,0 +1,228 @@ +whoops = $whoops; + $this->system = $system; + } + + /** + * Whether catch errors or not. + * + * @param bool $catchErrors + * + * @return self + */ + public function catchErrors($catchErrors = true) + { + $this->catchErrors = (bool) $catchErrors; + + return $this; + } + + /** + * Process a server request and return a response. + * + * @param ServerRequestInterface $request + * @param DelegateInterface $delegate + * + * @return ResponseInterface + */ + public function process(ServerRequestInterface $request, DelegateInterface $delegate) + { + ob_start(); + $level = ob_get_level(); + + $method = Run::EXCEPTION_HANDLER; + $whoops = $this->whoops ?: $this->getWhoopsInstance($request); + + $whoops->allowQuit(false); + $whoops->writeToOutput(false); + $whoops->sendHttpCode(false); + + //Catch errors means register whoops globally + if ($this->catchErrors) { + $whoops->register(); + + $shutdown = function () use ($whoops) { + $whoops->allowQuit(true); + $whoops->writeToOutput(true); + $whoops->sendHttpCode(true); + + $method = Run::SHUTDOWN_HANDLER; + $whoops->$method(); + }; + + if ($this->system) { + $this->system->registerShutdownFunction($shutdown); + } else { + register_shutdown_function($shutdown); + } + } + + try { + $response = $delegate->process($request); + } catch (\Throwable $exception) { + $response = Utils\Factory::createResponse(500); + $response->getBody()->write($whoops->$method($exception)); + $response = self::updateResponseContentType($response, $whoops); + } catch (\Exception $exception) { + $response = Utils\Factory::createResponse(500); + $response->getBody()->write($whoops->$method($exception)); + $response = self::updateResponseContentType($response, $whoops); + } finally { + while (ob_get_level() >= $level) { + ob_end_clean(); + } + } + + if ($this->catchErrors) { + $whoops->unregister(); + } + + return $response; + } + + /** + * Returns the whoops instance or create one. + * + * @param ServerRequestInterface $request + * + * @return Run + */ + private function getWhoopsInstance(ServerRequestInterface $request) + { + if (!$this->system) { + $this->system = new SystemFacade(); + } + + $whoops = new Run($this->system); + + switch (self::getPreferredFormat($request)) { + case 'json': + $handler = new JsonResponseHandler(); + $handler->addTraceToOutput(true); + break; + + case 'xml': + $handler = new XmlResponseHandler(); + $handler->addTraceToOutput(true); + break; + + case 'plain': + $handler = new PlainTextHandler(); + $handler->addTraceToOutput(true); + break; + + default: + $handler = new PrettyPageHandler(); + break; + } + + $whoops->pushHandler($handler); + + return $whoops; + } + + /** + * Returns the preferred format used by whoops. + * + * @param ServerRequestInterface $request + * + * @return string|null + */ + private static function getPreferredFormat($request) + { + if (php_sapi_name() === 'cli') { + return 'plain'; + } + + $formats = [ + 'json' => ['application/json'], + 'html' => ['text/html'], + 'xml' => ['text/xml'], + 'plain' => ['text/plain', 'text/css', 'text/javascript'], + ]; + + $accept = $request->getHeaderLine('Accept'); + + foreach ($formats as $format => $mimes) { + foreach ($mimes as $mime) { + if (stripos($accept, $mime) !== false) { + return $format; + } + } + } + } + + /** + * Returns the content-type for the whoops instance + * + * @param ResponseInterface $response + * @param Run $whoops + * + * @return ResponseInterface + */ + private static function updateResponseContentType(ResponseInterface $response, Run $whoops) + { + if (1 !== count($whoops->getHandlers())) { + return $response; + } + + $handler = current($whoops->getHandlers()); + + if ($handler instanceof PrettyPageHandler) { + return $response->withHeader('Content-Type', 'text/html'); + } + + if ($handler instanceof JsonResponseHandler) { + return $response->withHeader('Content-Type', 'application/json'); + } + + if ($handler instanceof XmlResponseHandler) { + return $response->withHeader('Content-Type', 'text/xml'); + } + + if ($handler instanceof PlainTextHandler) { + return $response->withHeader('Content-Type', 'text/plain'); + } + + return $response; + } +} diff --git a/vendor/myclabs/deep-copy/LICENSE b/vendor/myclabs/deep-copy/LICENSE new file mode 100644 index 0000000..c3e8350 --- /dev/null +++ b/vendor/myclabs/deep-copy/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 My C-Sense + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/myclabs/deep-copy/README.md b/vendor/myclabs/deep-copy/README.md new file mode 100644 index 0000000..7abe5dc --- /dev/null +++ b/vendor/myclabs/deep-copy/README.md @@ -0,0 +1,376 @@ +# DeepCopy + +DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph. + +[![Build Status](https://travis-ci.org/myclabs/DeepCopy.png?branch=1.x)](https://travis-ci.org/myclabs/DeepCopy) +[![Coverage Status](https://coveralls.io/repos/myclabs/DeepCopy/badge.png?branch=1.x)](https://coveralls.io/r/myclabs/DeepCopy?branch=1.x) +[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/myclabs/DeepCopy/badges/quality-score.png?s=2747100c19b275f93a777e3297c6c12d1b68b934)](https://scrutinizer-ci.com/g/myclabs/DeepCopy/) +[![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy) + + +**You are browsing the 1.x version, this version is in maintenance mode only. Please check the new +[2.x](https://github.com/myclabs/DeepCopy/tree/2.x) version.** + + +## Table of Contents + +1. [How](#how) +1. [Why](#why) + 1. [Using simply `clone`](#using-simply-clone) + 1. [Overridding `__clone()`](#overridding-__clone) + 1. [With `DeepCopy`](#with-deepcopy) +1. [How it works](#how-it-works) +1. [Going further](#going-further) + 1. [Matchers](#matchers) + 1. [Property name](#property-name) + 1. [Specific property](#specific-property) + 1. [Type](#type) + 1. [Filters](#filters) + 1. [`SetNullFilter`](#setnullfilter-filter) + 1. [`KeepFilter`](#keepfilter-filter) + 1. [`DoctrineCollectionFilter`](#doctrinecollectionfilter-filter) + 1. [`DoctrineEmptyCollectionFilter`](#doctrineemptycollectionfilter-filter) + 1. [`DoctrineProxyFilter`](#doctrineproxyfilter-filter) + 1. [`ReplaceFilter`](#replacefilter-type-filter) + 1. [`ShallowCopyFilter`](#shallowcopyfilter-type-filter) +1. [Edge cases](#edge-cases) +1. [Contributing](#contributing) + 1. [Tests](#tests) + + +## How? + +Install with Composer: + +```json +composer require myclabs/deep-copy +``` + +Use simply: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(); +$myCopy = $copier->copy($myObject); +``` + + +## Why? + +- How do you create copies of your objects? + +```php +$myCopy = clone $myObject; +``` + +- How do you create **deep** copies of your objects (i.e. copying also all the objects referenced in the properties)? + +You use [`__clone()`](http://www.php.net/manual/en/language.oop5.cloning.php#object.clone) and implement the behavior +yourself. + +- But how do you handle **cycles** in the association graph? + +Now you're in for a big mess :( + +![association graph](doc/graph.png) + + +### Using simply `clone` + +![Using clone](doc/clone.png) + + +### Overridding `__clone()` + +![Overridding __clone](doc/deep-clone.png) + + +### With `DeepCopy` + +![With DeepCopy](doc/deep-copy.png) + + +## How it works + +DeepCopy recursively traverses all the object's properties and clones them. To avoid cloning the same object twice it +keeps a hash map of all instances and thus preserves the object graph. + +To use it: + +```php +use function DeepCopy\deep_copy; + +$copy = deep_copy($var); +``` + +Alternatively, you can create your own `DeepCopy` instance to configure it differently for example: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(true); + +$copy = $copier->copy($var); +``` + +You may want to roll your own deep copy function: + +```php +namespace Acme; + +use DeepCopy\DeepCopy; + +function deep_copy($var) +{ + static $copier = null; + + if (null === $copier) { + $copier = new DeepCopy(true); + } + + return $copier->copy($var); +} +``` + + +## Going further + +You can add filters to customize the copy process. + +The method to add a filter is `DeepCopy\DeepCopy::addFilter($filter, $matcher)`, +with `$filter` implementing `DeepCopy\Filter\Filter` +and `$matcher` implementing `DeepCopy\Matcher\Matcher`. + +We provide some generic filters and matchers. + + +### Matchers + + - `DeepCopy\Matcher` applies on a object attribute. + - `DeepCopy\TypeMatcher` applies on any element found in graph, including array elements. + + +#### Property name + +The `PropertyNameMatcher` will match a property by its name: + +```php +use DeepCopy\Matcher\PropertyNameMatcher; + +// Will apply a filter to any property of any objects named "id" +$matcher = new PropertyNameMatcher('id'); +``` + + +#### Specific property + +The `PropertyMatcher` will match a specific property of a specific class: + +```php +use DeepCopy\Matcher\PropertyMatcher; + +// Will apply a filter to the property "id" of any objects of the class "MyClass" +$matcher = new PropertyMatcher('MyClass', 'id'); +``` + + +#### Type + +The `TypeMatcher` will match any element by its type (instance of a class or any value that could be parameter of +[gettype()](http://php.net/manual/en/function.gettype.php) function): + +```php +use DeepCopy\TypeMatcher\TypeMatcher; + +// Will apply a filter to any object that is an instance of Doctrine\Common\Collections\Collection +$matcher = new TypeMatcher('Doctrine\Common\Collections\Collection'); +``` + + +### Filters + +- `DeepCopy\Filter` applies a transformation to the object attribute matched by `DeepCopy\Matcher` +- `DeepCopy\TypeFilter` applies a transformation to any element matched by `DeepCopy\TypeMatcher` + + +#### `SetNullFilter` (filter) + +Let's say for example that you are copying a database record (or a Doctrine entity), so you want the copy not to have +any ID: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\SetNullFilter; +use DeepCopy\Matcher\PropertyNameMatcher; + +$object = MyClass::load(123); +echo $object->id; // 123 + +$copier = new DeepCopy(); +$copier->addFilter(new SetNullFilter(), new PropertyNameMatcher('id')); + +$copy = $copier->copy($object); + +echo $copy->id; // null +``` + + +#### `KeepFilter` (filter) + +If you want a property to remain untouched (for example, an association to an object): + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\KeepFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new KeepFilter(), new PropertyMatcher('MyClass', 'category')); + +$copy = $copier->copy($object); +// $copy->category has not been touched +``` + + +#### `DoctrineCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity, you will need to use the `DoctrineCollectionFilter`: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineCollectionFilter; +use DeepCopy\Matcher\PropertyTypeMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineCollectionFilter(), new PropertyTypeMatcher('Doctrine\Common\Collections\Collection')); + +$copy = $copier->copy($object); +``` + + +#### `DoctrineEmptyCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity who contains a `Collection` that you want to be reset, you can use the +`DoctrineEmptyCollectionFilter` + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineEmptyCollectionFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineEmptyCollectionFilter(), new PropertyMatcher('MyClass', 'myProperty')); + +$copy = $copier->copy($object); + +// $copy->myProperty will return an empty collection +``` + + +#### `DoctrineProxyFilter` (filter) + +If you use Doctrine and use cloning on lazy loaded entities, you might encounter errors mentioning missing fields on a +Doctrine proxy class (...\\\_\_CG\_\_\Proxy). +You can use the `DoctrineProxyFilter` to load the actual entity behind the Doctrine proxy class. +**Make sure, though, to put this as one of your very first filters in the filter chain so that the entity is loaded +before other filters are applied!** + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineProxyFilter; +use DeepCopy\Matcher\Doctrine\DoctrineProxyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineProxyFilter(), new DoctrineProxyMatcher()); + +$copy = $copier->copy($object); + +// $copy should now contain a clone of all entities, including those that were not yet fully loaded. +``` + + +#### `ReplaceFilter` (type filter) + +1. If you want to replace the value of a property: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\ReplaceFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$callback = function ($currentValue) { + return $currentValue . ' (copy)' +}; +$copier->addFilter(new ReplaceFilter($callback), new PropertyMatcher('MyClass', 'title')); + +$copy = $copier->copy($object); + +// $copy->title will contain the data returned by the callback, e.g. 'The title (copy)' +``` + +2. If you want to replace whole element: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ReplaceFilter; +use DeepCopy\TypeMatcher\TypeMatcher; + +$copier = new DeepCopy(); +$callback = function (MyClass $myClass) { + return get_class($myClass); +}; +$copier->addTypeFilter(new ReplaceFilter($callback), new TypeMatcher('MyClass')); + +$copy = $copier->copy([new MyClass, 'some string', new MyClass]); + +// $copy will contain ['MyClass', 'some string', 'MyClass'] +``` + + +The `$callback` parameter of the `ReplaceFilter` constructor accepts any PHP callable. + + +#### `ShallowCopyFilter` (type filter) + +Stop *DeepCopy* from recursively copying element, using standard `clone` instead: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ShallowCopyFilter; +use DeepCopy\TypeMatcher\TypeMatcher; +use Mockery as m; + +$this->deepCopy = new DeepCopy(); +$this->deepCopy->addTypeFilter( + new ShallowCopyFilter, + new TypeMatcher(m\MockInterface::class) +); + +$myServiceWithMocks = new MyService(m::mock(MyDependency1::class), m::mock(MyDependency2::class)); +// All mocks will be just cloned, not deep copied +``` + + +## Edge cases + +The following structures cannot be deep-copied with PHP Reflection. As a result they are shallow cloned and filters are +not applied. There is two ways for you to handle them: + +- Implement your own `__clone()` method +- Use a filter with a type matcher + + +## Contributing + +DeepCopy is distributed under the MIT license. + + +### Tests + +Running the tests is simple: + +```php +vendor/bin/phpunit +``` diff --git a/vendor/myclabs/deep-copy/composer.json b/vendor/myclabs/deep-copy/composer.json new file mode 100644 index 0000000..4108a23 --- /dev/null +++ b/vendor/myclabs/deep-copy/composer.json @@ -0,0 +1,38 @@ +{ + "name": "myclabs/deep-copy", + "type": "library", + "description": "Create deep copies (clones) of your objects", + "keywords": ["clone", "copy", "duplicate", "object", "object graph"], + "license": "MIT", + + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "autoload-dev": { + "psr-4": { + "DeepCopy\\": "fixtures/", + "DeepCopyTest\\": "tests/DeepCopyTest/" + } + }, + + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + + "config": { + "sort-packages": true + } +} diff --git a/vendor/myclabs/deep-copy/doc/clone.png b/vendor/myclabs/deep-copy/doc/clone.png new file mode 100644 index 0000000..376afd4 Binary files /dev/null and b/vendor/myclabs/deep-copy/doc/clone.png differ diff --git a/vendor/myclabs/deep-copy/doc/deep-clone.png b/vendor/myclabs/deep-copy/doc/deep-clone.png new file mode 100644 index 0000000..2b37a6d Binary files /dev/null and b/vendor/myclabs/deep-copy/doc/deep-clone.png differ diff --git a/vendor/myclabs/deep-copy/doc/deep-copy.png b/vendor/myclabs/deep-copy/doc/deep-copy.png new file mode 100644 index 0000000..68c508a Binary files /dev/null and b/vendor/myclabs/deep-copy/doc/deep-copy.png differ diff --git a/vendor/myclabs/deep-copy/doc/graph.png b/vendor/myclabs/deep-copy/doc/graph.png new file mode 100644 index 0000000..4d5c942 Binary files /dev/null and b/vendor/myclabs/deep-copy/doc/graph.png differ diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php b/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php new file mode 100644 index 0000000..2e53cf3 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php @@ -0,0 +1,289 @@ + Filter, 'matcher' => Matcher] pairs. + */ + private $filters = []; + + /** + * Type Filters to apply. + * + * @var array Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + */ + private $typeFilters = []; + + /** + * @var bool + */ + private $skipUncloneable = false; + + /** + * @var bool + */ + private $useCloneMethod; + + /** + * @param bool $useCloneMethod If set to true, when an object implements the __clone() function, it will be used + * instead of the regular deep cloning. + */ + public function __construct($useCloneMethod = false) + { + $this->useCloneMethod = $useCloneMethod; + + $this->addTypeFilter(new DateIntervalFilter(), new TypeMatcher(DateInterval::class)); + $this->addTypeFilter(new SplDoublyLinkedListFilter($this), new TypeMatcher(SplDoublyLinkedList::class)); + } + + /** + * If enabled, will not throw an exception when coming across an uncloneable property. + * + * @param $skipUncloneable + * + * @return $this + */ + public function skipUncloneable($skipUncloneable = true) + { + $this->skipUncloneable = $skipUncloneable; + + return $this; + } + + /** + * Deep copies the given object. + * + * @param mixed $object + * + * @return mixed + */ + public function copy($object) + { + $this->hashMap = []; + + return $this->recursiveCopy($object); + } + + public function addFilter(Filter $filter, Matcher $matcher) + { + $this->filters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + public function prependFilter(Filter $filter, Matcher $matcher) + { + array_unshift($this->filters, [ + 'matcher' => $matcher, + 'filter' => $filter, + ]); + } + + public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher) + { + $this->typeFilters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + private function recursiveCopy($var) + { + // Matches Type Filter + if ($filter = $this->getFirstMatchedTypeFilter($this->typeFilters, $var)) { + return $filter->apply($var); + } + + // Resource + if (is_resource($var)) { + return $var; + } + + // Array + if (is_array($var)) { + return $this->copyArray($var); + } + + // Scalar + if (! is_object($var)) { + return $var; + } + + // Object + return $this->copyObject($var); + } + + /** + * Copy an array + * @param array $array + * @return array + */ + private function copyArray(array $array) + { + foreach ($array as $key => $value) { + $array[$key] = $this->recursiveCopy($value); + } + + return $array; + } + + /** + * Copies an object. + * + * @param object $object + * + * @throws CloneException + * + * @return object + */ + private function copyObject($object) + { + $objectHash = spl_object_hash($object); + + if (isset($this->hashMap[$objectHash])) { + return $this->hashMap[$objectHash]; + } + + $reflectedObject = new ReflectionObject($object); + $isCloneable = $reflectedObject->isCloneable(); + + if (false === $isCloneable) { + if ($this->skipUncloneable) { + $this->hashMap[$objectHash] = $object; + + return $object; + } + + throw new CloneException( + sprintf( + 'The class "%s" is not cloneable.', + $reflectedObject->getName() + ) + ); + } + + $newObject = clone $object; + $this->hashMap[$objectHash] = $newObject; + + if ($this->useCloneMethod && $reflectedObject->hasMethod('__clone')) { + return $newObject; + } + + if ($newObject instanceof DateTimeInterface || $newObject instanceof DateTimeZone) { + return $newObject; + } + + foreach (ReflectionHelper::getProperties($reflectedObject) as $property) { + $this->copyObjectProperty($newObject, $property); + } + + return $newObject; + } + + private function copyObjectProperty($object, ReflectionProperty $property) + { + // Ignore static properties + if ($property->isStatic()) { + return; + } + + // Apply the filters + foreach ($this->filters as $item) { + /** @var Matcher $matcher */ + $matcher = $item['matcher']; + /** @var Filter $filter */ + $filter = $item['filter']; + + if ($matcher->matches($object, $property->getName())) { + $filter->apply( + $object, + $property->getName(), + function ($object) { + return $this->recursiveCopy($object); + } + ); + + // If a filter matches, we stop processing this property + return; + } + } + + $property->setAccessible(true); + $propertyValue = $property->getValue($object); + + // Copy the property + $property->setValue($object, $this->recursiveCopy($propertyValue)); + } + + /** + * Returns first filter that matches variable, `null` if no such filter found. + * + * @param array $filterRecords Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and + * 'matcher' with value of type {@see TypeMatcher} + * @param mixed $var + * + * @return TypeFilter|null + */ + private function getFirstMatchedTypeFilter(array $filterRecords, $var) + { + $matched = $this->first( + $filterRecords, + function (array $record) use ($var) { + /* @var TypeMatcher $matcher */ + $matcher = $record['matcher']; + + return $matcher->matches($var); + } + ); + + return isset($matched) ? $matched['filter'] : null; + } + + /** + * Returns first element that matches predicate, `null` if no such element found. + * + * @param array $elements Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + * @param callable $predicate Predicate arguments are: element. + * + * @return array|null Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and 'matcher' + * with value of type {@see TypeMatcher} or `null`. + */ + private function first(array $elements, callable $predicate) + { + foreach ($elements as $element) { + if (call_user_func($predicate, $element)) { + return $element; + } + } + + return null; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php new file mode 100644 index 0000000..c046706 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php @@ -0,0 +1,9 @@ +setAccessible(true); + $oldCollection = $reflectionProperty->getValue($object); + + $newCollection = $oldCollection->map( + function ($item) use ($objectCopier) { + return $objectCopier($item); + } + ); + + $reflectionProperty->setValue($object, $newCollection); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php new file mode 100644 index 0000000..7b33fd5 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php @@ -0,0 +1,28 @@ +setAccessible(true); + + $reflectionProperty->setValue($object, new ArrayCollection()); + } +} \ No newline at end of file diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php new file mode 100644 index 0000000..8bee8f7 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php @@ -0,0 +1,22 @@ +__load(); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php new file mode 100644 index 0000000..85ba18c --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php @@ -0,0 +1,18 @@ +callback = $callable; + } + + /** + * Replaces the object property by the result of the callback called with the object property. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + $reflectionProperty->setAccessible(true); + + $value = call_user_func($this->callback, $reflectionProperty->getValue($object)); + + $reflectionProperty->setValue($object, $value); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php new file mode 100644 index 0000000..bea86b8 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php @@ -0,0 +1,24 @@ +setAccessible(true); + $reflectionProperty->setValue($object, null); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php new file mode 100644 index 0000000..ec8856f --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php @@ -0,0 +1,22 @@ +class = $class; + $this->property = $property; + } + + /** + * Matches a specific property of a specific class. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return ($object instanceof $this->class) && $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php new file mode 100644 index 0000000..c8ec0d2 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php @@ -0,0 +1,32 @@ +property = $property; + } + + /** + * Matches a property by its name. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php new file mode 100644 index 0000000..a6b0c0b --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php @@ -0,0 +1,46 @@ +propertyType = $propertyType; + } + + /** + * {@inheritdoc} + */ + public function matches($object, $property) + { + try { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + } catch (ReflectionException $exception) { + return false; + } + + $reflectionProperty->setAccessible(true); + + return $reflectionProperty->getValue($object) instanceof $this->propertyType; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php new file mode 100644 index 0000000..742410c --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php @@ -0,0 +1,78 @@ +getProperties() does not return private properties from ancestor classes. + * + * @author muratyaman@gmail.com + * @see http://php.net/manual/en/reflectionclass.getproperties.php + * + * @param ReflectionClass $ref + * + * @return ReflectionProperty[] + */ + public static function getProperties(ReflectionClass $ref) + { + $props = $ref->getProperties(); + $propsArr = array(); + + foreach ($props as $prop) { + $propertyName = $prop->getName(); + $propsArr[$propertyName] = $prop; + } + + if ($parentClass = $ref->getParentClass()) { + $parentPropsArr = self::getProperties($parentClass); + foreach ($propsArr as $key => $property) { + $parentPropsArr[$key] = $property; + } + + return $parentPropsArr; + } + + return $propsArr; + } + + /** + * Retrieves property by name from object and all its ancestors. + * + * @param object|string $object + * @param string $name + * + * @throws PropertyException + * @throws ReflectionException + * + * @return ReflectionProperty + */ + public static function getProperty($object, $name) + { + $reflection = is_object($object) ? new ReflectionObject($object) : new ReflectionClass($object); + + if ($reflection->hasProperty($name)) { + return $reflection->getProperty($name); + } + + if ($parentClass = $reflection->getParentClass()) { + return self::getProperty($parentClass->getName(), $name); + } + + throw new PropertyException( + sprintf( + 'The class "%s" doesn\'t have a property with the given name: "%s".', + is_object($object) ? get_class($object) : $object, + $name + ) + ); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php new file mode 100644 index 0000000..becd1cf --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php @@ -0,0 +1,33 @@ + $propertyValue) { + $copy->{$propertyName} = $propertyValue; + } + + return $copy; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php new file mode 100644 index 0000000..164f8b8 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php @@ -0,0 +1,30 @@ +callback = $callable; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + return call_user_func($this->callback, $element); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php new file mode 100644 index 0000000..a5fbd7a --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php @@ -0,0 +1,17 @@ +copier = $copier; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + $newElement = clone $element; + + $copy = $this->createCopyClosure(); + + return $copy($newElement); + } + + private function createCopyClosure() + { + $copier = $this->copier; + + $copy = function (SplDoublyLinkedList $list) use ($copier) { + // Replace each element in the list with a deep copy of itself + for ($i = 1; $i <= $list->count(); $i++) { + $copy = $copier->recursiveCopy($list->shift()); + + $list->push($copy); + } + + return $list; + }; + + return Closure::bind($copy, null, DeepCopy::class); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php new file mode 100644 index 0000000..5785a7d --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php @@ -0,0 +1,13 @@ +type = $type; + } + + /** + * @param mixed $element + * + * @return boolean + */ + public function matches($element) + { + return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php new file mode 100644 index 0000000..55dcc92 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php @@ -0,0 +1,20 @@ +copy($value); + } +} diff --git a/vendor/nikic/fast-route/.gitignore b/vendor/nikic/fast-route/.gitignore new file mode 100644 index 0000000..e378a07 --- /dev/null +++ b/vendor/nikic/fast-route/.gitignore @@ -0,0 +1,5 @@ +/vendor/ +.idea/ + +# ignore lock file since we have no extra dependencies +composer.lock diff --git a/vendor/nikic/fast-route/.hhconfig b/vendor/nikic/fast-route/.hhconfig new file mode 100644 index 0000000..0c2153c --- /dev/null +++ b/vendor/nikic/fast-route/.hhconfig @@ -0,0 +1 @@ +assume_php=false diff --git a/vendor/nikic/fast-route/.travis.yml b/vendor/nikic/fast-route/.travis.yml new file mode 100644 index 0000000..10f8381 --- /dev/null +++ b/vendor/nikic/fast-route/.travis.yml @@ -0,0 +1,20 @@ +sudo: false +language: php + +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - hhvm + +script: + - ./vendor/bin/phpunit + +before_install: + - travis_retry composer self-update + +install: + - composer install diff --git a/vendor/nikic/fast-route/FastRoute.hhi b/vendor/nikic/fast-route/FastRoute.hhi new file mode 100644 index 0000000..8d50738 --- /dev/null +++ b/vendor/nikic/fast-route/FastRoute.hhi @@ -0,0 +1,126 @@ +; + } + + class RouteCollector { + public function __construct(RouteParser $routeParser, DataGenerator $dataGenerator); + public function addRoute(mixed $httpMethod, string $route, mixed $handler): void; + public function getData(): array; + } + + class Route { + public function __construct(string $httpMethod, mixed $handler, string $regex, array $variables); + public function matches(string $str): bool; + } + + interface DataGenerator { + public function addRoute(string $httpMethod, array $routeData, mixed $handler); + public function getData(): array; + } + + interface Dispatcher { + const int NOT_FOUND = 0; + const int FOUND = 1; + const int METHOD_NOT_ALLOWED = 2; + public function dispatch(string $httpMethod, string $uri): array; + } + + function simpleDispatcher( + (function(RouteCollector): void) $routeDefinitionCallback, + shape( + ?'routeParser' => classname, + ?'dataGenerator' => classname, + ?'dispatcher' => classname, + ?'routeCollector' => classname, + ) $options = shape()): Dispatcher; + + function cachedDispatcher( + (function(RouteCollector): void) $routeDefinitionCallback, + shape( + ?'routeParser' => classname, + ?'dataGenerator' => classname, + ?'dispatcher' => classname, + ?'routeCollector' => classname, + ?'cacheDisabled' => bool, + ?'cacheFile' => string, + ) $options = shape()): Dispatcher; +} + +namespace FastRoute\DataGenerator { + abstract class RegexBasedAbstract implements \FastRoute\DataGenerator { + protected abstract function getApproxChunkSize(); + protected abstract function processChunk($regexToRoutesMap); + + public function addRoute(string $httpMethod, array $routeData, mixed $handler): void; + public function getData(): array; + } + + class CharCountBased extends RegexBasedAbstract { + protected function getApproxChunkSize(): int; + protected function processChunk(array $regexToRoutesMap): array; + } + + class GroupCountBased extends RegexBasedAbstract { + protected function getApproxChunkSize(): int; + protected function processChunk(array $regexToRoutesMap): array; + } + + class GroupPosBased extends RegexBasedAbstract { + protected function getApproxChunkSize(): int; + protected function processChunk(array $regexToRoutesMap): array; + } + + class MarkBased extends RegexBasedAbstract { + protected function getApproxChunkSize(): int; + protected function processChunk(array $regexToRoutesMap): array; + } +} + +namespace FastRoute\Dispatcher { + abstract class RegexBasedAbstract implements \FastRoute\Dispatcher { + protected abstract function dispatchVariableRoute(array $routeData, string $uri): array; + + public function dispatch(string $httpMethod, string $uri): array; + } + + class GroupPosBased extends RegexBasedAbstract { + public function __construct(array $data); + protected function dispatchVariableRoute(array $routeData, string $uri): array; + } + + class GroupCountBased extends RegexBasedAbstract { + public function __construct(array $data); + protected function dispatchVariableRoute(array $routeData, string $uri): array; + } + + class CharCountBased extends RegexBasedAbstract { + public function __construct(array $data); + protected function dispatchVariableRoute(array $routeData, string $uri): array; + } + + class MarkBased extends RegexBasedAbstract { + public function __construct(array $data); + protected function dispatchVariableRoute(array $routeData, string $uri): array; + } +} + +namespace FastRoute\RouteParser { + class Std implements \FastRoute\RouteParser { + const string VARIABLE_REGEX = <<<'REGEX' +\{ + \s* ([a-zA-Z][a-zA-Z0-9_]*) \s* + (?: + : \s* ([^{}]*(?:\{(?-1)\}[^{}]*)*) + )? +\} +REGEX; + const string DEFAULT_DISPATCH_REGEX = '[^/]+'; + public function parse(string $route): array; + } +} diff --git a/vendor/nikic/fast-route/LICENSE b/vendor/nikic/fast-route/LICENSE new file mode 100644 index 0000000..478e764 --- /dev/null +++ b/vendor/nikic/fast-route/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2013 by Nikita Popov. + +Some rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/nikic/fast-route/README.md b/vendor/nikic/fast-route/README.md new file mode 100644 index 0000000..91bd466 --- /dev/null +++ b/vendor/nikic/fast-route/README.md @@ -0,0 +1,313 @@ +FastRoute - Fast request router for PHP +======================================= + +This library provides a fast implementation of a regular expression based router. [Blog post explaining how the +implementation works and why it is fast.][blog_post] + +Install +------- + +To install with composer: + +```sh +composer require nikic/fast-route +``` + +Requires PHP 5.4 or newer. + +Usage +----- + +Here's a basic usage example: + +```php +addRoute('GET', '/users', 'get_all_users_handler'); + // {id} must be a number (\d+) + $r->addRoute('GET', '/user/{id:\d+}', 'get_user_handler'); + // The /{title} suffix is optional + $r->addRoute('GET', '/articles/{id:\d+}[/{title}]', 'get_article_handler'); +}); + +// Fetch method and URI from somewhere +$httpMethod = $_SERVER['REQUEST_METHOD']; +$uri = $_SERVER['REQUEST_URI']; + +// Strip query string (?foo=bar) and decode URI +if (false !== $pos = strpos($uri, '?')) { + $uri = substr($uri, 0, $pos); +} +$uri = rawurldecode($uri); + +$routeInfo = $dispatcher->dispatch($httpMethod, $uri); +switch ($routeInfo[0]) { + case FastRoute\Dispatcher::NOT_FOUND: + // ... 404 Not Found + break; + case FastRoute\Dispatcher::METHOD_NOT_ALLOWED: + $allowedMethods = $routeInfo[1]; + // ... 405 Method Not Allowed + break; + case FastRoute\Dispatcher::FOUND: + $handler = $routeInfo[1]; + $vars = $routeInfo[2]; + // ... call $handler with $vars + break; +} +``` + +### Defining routes + +The routes are defined by calling the `FastRoute\simpleDispatcher()` function, which accepts +a callable taking a `FastRoute\RouteCollector` instance. The routes are added by calling +`addRoute()` on the collector instance: + +```php +$r->addRoute($method, $routePattern, $handler); +``` + +The `$method` is an uppercase HTTP method string for which a certain route should match. It +is possible to specify multiple valid methods using an array: + +```php +// These two calls +$r->addRoute('GET', '/test', 'handler'); +$r->addRoute('POST', '/test', 'handler'); +// Are equivalent to this one call +$r->addRoute(['GET', 'POST'], '/test', 'handler'); +``` + +By default the `$routePattern` uses a syntax where `{foo}` specifies a placeholder with name `foo` +and matching the regex `[^/]+`. To adjust the pattern the placeholder matches, you can specify +a custom pattern by writing `{bar:[0-9]+}`. Some examples: + +```php +// Matches /user/42, but not /user/xyz +$r->addRoute('GET', '/user/{id:\d+}', 'handler'); + +// Matches /user/foobar, but not /user/foo/bar +$r->addRoute('GET', '/user/{name}', 'handler'); + +// Matches /user/foo/bar as well +$r->addRoute('GET', '/user/{name:.+}', 'handler'); +``` + +Custom patterns for route placeholders cannot use capturing groups. For example `{lang:(en|de)}` +is not a valid placeholder, because `()` is a capturing group. Instead you can use either +`{lang:en|de}` or `{lang:(?:en|de)}`. + +Furthermore parts of the route enclosed in `[...]` are considered optional, so that `/foo[bar]` +will match both `/foo` and `/foobar`. Optional parts are only supported in a trailing position, +not in the middle of a route. + +```php +// This route +$r->addRoute('GET', '/user/{id:\d+}[/{name}]', 'handler'); +// Is equivalent to these two routes +$r->addRoute('GET', '/user/{id:\d+}', 'handler'); +$r->addRoute('GET', '/user/{id:\d+}/{name}', 'handler'); + +// Multiple nested optional parts are possible as well +$r->addRoute('GET', '/user[/{id:\d+}[/{name}]]', 'handler'); + +// This route is NOT valid, because optional parts can only occur at the end +$r->addRoute('GET', '/user[/{id:\d+}]/{name}', 'handler'); +``` + +The `$handler` parameter does not necessarily have to be a callback, it could also be a controller +class name or any other kind of data you wish to associate with the route. FastRoute only tells you +which handler corresponds to your URI, how you interpret it is up to you. + +#### Shorcut methods for common request methods + +For the `GET`, `POST`, `PUT`, `PATCH`, `DELETE` and `HEAD` request methods shortcut methods are available. For example: + +```php +$r->get('/get-route', 'get_handler'); +$r->post('/post-route', 'post_handler'); +``` + +Is equivalent to: + +```php +$r->addRoute('GET', '/get-route', 'get_handler'); +$r->addRoute('POST', '/post-route', 'post_handler'); +``` + +#### Route Groups + +Additionally, you can specify routes inside of a group. All routes defined inside a group will have a common prefix. + +For example, defining your routes as: + +```php +$r->addGroup('/admin', function (RouteCollector $r) { + $r->addRoute('GET', '/do-something', 'handler'); + $r->addRoute('GET', '/do-another-thing', 'handler'); + $r->addRoute('GET', '/do-something-else', 'handler'); +}); +``` + +Will have the same result as: + + ```php +$r->addRoute('GET', '/admin/do-something', 'handler'); +$r->addRoute('GET', '/admin/do-another-thing', 'handler'); +$r->addRoute('GET', '/admin/do-something-else', 'handler'); + ``` + +Nested groups are also supported, in which case the prefixes of all the nested groups are combined. + +### Caching + +The reason `simpleDispatcher` accepts a callback for defining the routes is to allow seamless +caching. By using `cachedDispatcher` instead of `simpleDispatcher` you can cache the generated +routing data and construct the dispatcher from the cached information: + +```php +addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); + $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1'); + $r->addRoute('GET', '/user/{name}', 'handler2'); +}, [ + 'cacheFile' => __DIR__ . '/route.cache', /* required */ + 'cacheDisabled' => IS_DEBUG_ENABLED, /* optional, enabled by default */ +]); +``` + +The second parameter to the function is an options array, which can be used to specify the cache +file location, among other things. + +### Dispatching a URI + +A URI is dispatched by calling the `dispatch()` method of the created dispatcher. This method +accepts the HTTP method and a URI. Getting those two bits of information (and normalizing them +appropriately) is your job - this library is not bound to the PHP web SAPIs. + +The `dispatch()` method returns an array whose first element contains a status code. It is one +of `Dispatcher::NOT_FOUND`, `Dispatcher::METHOD_NOT_ALLOWED` and `Dispatcher::FOUND`. For the +method not allowed status the second array element contains a list of HTTP methods allowed for +the supplied URI. For example: + + [FastRoute\Dispatcher::METHOD_NOT_ALLOWED, ['GET', 'POST']] + +> **NOTE:** The HTTP specification requires that a `405 Method Not Allowed` response include the +`Allow:` header to detail available methods for the requested resource. Applications using FastRoute +should use the second array element to add this header when relaying a 405 response. + +For the found status the second array element is the handler that was associated with the route +and the third array element is a dictionary of placeholder names to their values. For example: + + /* Routing against GET /user/nikic/42 */ + + [FastRoute\Dispatcher::FOUND, 'handler0', ['name' => 'nikic', 'id' => '42']] + +### Overriding the route parser and dispatcher + +The routing process makes use of three components: A route parser, a data generator and a +dispatcher. The three components adhere to the following interfaces: + +```php + 'FastRoute\\RouteParser\\Std', + 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', + 'dispatcher' => 'FastRoute\\Dispatcher\\GroupCountBased', +]); +``` + +The above options array corresponds to the defaults. By replacing `GroupCountBased` by +`GroupPosBased` you could switch to a different dispatching strategy. + +### A Note on HEAD Requests + +The HTTP spec requires servers to [support both GET and HEAD methods][2616-511]: + +> The methods GET and HEAD MUST be supported by all general-purpose servers + +To avoid forcing users to manually register HEAD routes for each resource we fallback to matching an +available GET route for a given resource. The PHP web SAPI transparently removes the entity body +from HEAD responses so this behavior has no effect on the vast majority of users. + +However, implementers using FastRoute outside the web SAPI environment (e.g. a custom server) MUST +NOT send entity bodies generated in response to HEAD requests. If you are a non-SAPI user this is +*your responsibility*; FastRoute has no purview to prevent you from breaking HTTP in such cases. + +Finally, note that applications MAY always specify their own HEAD method route for a given +resource to bypass this behavior entirely. + +### Credits + +This library is based on a router that [Levi Morrison][levi] implemented for the Aerys server. + +A large number of tests, as well as HTTP compliance considerations, were provided by [Daniel Lowrey][rdlowrey]. + + +[2616-511]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.1 "RFC 2616 Section 5.1.1" +[blog_post]: http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html +[levi]: https://github.com/morrisonlevi +[rdlowrey]: https://github.com/rdlowrey diff --git a/vendor/nikic/fast-route/composer.json b/vendor/nikic/fast-route/composer.json new file mode 100644 index 0000000..fb446a2 --- /dev/null +++ b/vendor/nikic/fast-route/composer.json @@ -0,0 +1,24 @@ +{ + "name": "nikic/fast-route", + "description": "Fast request router for PHP", + "keywords": ["routing", "router"], + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": ["src/functions.php"] + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + } +} diff --git a/vendor/nikic/fast-route/phpunit.xml b/vendor/nikic/fast-route/phpunit.xml new file mode 100644 index 0000000..3c807b6 --- /dev/null +++ b/vendor/nikic/fast-route/phpunit.xml @@ -0,0 +1,24 @@ + + + + + + ./test/ + + + + + + ./src/ + + + diff --git a/vendor/nikic/fast-route/psalm.xml b/vendor/nikic/fast-route/psalm.xml new file mode 100644 index 0000000..0dca5d7 --- /dev/null +++ b/vendor/nikic/fast-route/psalm.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/nikic/fast-route/src/BadRouteException.php b/vendor/nikic/fast-route/src/BadRouteException.php new file mode 100644 index 0000000..62262ec --- /dev/null +++ b/vendor/nikic/fast-route/src/BadRouteException.php @@ -0,0 +1,7 @@ + $route) { + $suffixLen++; + $suffix .= "\t"; + + $regexes[] = '(?:' . $regex . '/(\t{' . $suffixLen . '})\t{' . ($count - $suffixLen) . '})'; + $routeMap[$suffix] = [$route->handler, $route->variables]; + } + + $regex = '~^(?|' . implode('|', $regexes) . ')$~'; + return ['regex' => $regex, 'suffix' => '/' . $suffix, 'routeMap' => $routeMap]; + } +} diff --git a/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php b/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php new file mode 100644 index 0000000..54d9a05 --- /dev/null +++ b/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php @@ -0,0 +1,30 @@ + $route) { + $numVariables = count($route->variables); + $numGroups = max($numGroups, $numVariables); + + $regexes[] = $regex . str_repeat('()', $numGroups - $numVariables); + $routeMap[$numGroups + 1] = [$route->handler, $route->variables]; + + ++$numGroups; + } + + $regex = '~^(?|' . implode('|', $regexes) . ')$~'; + return ['regex' => $regex, 'routeMap' => $routeMap]; + } +} diff --git a/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php b/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php new file mode 100644 index 0000000..fc4dc0a --- /dev/null +++ b/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php @@ -0,0 +1,27 @@ + $route) { + $regexes[] = $regex; + $routeMap[$offset] = [$route->handler, $route->variables]; + + $offset += count($route->variables); + } + + $regex = '~^(?:' . implode('|', $regexes) . ')$~'; + return ['regex' => $regex, 'routeMap' => $routeMap]; + } +} diff --git a/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php b/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php new file mode 100644 index 0000000..0aebed9 --- /dev/null +++ b/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php @@ -0,0 +1,27 @@ + $route) { + $regexes[] = $regex . '(*MARK:' . $markName . ')'; + $routeMap[$markName] = [$route->handler, $route->variables]; + + ++$markName; + } + + $regex = '~^(?|' . implode('|', $regexes) . ')$~'; + return ['regex' => $regex, 'routeMap' => $routeMap]; + } +} diff --git a/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php b/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php new file mode 100644 index 0000000..6457290 --- /dev/null +++ b/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php @@ -0,0 +1,186 @@ +isStaticRoute($routeData)) { + $this->addStaticRoute($httpMethod, $routeData, $handler); + } else { + $this->addVariableRoute($httpMethod, $routeData, $handler); + } + } + + /** + * @return mixed[] + */ + public function getData() + { + if (empty($this->methodToRegexToRoutesMap)) { + return [$this->staticRoutes, []]; + } + + return [$this->staticRoutes, $this->generateVariableRouteData()]; + } + + /** + * @return mixed[] + */ + private function generateVariableRouteData() + { + $data = []; + foreach ($this->methodToRegexToRoutesMap as $method => $regexToRoutesMap) { + $chunkSize = $this->computeChunkSize(count($regexToRoutesMap)); + $chunks = array_chunk($regexToRoutesMap, $chunkSize, true); + $data[$method] = array_map([$this, 'processChunk'], $chunks); + } + return $data; + } + + /** + * @param int + * @return int + */ + private function computeChunkSize($count) + { + $numParts = max(1, round($count / $this->getApproxChunkSize())); + return (int) ceil($count / $numParts); + } + + /** + * @param mixed[] + * @return bool + */ + private function isStaticRoute($routeData) + { + return count($routeData) === 1 && is_string($routeData[0]); + } + + private function addStaticRoute($httpMethod, $routeData, $handler) + { + $routeStr = $routeData[0]; + + if (isset($this->staticRoutes[$httpMethod][$routeStr])) { + throw new BadRouteException(sprintf( + 'Cannot register two routes matching "%s" for method "%s"', + $routeStr, $httpMethod + )); + } + + if (isset($this->methodToRegexToRoutesMap[$httpMethod])) { + foreach ($this->methodToRegexToRoutesMap[$httpMethod] as $route) { + if ($route->matches($routeStr)) { + throw new BadRouteException(sprintf( + 'Static route "%s" is shadowed by previously defined variable route "%s" for method "%s"', + $routeStr, $route->regex, $httpMethod + )); + } + } + } + + $this->staticRoutes[$httpMethod][$routeStr] = $handler; + } + + private function addVariableRoute($httpMethod, $routeData, $handler) + { + list($regex, $variables) = $this->buildRegexForRoute($routeData); + + if (isset($this->methodToRegexToRoutesMap[$httpMethod][$regex])) { + throw new BadRouteException(sprintf( + 'Cannot register two routes matching "%s" for method "%s"', + $regex, $httpMethod + )); + } + + $this->methodToRegexToRoutesMap[$httpMethod][$regex] = new Route( + $httpMethod, $handler, $regex, $variables + ); + } + + /** + * @param mixed[] + * @return mixed[] + */ + private function buildRegexForRoute($routeData) + { + $regex = ''; + $variables = []; + foreach ($routeData as $part) { + if (is_string($part)) { + $regex .= preg_quote($part, '~'); + continue; + } + + list($varName, $regexPart) = $part; + + if (isset($variables[$varName])) { + throw new BadRouteException(sprintf( + 'Cannot use the same placeholder "%s" twice', $varName + )); + } + + if ($this->regexHasCapturingGroups($regexPart)) { + throw new BadRouteException(sprintf( + 'Regex "%s" for parameter "%s" contains a capturing group', + $regexPart, $varName + )); + } + + $variables[$varName] = $varName; + $regex .= '(' . $regexPart . ')'; + } + + return [$regex, $variables]; + } + + /** + * @param string + * @return bool + */ + private function regexHasCapturingGroups($regex) + { + if (false === strpos($regex, '(')) { + // Needs to have at least a ( to contain a capturing group + return false; + } + + // Semi-accurate detection for capturing groups + return (bool) preg_match( + '~ + (?: + \(\?\( + | \[ [^\]\\\\]* (?: \\\\ . [^\]\\\\]* )* \] + | \\\\ . + ) (*SKIP)(*FAIL) | + \( + (?! + \? (?! <(?![!=]) | P< | \' ) + | \* + ) + ~x', + $regex + ); + } +} diff --git a/vendor/nikic/fast-route/src/Dispatcher.php b/vendor/nikic/fast-route/src/Dispatcher.php new file mode 100644 index 0000000..4ae72a3 --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher.php @@ -0,0 +1,26 @@ + 'value', ...]] + * + * @param string $httpMethod + * @param string $uri + * + * @return array + */ + public function dispatch($httpMethod, $uri); +} diff --git a/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php b/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php new file mode 100644 index 0000000..ef1eec1 --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php @@ -0,0 +1,31 @@ +staticRouteMap, $this->variableRouteData) = $data; + } + + protected function dispatchVariableRoute($routeData, $uri) + { + foreach ($routeData as $data) { + if (!preg_match($data['regex'], $uri . $data['suffix'], $matches)) { + continue; + } + + list($handler, $varNames) = $data['routeMap'][end($matches)]; + + $vars = []; + $i = 0; + foreach ($varNames as $varName) { + $vars[$varName] = $matches[++$i]; + } + return [self::FOUND, $handler, $vars]; + } + + return [self::NOT_FOUND]; + } +} diff --git a/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php b/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php new file mode 100644 index 0000000..493e7a9 --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php @@ -0,0 +1,31 @@ +staticRouteMap, $this->variableRouteData) = $data; + } + + protected function dispatchVariableRoute($routeData, $uri) + { + foreach ($routeData as $data) { + if (!preg_match($data['regex'], $uri, $matches)) { + continue; + } + + list($handler, $varNames) = $data['routeMap'][count($matches)]; + + $vars = []; + $i = 0; + foreach ($varNames as $varName) { + $vars[$varName] = $matches[++$i]; + } + return [self::FOUND, $handler, $vars]; + } + + return [self::NOT_FOUND]; + } +} diff --git a/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php b/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php new file mode 100644 index 0000000..498220e --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php @@ -0,0 +1,33 @@ +staticRouteMap, $this->variableRouteData) = $data; + } + + protected function dispatchVariableRoute($routeData, $uri) + { + foreach ($routeData as $data) { + if (!preg_match($data['regex'], $uri, $matches)) { + continue; + } + + // find first non-empty match + for ($i = 1; '' === $matches[$i]; ++$i); + + list($handler, $varNames) = $data['routeMap'][$i]; + + $vars = []; + foreach ($varNames as $varName) { + $vars[$varName] = $matches[$i++]; + } + return [self::FOUND, $handler, $vars]; + } + + return [self::NOT_FOUND]; + } +} diff --git a/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php b/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php new file mode 100644 index 0000000..22eb09b --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php @@ -0,0 +1,31 @@ +staticRouteMap, $this->variableRouteData) = $data; + } + + protected function dispatchVariableRoute($routeData, $uri) + { + foreach ($routeData as $data) { + if (!preg_match($data['regex'], $uri, $matches)) { + continue; + } + + list($handler, $varNames) = $data['routeMap'][$matches['MARK']]; + + $vars = []; + $i = 0; + foreach ($varNames as $varName) { + $vars[$varName] = $matches[++$i]; + } + return [self::FOUND, $handler, $vars]; + } + + return [self::NOT_FOUND]; + } +} diff --git a/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php b/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php new file mode 100644 index 0000000..206e879 --- /dev/null +++ b/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php @@ -0,0 +1,88 @@ +staticRouteMap[$httpMethod][$uri])) { + $handler = $this->staticRouteMap[$httpMethod][$uri]; + return [self::FOUND, $handler, []]; + } + + $varRouteData = $this->variableRouteData; + if (isset($varRouteData[$httpMethod])) { + $result = $this->dispatchVariableRoute($varRouteData[$httpMethod], $uri); + if ($result[0] === self::FOUND) { + return $result; + } + } + + // For HEAD requests, attempt fallback to GET + if ($httpMethod === 'HEAD') { + if (isset($this->staticRouteMap['GET'][$uri])) { + $handler = $this->staticRouteMap['GET'][$uri]; + return [self::FOUND, $handler, []]; + } + if (isset($varRouteData['GET'])) { + $result = $this->dispatchVariableRoute($varRouteData['GET'], $uri); + if ($result[0] === self::FOUND) { + return $result; + } + } + } + + // If nothing else matches, try fallback routes + if (isset($this->staticRouteMap['*'][$uri])) { + $handler = $this->staticRouteMap['*'][$uri]; + return [self::FOUND, $handler, []]; + } + if (isset($varRouteData['*'])) { + $result = $this->dispatchVariableRoute($varRouteData['*'], $uri); + if ($result[0] === self::FOUND) { + return $result; + } + } + + // Find allowed methods for this URI by matching against all other HTTP methods as well + $allowedMethods = []; + + foreach ($this->staticRouteMap as $method => $uriMap) { + if ($method !== $httpMethod && isset($uriMap[$uri])) { + $allowedMethods[] = $method; + } + } + + foreach ($varRouteData as $method => $routeData) { + if ($method === $httpMethod) { + continue; + } + + $result = $this->dispatchVariableRoute($routeData, $uri); + if ($result[0] === self::FOUND) { + $allowedMethods[] = $method; + } + } + + // If there are no allowed methods the route simply does not exist + if ($allowedMethods) { + return [self::METHOD_NOT_ALLOWED, $allowedMethods]; + } + + return [self::NOT_FOUND]; + } +} diff --git a/vendor/nikic/fast-route/src/Route.php b/vendor/nikic/fast-route/src/Route.php new file mode 100644 index 0000000..e1bf7dd --- /dev/null +++ b/vendor/nikic/fast-route/src/Route.php @@ -0,0 +1,47 @@ +httpMethod = $httpMethod; + $this->handler = $handler; + $this->regex = $regex; + $this->variables = $variables; + } + + /** + * Tests whether this route matches the given string. + * + * @param string $str + * + * @return bool + */ + public function matches($str) + { + $regex = '~^' . $this->regex . '$~'; + return (bool) preg_match($regex, $str); + } +} diff --git a/vendor/nikic/fast-route/src/RouteCollector.php b/vendor/nikic/fast-route/src/RouteCollector.php new file mode 100644 index 0000000..c1c1762 --- /dev/null +++ b/vendor/nikic/fast-route/src/RouteCollector.php @@ -0,0 +1,152 @@ +routeParser = $routeParser; + $this->dataGenerator = $dataGenerator; + $this->currentGroupPrefix = ''; + } + + /** + * Adds a route to the collection. + * + * The syntax used in the $route string depends on the used route parser. + * + * @param string|string[] $httpMethod + * @param string $route + * @param mixed $handler + */ + public function addRoute($httpMethod, $route, $handler) + { + $route = $this->currentGroupPrefix . $route; + $routeDatas = $this->routeParser->parse($route); + foreach ((array) $httpMethod as $method) { + foreach ($routeDatas as $routeData) { + $this->dataGenerator->addRoute($method, $routeData, $handler); + } + } + } + + /** + * Create a route group with a common prefix. + * + * All routes created in the passed callback will have the given group prefix prepended. + * + * @param string $prefix + * @param callable $callback + */ + public function addGroup($prefix, callable $callback) + { + $previousGroupPrefix = $this->currentGroupPrefix; + $this->currentGroupPrefix = $previousGroupPrefix . $prefix; + $callback($this); + $this->currentGroupPrefix = $previousGroupPrefix; + } + + /** + * Adds a GET route to the collection + * + * This is simply an alias of $this->addRoute('GET', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function get($route, $handler) + { + $this->addRoute('GET', $route, $handler); + } + + /** + * Adds a POST route to the collection + * + * This is simply an alias of $this->addRoute('POST', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function post($route, $handler) + { + $this->addRoute('POST', $route, $handler); + } + + /** + * Adds a PUT route to the collection + * + * This is simply an alias of $this->addRoute('PUT', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function put($route, $handler) + { + $this->addRoute('PUT', $route, $handler); + } + + /** + * Adds a DELETE route to the collection + * + * This is simply an alias of $this->addRoute('DELETE', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function delete($route, $handler) + { + $this->addRoute('DELETE', $route, $handler); + } + + /** + * Adds a PATCH route to the collection + * + * This is simply an alias of $this->addRoute('PATCH', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function patch($route, $handler) + { + $this->addRoute('PATCH', $route, $handler); + } + + /** + * Adds a HEAD route to the collection + * + * This is simply an alias of $this->addRoute('HEAD', $route, $handler) + * + * @param string $route + * @param mixed $handler + */ + public function head($route, $handler) + { + $this->addRoute('HEAD', $route, $handler); + } + + /** + * Returns the collected route data, as provided by the data generator. + * + * @return array + */ + public function getData() + { + return $this->dataGenerator->getData(); + } +} diff --git a/vendor/nikic/fast-route/src/RouteParser.php b/vendor/nikic/fast-route/src/RouteParser.php new file mode 100644 index 0000000..6a7685c --- /dev/null +++ b/vendor/nikic/fast-route/src/RouteParser.php @@ -0,0 +1,37 @@ + $segment) { + if ($segment === '' && $n !== 0) { + throw new BadRouteException('Empty optional part'); + } + + $currentRoute .= $segment; + $routeDatas[] = $this->parsePlaceholders($currentRoute); + } + return $routeDatas; + } + + /** + * Parses a route string that does not contain optional segments. + * + * @param string + * @return mixed[] + */ + private function parsePlaceholders($route) + { + if (!preg_match_all( + '~' . self::VARIABLE_REGEX . '~x', $route, $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + )) { + return [$route]; + } + + $offset = 0; + $routeData = []; + foreach ($matches as $set) { + if ($set[0][1] > $offset) { + $routeData[] = substr($route, $offset, $set[0][1] - $offset); + } + $routeData[] = [ + $set[1][0], + isset($set[2]) ? trim($set[2][0]) : self::DEFAULT_DISPATCH_REGEX + ]; + $offset = $set[0][1] + strlen($set[0][0]); + } + + if ($offset !== strlen($route)) { + $routeData[] = substr($route, $offset); + } + + return $routeData; + } +} diff --git a/vendor/nikic/fast-route/src/bootstrap.php b/vendor/nikic/fast-route/src/bootstrap.php new file mode 100644 index 0000000..0bce3a4 --- /dev/null +++ b/vendor/nikic/fast-route/src/bootstrap.php @@ -0,0 +1,12 @@ + 'FastRoute\\RouteParser\\Std', + 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', + 'dispatcher' => 'FastRoute\\Dispatcher\\GroupCountBased', + 'routeCollector' => 'FastRoute\\RouteCollector', + ]; + + /** @var RouteCollector $routeCollector */ + $routeCollector = new $options['routeCollector']( + new $options['routeParser'], new $options['dataGenerator'] + ); + $routeDefinitionCallback($routeCollector); + + return new $options['dispatcher']($routeCollector->getData()); + } + + /** + * @param callable $routeDefinitionCallback + * @param array $options + * + * @return Dispatcher + */ + function cachedDispatcher(callable $routeDefinitionCallback, array $options = []) + { + $options += [ + 'routeParser' => 'FastRoute\\RouteParser\\Std', + 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', + 'dispatcher' => 'FastRoute\\Dispatcher\\GroupCountBased', + 'routeCollector' => 'FastRoute\\RouteCollector', + 'cacheDisabled' => false, + ]; + + if (!isset($options['cacheFile'])) { + throw new \LogicException('Must specify "cacheFile" option'); + } + + if (!$options['cacheDisabled'] && file_exists($options['cacheFile'])) { + $dispatchData = require $options['cacheFile']; + if (!is_array($dispatchData)) { + throw new \RuntimeException('Invalid cache file "' . $options['cacheFile'] . '"'); + } + return new $options['dispatcher']($dispatchData); + } + + $routeCollector = new $options['routeCollector']( + new $options['routeParser'], new $options['dataGenerator'] + ); + $routeDefinitionCallback($routeCollector); + + /** @var RouteCollector $routeCollector */ + $dispatchData = $routeCollector->getData(); + if (!$options['cacheDisabled']) { + file_put_contents( + $options['cacheFile'], + ' $this->getDataGeneratorClass(), + 'dispatcher' => $this->getDispatcherClass() + ]; + } + + /** + * @dataProvider provideFoundDispatchCases + */ + public function testFoundDispatches($method, $uri, $callback, $handler, $argDict) + { + $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); + $info = $dispatcher->dispatch($method, $uri); + $this->assertSame($dispatcher::FOUND, $info[0]); + $this->assertSame($handler, $info[1]); + $this->assertSame($argDict, $info[2]); + } + + /** + * @dataProvider provideNotFoundDispatchCases + */ + public function testNotFoundDispatches($method, $uri, $callback) + { + $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); + $routeInfo = $dispatcher->dispatch($method, $uri); + $this->assertArrayNotHasKey(1, $routeInfo, + 'NOT_FOUND result must only contain a single element in the returned info array' + ); + $this->assertSame($dispatcher::NOT_FOUND, $routeInfo[0]); + } + + /** + * @dataProvider provideMethodNotAllowedDispatchCases + */ + public function testMethodNotAllowedDispatches($method, $uri, $callback, $availableMethods) + { + $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); + $routeInfo = $dispatcher->dispatch($method, $uri); + $this->assertArrayHasKey(1, $routeInfo, + 'METHOD_NOT_ALLOWED result must return an array of allowed methods at index 1' + ); + + list($routedStatus, $methodArray) = $dispatcher->dispatch($method, $uri); + $this->assertSame($dispatcher::METHOD_NOT_ALLOWED, $routedStatus); + $this->assertSame($availableMethods, $methodArray); + } + + /** + * @expectedException \FastRoute\BadRouteException + * @expectedExceptionMessage Cannot use the same placeholder "test" twice + */ + public function testDuplicateVariableNameError() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { + $r->addRoute('GET', '/foo/{test}/{test:\d+}', 'handler0'); + }, $this->generateDispatcherOptions()); + } + + /** + * @expectedException \FastRoute\BadRouteException + * @expectedExceptionMessage Cannot register two routes matching "/user/([^/]+)" for method "GET" + */ + public function testDuplicateVariableRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { + $r->addRoute('GET', '/user/{id}', 'handler0'); // oops, forgot \d+ restriction ;) + $r->addRoute('GET', '/user/{name}', 'handler1'); + }, $this->generateDispatcherOptions()); + } + + /** + * @expectedException \FastRoute\BadRouteException + * @expectedExceptionMessage Cannot register two routes matching "/user" for method "GET" + */ + public function testDuplicateStaticRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { + $r->addRoute('GET', '/user', 'handler0'); + $r->addRoute('GET', '/user', 'handler1'); + }, $this->generateDispatcherOptions()); + } + + /** + * @expectedException \FastRoute\BadRouteException + * @expectedExceptionMessage Static route "/user/nikic" is shadowed by previously defined variable route "/user/([^/]+)" for method "GET" + */ + public function testShadowedStaticRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}', 'handler0'); + $r->addRoute('GET', '/user/nikic', 'handler1'); + }, $this->generateDispatcherOptions()); + } + + /** + * @expectedException \FastRoute\BadRouteException + * @expectedExceptionMessage Regex "(en|de)" for parameter "lang" contains a capturing group + */ + public function testCapturing() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { + $r->addRoute('GET', '/{lang:(en|de)}', 'handler0'); + }, $this->generateDispatcherOptions()); + } + + public function provideFoundDispatchCases() + { + $cases = []; + + // 0 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/resource/123/456', 'handler0'); + }; + + $method = 'GET'; + $uri = '/resource/123/456'; + $handler = 'handler0'; + $argDict = []; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 1 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/handler0', 'handler0'); + $r->addRoute('GET', '/handler1', 'handler1'); + $r->addRoute('GET', '/handler2', 'handler2'); + }; + + $method = 'GET'; + $uri = '/handler2'; + $handler = 'handler2'; + $argDict = []; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 2 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); + $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1'); + $r->addRoute('GET', '/user/{name}', 'handler2'); + }; + + $method = 'GET'; + $uri = '/user/rdlowrey'; + $handler = 'handler2'; + $argDict = ['name' => 'rdlowrey']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 3 --------------------------------------------------------------------------------------> + + // reuse $callback from #2 + + $method = 'GET'; + $uri = '/user/12345'; + $handler = 'handler1'; + $argDict = ['id' => '12345']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 4 --------------------------------------------------------------------------------------> + + // reuse $callback from #3 + + $method = 'GET'; + $uri = '/user/NaN'; + $handler = 'handler2'; + $argDict = ['name' => 'NaN']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 5 --------------------------------------------------------------------------------------> + + // reuse $callback from #4 + + $method = 'GET'; + $uri = '/user/rdlowrey/12345'; + $handler = 'handler0'; + $argDict = ['name' => 'rdlowrey', 'id' => '12345']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 6 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler0'); + $r->addRoute('GET', '/user/12345/extension', 'handler1'); + $r->addRoute('GET', '/user/{id:[0-9]+}.{extension}', 'handler2'); + }; + + $method = 'GET'; + $uri = '/user/12345.svg'; + $handler = 'handler2'; + $argDict = ['id' => '12345', 'extension' => 'svg']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 7 ----- Test GET method fallback on HEAD route miss ------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}', 'handler0'); + $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler1'); + $r->addRoute('GET', '/static0', 'handler2'); + $r->addRoute('GET', '/static1', 'handler3'); + $r->addRoute('HEAD', '/static1', 'handler4'); + }; + + $method = 'HEAD'; + $uri = '/user/rdlowrey'; + $handler = 'handler0'; + $argDict = ['name' => 'rdlowrey']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 8 ----- Test GET method fallback on HEAD route miss ------------------------------------> + + // reuse $callback from #7 + + $method = 'HEAD'; + $uri = '/user/rdlowrey/1234'; + $handler = 'handler1'; + $argDict = ['name' => 'rdlowrey', 'id' => '1234']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 9 ----- Test GET method fallback on HEAD route miss ------------------------------------> + + // reuse $callback from #8 + + $method = 'HEAD'; + $uri = '/static0'; + $handler = 'handler2'; + $argDict = []; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 10 ---- Test existing HEAD route used if available (no fallback) -----------------------> + + // reuse $callback from #9 + + $method = 'HEAD'; + $uri = '/static1'; + $handler = 'handler4'; + $argDict = []; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 11 ---- More specified routes are not shadowed by less specific of another method ------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}', 'handler0'); + $r->addRoute('POST', '/user/{name:[a-z]+}', 'handler1'); + }; + + $method = 'POST'; + $uri = '/user/rdlowrey'; + $handler = 'handler1'; + $argDict = ['name' => 'rdlowrey']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 12 ---- Handler of more specific routes is used, if it occurs first --------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}', 'handler0'); + $r->addRoute('POST', '/user/{name:[a-z]+}', 'handler1'); + $r->addRoute('POST', '/user/{name}', 'handler2'); + }; + + $method = 'POST'; + $uri = '/user/rdlowrey'; + $handler = 'handler1'; + $argDict = ['name' => 'rdlowrey']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 13 ---- Route with constant suffix -----------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}', 'handler0'); + $r->addRoute('GET', '/user/{name}/edit', 'handler1'); + }; + + $method = 'GET'; + $uri = '/user/rdlowrey/edit'; + $handler = 'handler1'; + $argDict = ['name' => 'rdlowrey']; + + $cases[] = [$method, $uri, $callback, $handler, $argDict]; + + // 14 ---- Handle multiple methods with the same handler ----------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute(['GET', 'POST'], '/user', 'handlerGetPost'); + $r->addRoute(['DELETE'], '/user', 'handlerDelete'); + $r->addRoute([], '/user', 'handlerNone'); + }; + + $argDict = []; + $cases[] = ['GET', '/user', $callback, 'handlerGetPost', $argDict]; + $cases[] = ['POST', '/user', $callback, 'handlerGetPost', $argDict]; + $cases[] = ['DELETE', '/user', $callback, 'handlerDelete', $argDict]; + + // 17 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('POST', '/user.json', 'handler0'); + $r->addRoute('GET', '/{entity}.json', 'handler1'); + }; + + $cases[] = ['GET', '/user.json', $callback, 'handler1', ['entity' => 'user']]; + + // 18 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '', 'handler0'); + }; + + $cases[] = ['GET', '', $callback, 'handler0', []]; + + // 19 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('HEAD', '/a/{foo}', 'handler0'); + $r->addRoute('GET', '/b/{foo}', 'handler1'); + }; + + $cases[] = ['HEAD', '/b/bar', $callback, 'handler1', ['foo' => 'bar']]; + + // 20 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('HEAD', '/a', 'handler0'); + $r->addRoute('GET', '/b', 'handler1'); + }; + + $cases[] = ['HEAD', '/b', $callback, 'handler1', []]; + + // 21 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/foo', 'handler0'); + $r->addRoute('HEAD', '/{bar}', 'handler1'); + }; + + $cases[] = ['HEAD', '/foo', $callback, 'handler1', ['bar' => 'foo']]; + + // 22 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('*', '/user', 'handler0'); + $r->addRoute('*', '/{user}', 'handler1'); + $r->addRoute('GET', '/user', 'handler2'); + }; + + $cases[] = ['GET', '/user', $callback, 'handler2', []]; + + // 23 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('*', '/user', 'handler0'); + $r->addRoute('GET', '/user', 'handler1'); + }; + + $cases[] = ['POST', '/user', $callback, 'handler0', []]; + + // 24 ---- + + $cases[] = ['HEAD', '/user', $callback, 'handler1', []]; + + // 25 ---- + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/{bar}', 'handler0'); + $r->addRoute('*', '/foo', 'handler1'); + }; + + $cases[] = ['GET', '/foo', $callback, 'handler0', ['bar' => 'foo']]; + + // 26 ---- + + $callback = function(RouteCollector $r) { + $r->addRoute('GET', '/user', 'handler0'); + $r->addRoute('*', '/{foo:.*}', 'handler1'); + }; + + $cases[] = ['POST', '/bar', $callback, 'handler1', ['foo' => 'bar']]; + + // x --------------------------------------------------------------------------------------> + + return $cases; + } + + public function provideNotFoundDispatchCases() + { + $cases = []; + + // 0 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/resource/123/456', 'handler0'); + }; + + $method = 'GET'; + $uri = '/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 1 --------------------------------------------------------------------------------------> + + // reuse callback from #0 + $method = 'POST'; + $uri = '/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 2 --------------------------------------------------------------------------------------> + + // reuse callback from #1 + $method = 'PUT'; + $uri = '/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 3 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/handler0', 'handler0'); + $r->addRoute('GET', '/handler1', 'handler1'); + $r->addRoute('GET', '/handler2', 'handler2'); + }; + + $method = 'GET'; + $uri = '/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 4 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); + $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1'); + $r->addRoute('GET', '/user/{name}', 'handler2'); + }; + + $method = 'GET'; + $uri = '/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 5 --------------------------------------------------------------------------------------> + + // reuse callback from #4 + $method = 'GET'; + $uri = '/user/rdlowrey/12345/not-found'; + + $cases[] = [$method, $uri, $callback]; + + // 6 --------------------------------------------------------------------------------------> + + // reuse callback from #5 + $method = 'HEAD'; + + $cases[] = [$method, $uri, $callback]; + + // x --------------------------------------------------------------------------------------> + + return $cases; + } + + public function provideMethodNotAllowedDispatchCases() + { + $cases = []; + + // 0 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/resource/123/456', 'handler0'); + }; + + $method = 'POST'; + $uri = '/resource/123/456'; + $allowedMethods = ['GET']; + + $cases[] = [$method, $uri, $callback, $allowedMethods]; + + // 1 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/resource/123/456', 'handler0'); + $r->addRoute('POST', '/resource/123/456', 'handler1'); + $r->addRoute('PUT', '/resource/123/456', 'handler2'); + $r->addRoute('*', '/', 'handler3'); + }; + + $method = 'DELETE'; + $uri = '/resource/123/456'; + $allowedMethods = ['GET', 'POST', 'PUT']; + + $cases[] = [$method, $uri, $callback, $allowedMethods]; + + // 2 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); + $r->addRoute('POST', '/user/{name}/{id:[0-9]+}', 'handler1'); + $r->addRoute('PUT', '/user/{name}/{id:[0-9]+}', 'handler2'); + $r->addRoute('PATCH', '/user/{name}/{id:[0-9]+}', 'handler3'); + }; + + $method = 'DELETE'; + $uri = '/user/rdlowrey/42'; + $allowedMethods = ['GET', 'POST', 'PUT', 'PATCH']; + + $cases[] = [$method, $uri, $callback, $allowedMethods]; + + // 3 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute('POST', '/user/{name}', 'handler1'); + $r->addRoute('PUT', '/user/{name:[a-z]+}', 'handler2'); + $r->addRoute('PATCH', '/user/{name:[a-z]+}', 'handler3'); + }; + + $method = 'GET'; + $uri = '/user/rdlowrey'; + $allowedMethods = ['POST', 'PUT', 'PATCH']; + + $cases[] = [$method, $uri, $callback, $allowedMethods]; + + // 4 --------------------------------------------------------------------------------------> + + $callback = function (RouteCollector $r) { + $r->addRoute(['GET', 'POST'], '/user', 'handlerGetPost'); + $r->addRoute(['DELETE'], '/user', 'handlerDelete'); + $r->addRoute([], '/user', 'handlerNone'); + }; + + $cases[] = ['PUT', '/user', $callback, ['GET', 'POST', 'DELETE']]; + + // 5 + + $callback = function (RouteCollector $r) { + $r->addRoute('POST', '/user.json', 'handler0'); + $r->addRoute('GET', '/{entity}.json', 'handler1'); + }; + + $cases[] = ['PUT', '/user.json', $callback, ['POST', 'GET']]; + + // x --------------------------------------------------------------------------------------> + + return $cases; + } +} diff --git a/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php b/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php new file mode 100644 index 0000000..f821ef5 --- /dev/null +++ b/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php @@ -0,0 +1,16 @@ +markTestSkipped('PHP 5.6 required for MARK support'); + } + } + + protected function getDispatcherClass() + { + return 'FastRoute\\Dispatcher\\MarkBased'; + } + + protected function getDataGeneratorClass() + { + return 'FastRoute\\DataGenerator\\MarkBased'; + } +} diff --git a/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php b/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php new file mode 100644 index 0000000..b6fc53f --- /dev/null +++ b/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php @@ -0,0 +1,44 @@ +markTestSkipped('HHVM only'); + } + if (!version_compare(HHVM_VERSION, '3.9.0', '>=')) { + $this->markTestSkipped('classname requires HHVM 3.9+'); + } + + // The typechecker recurses the whole tree, so it makes sure + // that everything in fixtures/ is valid when this runs. + + $output = []; + $exit_code = null; + exec( + 'hh_server --check ' . escapeshellarg(__DIR__ . '/../../') . ' 2>&1', + $output, + $exit_code + ); + if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) { + $this->assertTrue( + $recurse, + 'Typechecker still running after running hh_client stop' + ); + // Server already running - 3.10 => 3.11 regression: + // https://github.com/facebook/hhvm/issues/6646 + exec('hh_client stop 2>/dev/null'); + $this->testTypechecks(/* recurse = */ false); + return; + + } + $this->assertSame(0, $exit_code, implode("\n", $output)); + } +} diff --git a/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php new file mode 100644 index 0000000..05a9af2 --- /dev/null +++ b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php @@ -0,0 +1,29 @@ + {}, + shape( + 'routeParser' => \FastRoute\RouteParser\Std::class, + 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class, + 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class, + 'routeCollector' => \FastRoute\RouteCollector::class, + ), + ); +} + +function all_options_cached(): \FastRoute\Dispatcher { + return \FastRoute\cachedDispatcher( + $collector ==> {}, + shape( + 'routeParser' => \FastRoute\RouteParser\Std::class, + 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class, + 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class, + 'routeCollector' => \FastRoute\RouteCollector::class, + 'cacheFile' => '/dev/null', + 'cacheDisabled' => false, + ), + ); +} diff --git a/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php new file mode 100644 index 0000000..61eb541 --- /dev/null +++ b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php @@ -0,0 +1,11 @@ + {}, shape()); +} + +function empty_options_cached(): \FastRoute\Dispatcher { + return \FastRoute\cachedDispatcher($collector ==> {}, shape()); +} diff --git a/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php new file mode 100644 index 0000000..44b5422 --- /dev/null +++ b/vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php @@ -0,0 +1,11 @@ + {}); +} + +function no_options_cached(): \FastRoute\Dispatcher { + return \FastRoute\cachedDispatcher($collector ==> {}); +} diff --git a/vendor/nikic/fast-route/test/RouteCollectorTest.php b/vendor/nikic/fast-route/test/RouteCollectorTest.php new file mode 100644 index 0000000..cc54407 --- /dev/null +++ b/vendor/nikic/fast-route/test/RouteCollectorTest.php @@ -0,0 +1,108 @@ +delete('/delete', 'delete'); + $r->get('/get', 'get'); + $r->head('/head', 'head'); + $r->patch('/patch', 'patch'); + $r->post('/post', 'post'); + $r->put('/put', 'put'); + + $expected = [ + ['DELETE', '/delete', 'delete'], + ['GET', '/get', 'get'], + ['HEAD', '/head', 'head'], + ['PATCH', '/patch', 'patch'], + ['POST', '/post', 'post'], + ['PUT', '/put', 'put'], + ]; + + $this->assertSame($expected, $r->routes); + } + + public function testGroups() + { + $r = new DummyRouteCollector(); + + $r->delete('/delete', 'delete'); + $r->get('/get', 'get'); + $r->head('/head', 'head'); + $r->patch('/patch', 'patch'); + $r->post('/post', 'post'); + $r->put('/put', 'put'); + + $r->addGroup('/group-one', function (DummyRouteCollector $r) { + $r->delete('/delete', 'delete'); + $r->get('/get', 'get'); + $r->head('/head', 'head'); + $r->patch('/patch', 'patch'); + $r->post('/post', 'post'); + $r->put('/put', 'put'); + + $r->addGroup('/group-two', function (DummyRouteCollector $r) { + $r->delete('/delete', 'delete'); + $r->get('/get', 'get'); + $r->head('/head', 'head'); + $r->patch('/patch', 'patch'); + $r->post('/post', 'post'); + $r->put('/put', 'put'); + }); + }); + + $r->addGroup('/admin', function (DummyRouteCollector $r) { + $r->get('-some-info', 'admin-some-info'); + }); + $r->addGroup('/admin-', function (DummyRouteCollector $r) { + $r->get('more-info', 'admin-more-info'); + }); + + $expected = [ + ['DELETE', '/delete', 'delete'], + ['GET', '/get', 'get'], + ['HEAD', '/head', 'head'], + ['PATCH', '/patch', 'patch'], + ['POST', '/post', 'post'], + ['PUT', '/put', 'put'], + ['DELETE', '/group-one/delete', 'delete'], + ['GET', '/group-one/get', 'get'], + ['HEAD', '/group-one/head', 'head'], + ['PATCH', '/group-one/patch', 'patch'], + ['POST', '/group-one/post', 'post'], + ['PUT', '/group-one/put', 'put'], + ['DELETE', '/group-one/group-two/delete', 'delete'], + ['GET', '/group-one/group-two/get', 'get'], + ['HEAD', '/group-one/group-two/head', 'head'], + ['PATCH', '/group-one/group-two/patch', 'patch'], + ['POST', '/group-one/group-two/post', 'post'], + ['PUT', '/group-one/group-two/put', 'put'], + ['GET', '/admin-some-info', 'admin-some-info'], + ['GET', '/admin-more-info', 'admin-more-info'], + ]; + + $this->assertSame($expected, $r->routes); + } +} + +class DummyRouteCollector extends RouteCollector +{ + public $routes = []; + + public function __construct() + { + } + + public function addRoute($method, $route, $handler) + { + $route = $this->currentGroupPrefix . $route; + $this->routes[] = [$method, $route, $handler]; + } +} diff --git a/vendor/nikic/fast-route/test/RouteParser/StdTest.php b/vendor/nikic/fast-route/test/RouteParser/StdTest.php new file mode 100644 index 0000000..e13e4de --- /dev/null +++ b/vendor/nikic/fast-route/test/RouteParser/StdTest.php @@ -0,0 +1,154 @@ +parse($routeString); + $this->assertSame($expectedRouteDatas, $routeDatas); + } + + /** @dataProvider provideTestParseError */ + public function testParseError($routeString, $expectedExceptionMessage) + { + $parser = new Std(); + $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage); + $parser->parse($routeString); + } + + public function provideTestParse() + { + return [ + [ + '/test', + [ + ['/test'], + ] + ], + [ + '/test/{param}', + [ + ['/test/', ['param', '[^/]+']], + ] + ], + [ + '/te{ param }st', + [ + ['/te', ['param', '[^/]+'], 'st'] + ] + ], + [ + '/test/{param1}/test2/{param2}', + [ + ['/test/', ['param1', '[^/]+'], '/test2/', ['param2', '[^/]+']] + ] + ], + [ + '/test/{param:\d+}', + [ + ['/test/', ['param', '\d+']] + ] + ], + [ + '/test/{ param : \d{1,9} }', + [ + ['/test/', ['param', '\d{1,9}']] + ] + ], + [ + '/test[opt]', + [ + ['/test'], + ['/testopt'], + ] + ], + [ + '/test[/{param}]', + [ + ['/test'], + ['/test/', ['param', '[^/]+']], + ] + ], + [ + '/{param}[opt]', + [ + ['/', ['param', '[^/]+']], + ['/', ['param', '[^/]+'], 'opt'] + ] + ], + [ + '/test[/{name}[/{id:[0-9]+}]]', + [ + ['/test'], + ['/test/', ['name', '[^/]+']], + ['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']], + ] + ], + [ + '', + [ + [''], + ] + ], + [ + '[test]', + [ + [''], + ['test'], + ] + ], + [ + '/{foo-bar}', + [ + ['/', ['foo-bar', '[^/]+']] + ] + ], + [ + '/{_foo:.*}', + [ + ['/', ['_foo', '.*']] + ] + ], + ]; + } + + public function provideTestParseError() + { + return [ + [ + '/test[opt', + "Number of opening '[' and closing ']' does not match" + ], + [ + '/test[opt[opt2]', + "Number of opening '[' and closing ']' does not match" + ], + [ + '/testopt]', + "Number of opening '[' and closing ']' does not match" + ], + [ + '/test[]', + 'Empty optional part' + ], + [ + '/test[[opt]]', + 'Empty optional part' + ], + [ + '[[test]]', + 'Empty optional part' + ], + [ + '/test[/opt]/required', + 'Optional segments can only occur at the end of a route' + ], + ]; + } +} diff --git a/vendor/nikic/fast-route/test/bootstrap.php b/vendor/nikic/fast-route/test/bootstrap.php new file mode 100644 index 0000000..3023f41 --- /dev/null +++ b/vendor/nikic/fast-route/test/bootstrap.php @@ -0,0 +1,11 @@ +setMaxPerPage($maxPerPage); // 10 by default +$maxPerPage = $pagerfanta->getMaxPerPage(); + +$pagerfanta->setCurrentPage($currentPage); // 1 by default +$currentPage = $pagerfanta->getCurrentPage(); + +$nbResults = $pagerfanta->getNbResults(); +$currentPageResults = $pagerfanta->getCurrentPageResults(); +``` + +Some of the other methods available: + +```php +$pagerfanta->getNbPages(); +$pagerfanta->haveToPaginate(); // whether the number of results is higher than the max per page +$pagerfanta->hasPreviousPage(); +$pagerfanta->getPreviousPage(); +$pagerfanta->hasNextPage(); +$pagerfanta->getNextPage(); +$pagerfanta->getCurrentPageOffsetStart(); +$pagerfanta->getCurrentPageOffsetEnd(); +``` + +### Changing the page based on user selection + +If you're using the example route-generator function shown below, +the page selected by the user will be available in the `page` GET (querystring) parameter. + +You would then need to call `setCurrentPage` with the value of that parameter: + +```php +if (isset($_GET["page"])) { + $pagerfanta->setCurrentPage($_GET["page"]); +} +``` + +### setMaxPerPage and setCurrentPage + +The `->setMaxPerPage()` and `->setCurrentPage()` methods implement +a fluent interface: + +```php +setMaxPerPage($maxPerPage) + ->setCurrentPage($currentPage); +``` + +The `->setMaxPerPage()` method throws an exception if the max per page +is not valid: + + * `Pagerfanta\Exception\NotIntegerMaxPerPageException` + * `Pagerfanta\Exception\LessThan1MaxPerPageException` + +Both extend from `Pagerfanta\Exception\NotValidMaxPerPageException`. + +The `->setCurrentPage()` method throws an exception if the page is not valid: + + * `Pagerfanta\Exception\NotIntegerCurrentPageException` + * `Pagerfanta\Exception\LessThan1CurrentPageException` + * `Pagerfanta\Exception\OutOfRangeCurrentPageException` + +All of them extend from `Pagerfanta\Exception\NotValidCurrentPageException`. + +`->setCurrentPage()` throws an out ot range exception depending on the +max per page, so if you are going to modify the max per page, you should do it +before setting the current page. + +(If you want to use Pagerfanta in a Symfony project, see +[https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle](https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle).) + +## Adapters + +The adapter's concept is very simple. An adapter just returns the number +of results and an slice for a offset and length. This way you can adapt +a pagerfanta to paginate any kind results simply by creating an adapter. + +An adapter must implement the `Pagerfanta\Adapter\AdapterInterface` +interface, which has these two methods: + +```php +find(); +$adapter = new MongoAdapter($cursor); +``` + +### MandangoAdapter + +To paginate [Mandango](http://mandango.org) Queries. + +```php +getRepository('Model\Article')->createQuery(); +$adapter = new MandangoAdapter($query); +``` + +### DoctrineDbalAdapter + +To paginate [DoctrineDbal](http://www.doctrine-project.org/projects/dbal.html) +query builders. + +```php +select('p.*')->from('posts', 'p'); + +$countQueryBuilderModifier = function ($queryBuilder) { + $queryBuilder->select('COUNT(DISTINCT p.id) AS total_results') + ->setMaxResults(1); +}; + +$adapter = new DoctrineDbalAdapter($queryBuilder, $countQueryBuilderModifier); +``` + +### DoctrineDbalSingleTableAdapter + +To simplify the pagination of single table +[DoctrineDbal](http://www.doctrine-project.org/projects/dbal.html) +query builders. + +This adapter only paginates single table query builders, without joins. + +```php +select('p.*')->from('posts', 'p'); + +$countField = 'p.id'; + +$adapter = new DoctrineDbalSingleTableAdapter($queryBuilder, $countField); +``` + +### DoctrineORMAdapter + +To paginate [DoctrineORM](http://www.doctrine-project.org/projects/orm) query objects. + +```php +createQueryBuilder() + ->select('u') + ->from('Model\Article', 'u'); +$adapter = new DoctrineORMAdapter($queryBuilder); +``` + +### DoctrineODMMongoDBAdapter + +To paginate [DoctrineODMMongoDB](http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/) query builders. + +```php +createQueryBuilder('Model\Article'); +$adapter = new DoctrineODMMongoDBAdapter($queryBuilder); +``` + +### DoctrineODMPhpcrAdapter + +To paginate [Doctrine PHPCR-ODM](http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/) query builders. + +```php +createQueryBuilder(); +$queryBuilder->from('Model\Article'); +$adapter = new DoctrineODMPhpcrAdapter($queryBuilder); +``` + +### DoctrineCollectionAdapter + +To paginate a `Doctrine\Common\Collection\Collections` interface +you can use the `DoctrineCollectionAdapter`. It proxies to the +count() and slice() methods on the Collections interface for +pagination. This makes sense if you are using Doctrine ORMs Extra +Lazy association features: + +```php +find("Pagerfanta\Tests\Adapter\DoctrineORM\User", 1); + +$adapter = new DoctrineCollectionAdapter($user->getGroups()); +``` + +### DoctrineSelectableAdapter + +To paginate a `Doctrine\Common\Collection\Selectable` interface +you can use the `DoctrineSelectableAdapter`. It uses the matching() +method on the Selectable interface for pagination. This is +especially usefull when using the Doctrine Criteria object to +filter a PersistentCollection: + +```php +find("Pagerfanta\Tests\Adapter\DoctrineORM\User", 1); +$comments = $user->getComments(); +$criteria = Criteria::create()->andWhere(Criteria::expr()->in('id', array(1,2,3)); + +$adapter = new DoctrineSelectableAdapter($comments, $criteria); +``` + +Note that you should never use this adapter with a +PersistentCollection which is not set to use the EXTRA_LAZY fetch mode. + +*Be careful when using the `count()` method, currently Doctrine2 +needs to fetch all the records to count the number of elements.* + +### ElasticaAdapter + +To paginate an Elastica Query query: + +```php + 'Fred' +)); + +$adapter = new ElasticaAdapter($searchable, $query); +``` + +*Be careful when paginating a huge set of documents. By default, offset + limit +can't exceed 10000. You can mitigate this by setting the `$maxResults` +parameter when constructing the `ElasticaAdapter`. For more information, see: +[#213](https://github.com/whiteoctober/Pagerfanta/pull/213#issue-87631892).* + +### PropelAdapter + +To paginate a propel 1 query: + +```php +createSelect(); +$query->setQuery('search term'); + +$adapter = new SolariumAdapter($solarium, $query); +``` + +### FixedAdapter + +Best used when you need to do a custom paging solution and +don't want to implement a full adapter for a one-off use case. + +It returns always the same data no matter what page you query: + +```php + 3); +$html = $view->render($pagerfanta, $routeGenerator, $options); +``` + +Options (default): + + * proximity (3) + * prev_message (Previous) + * next_message (Next) + * css_disabled_class (disabled) + * css_dots_class (dots) + * css_current_class (current) + * dots_text (...) + * container_template () + * page_template (%text%) + * span_template (%text%) + +CSS: + +```css +.pagerfanta { +} + +.pagerfanta a, +.pagerfanta span { + display: inline-block; + border: 1px solid blue; + color: blue; + margin-right: .2em; + padding: .25em .35em; +} + +.pagerfanta a { + text-decoration: none; +} + +.pagerfanta a:hover { + background: #ccf; +} + +.pagerfanta .dots { + border-width: 0; +} + +.pagerfanta .current { + background: #ccf; + font-weight: bold; +} + +.pagerfanta .disabled { + border-color: #ccf; + color: #ccf; +} + +COLORS: + +.pagerfanta a, +.pagerfanta span { + border-color: blue; + color: blue; +} + +.pagerfanta a:hover { + background: #ccf; +} + +.pagerfanta .current { + background: #ccf; +} + +.pagerfanta .disabled { + border-color: #ccf; + color: #cf; +} +``` + +### TwitterBootstrapView, TwitterBootstrap3View and TwitterBootstrap4View + +These views generate paginators designed for use with +[Twitter Bootstrap](https://github.com/twitter/bootstrap). + +`TwitterBootstrapView` is for Bootstrap 2; `TwitterBootstrap3View` is for Bootstrap 3; `TwitterBootstrap4View` is for Bootstrap 4 (alpha). + +```php + 3); +$html = $view->render($pagerfanta, $routeGenerator, $options); +``` + +Options (default): + + * proximity (3) + * prev_message (← Previous) + * prev_disabled_href () + * next_message (Next →) + * next_disabled_href () + * dots_message (…) + * dots_href () + * css_container_class (pagination) + * css_prev_class (prev) + * css_next_class (next) + * css_disabled_class (disabled) + * css_dots_class (disabled) + * css_active_class (active) + +### SemanticUiView + +This view generates a pagination for +[Semantic UI](https://github.com/Semantic-Org/Semantic-UI). + +```php + 3); +$html = $view->render($pagerfanta, $routeGenerator, $options); +``` + +Options (default): + + * proximity (3) + * prev_message (← Previous) + * prev_disabled_href () + * next_message (Next →) + * next_disabled_href () + * dots_message (…) + * dots_href () + * css_container_class (pagination) + * css_item_class (item) + * css_prev_class (prev) + * css_next_class (next) + * css_disabled_class (disabled) + * css_dots_class (disabled) + * css_active_class (active) + +### OptionableView + +This view is to reuse options in different views. + +```php + 3)); + +$myView2 = new OptionableView($defaultView, array('prev_message' => 'Anterior', 'next_message' => 'Siguiente')); + +// using in a normal way +$pagerfantaHtml = $myView2->render($pagerfanta, $routeGenerator); + +// overwriting default options +$pagerfantaHtml = $myView2->render($pagerfanta, $routeGenerator, array('next_message' => 'Siguiente!!')); +``` + +## Contributing + +We welcome contributions to this project, including pull requests and issues (and discussions on existing issues). + +If you'd like to contribute code but aren't sure what, the [issues list](https://github.com/whiteoctober/pagerfanta/issues) is a good place to start. +If you're a first-time code contributor, you may find Github's guide to [forking projects](https://guides.github.com/activities/forking/) helpful. + +All contributors (whether contributing code, involved in issue discussions, or involved in any other way) must abide by our [code of conduct](code_of_conduct.md). + +## Acknowledgements + +Pagerfanta is inspired by [Zend Paginator](https://github.com/zendframework/zf2). + +Thanks also to Pablo Díez (pablodip@gmail.com) for most of the work on the first versions of Pagerfanta. + +## Licence + +Pagerfanta is licensed under the [MIT License](LICENSE). diff --git a/vendor/pagerfanta/pagerfanta/code_of_conduct.md b/vendor/pagerfanta/pagerfanta/code_of_conduct.md new file mode 100644 index 0000000..59c7d9f --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/code_of_conduct.md @@ -0,0 +1 @@ +This project's code-of-conduct can be found at [https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md](https://github.com/whiteoctober/open-source-code-of-conduct/blob/master/code_of_conduct.md). diff --git a/vendor/pagerfanta/pagerfanta/composer.json b/vendor/pagerfanta/pagerfanta/composer.json new file mode 100644 index 0000000..3b78371 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/composer.json @@ -0,0 +1,49 @@ +{ + "name": "pagerfanta/pagerfanta", + "description": "Pagination for PHP", + "keywords": ["page","paging", "paginator", "pagination"], + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Pablo Díez", + "email": "pablodip@gmail.com" + } + ], + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5", + "doctrine/orm": "~2.3", + "mandango/mandango": "~1.0@dev", + "mandango/mondator": "~1.0@dev", + "jmikola/geojson": "~1.0", + "doctrine/phpcr-odm": "1.*", + "propel/propel": "~2.0@dev", + "propel/propel1": "~1.6", + "ruflin/Elastica": "~1.3", + "solarium/solarium": "~3.1", + "jackalope/jackalope-doctrine-dbal": "1.*" + }, + "suggest": { + "doctrine/orm": "To use the DoctrineORMAdapter.", + "mandango/mandango": "To use the MandangoAdapter.", + "doctrine/mongodb-odm": "To use the DoctrineODMMongoDBAdapter.", + "doctrine/phpcr-odm": "To use the DoctrineODMPhpcrAdapter. >= 1.1.0", + "propel/propel1": "To use the PropelAdapter", + "propel/propel": "To use the Propel2Adapter", + "solarium/solarium": "To use the SolariumAdapter." + }, + "autoload": { + "psr-4": { "Pagerfanta\\": "src/Pagerfanta/" } + }, + "autoload-dev": { + "psr-4": { "Pagerfanta\\Tests\\": "tests/Pagerfanta/Tests/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/AdapterInterface.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/AdapterInterface.php new file mode 100644 index 0000000..f7cbdb8 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/AdapterInterface.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * AdapterInterface. + * + * @author Pablo Díez + */ +interface AdapterInterface +{ + /** + * Returns the number of results. + * + * @return integer The number of results. + */ + public function getNbResults(); + + /** + * Returns an slice of the results. + * + * @param integer $offset The offset. + * @param integer $length The length. + * + * @return array|\Traversable The slice. + */ + public function getSlice($offset, $length); +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ArrayAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ArrayAdapter.php new file mode 100644 index 0000000..cffaba3 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ArrayAdapter.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * ArrayAdapter. + * + * @author Pablo Díez + */ +class ArrayAdapter implements AdapterInterface +{ + private $array; + + /** + * Constructor. + * + * @param array $array The array. + */ + public function __construct(array $array) + { + $this->array = $array; + } + + /** + * Returns the array. + * + * @return array The array. + */ + public function getArray() + { + return $this->array; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return count($this->array); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return array_slice($this->array, $offset, $length); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/CallbackAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/CallbackAdapter.php new file mode 100644 index 0000000..637e40d --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/CallbackAdapter.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Pagerfanta\Exception\InvalidArgumentException; + +/** + * @author Adrien Brault + */ +class CallbackAdapter implements AdapterInterface +{ + private $getNbResultsCallback; + private $getSliceCallback; + + /** + * @param callable $getNbResultsCallback + * @param callable $getSliceCallback + */ + public function __construct($getNbResultsCallback, $getSliceCallback) + { + if (!is_callable($getNbResultsCallback)) { + throw new InvalidArgumentException('$getNbResultsCallback should be a callable'); + } + if (!is_callable($getSliceCallback)) { + throw new InvalidArgumentException('$getSliceCallback should be a callable'); + } + + $this->getNbResultsCallback = $getNbResultsCallback; + $this->getSliceCallback = $getSliceCallback; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return call_user_func($this->getNbResultsCallback); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return call_user_func($this->getSliceCallback, $offset, $length); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ConcatenationAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ConcatenationAdapter.php new file mode 100644 index 0000000..1de27ef --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ConcatenationAdapter.php @@ -0,0 +1,126 @@ + + */ +class ConcatenationAdapter implements AdapterInterface +{ + /** + * @var AdapterInterface[] List of adapters + */ + protected $adapters; + + /** + * @var int[]|null Cache of the numbers of results of the adapters. The indexes correspond the indexes of the + * `adapters` property. + */ + protected $adaptersNbResultsCache; + + /** + * @param AdapterInterface[] $adapters + * @throws InvalidArgumentException + */ + public function __construct(array $adapters) + { + foreach ($adapters as $index => $adapter) { + if (!($adapter instanceof AdapterInterface)) { + throw new InvalidArgumentException(sprintf( + 'Argument $adapters[%s] expected to be a \Pagerfanta\Adapter\AdapterInterface instance, a %s given', + $index, + is_object($adapter) ? sprintf('%s instance', get_class($adapter)) : gettype($adapter) + )); + } + } + + $this->adapters = $adapters; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + if (!isset($this->adaptersNbResultsCache)) { + $this->refreshAdaptersNbResults(); + } + + return array_sum($this->adaptersNbResultsCache); + } + + /** + * {@inheritdoc} + * @return array + */ + public function getSlice($offset, $length) + { + if (!isset($this->adaptersNbResultsCache)) { + $this->refreshAdaptersNbResults(); + } + + $slice = array(); + $previousAdaptersNbResultsSum = 0; + $requestFirstIndex = $offset; + $requestLastIndex = $offset + $length - 1; + + foreach ($this->adapters as $index => $adapter) { + $adapterNbResults = $this->adaptersNbResultsCache[$index]; + $adapterFirstIndex = $previousAdaptersNbResultsSum; + $adapterLastIndex = $adapterFirstIndex + $adapterNbResults - 1; + + $previousAdaptersNbResultsSum += $adapterNbResults; + + // The adapter is fully below the requested slice range — skip it + if ($adapterLastIndex < $requestFirstIndex) { + continue; + } + + // The adapter is fully above the requested slice range — finish the gathering + if ($adapterFirstIndex > $requestLastIndex) { + break; + } + + // Else the adapter range definitely intersects with the requested range + $fetchOffset = $requestFirstIndex - $adapterFirstIndex; + $fetchLength = $length; + + // The requested range start is below the adapter range start + if ($fetchOffset < 0) { + $fetchLength += $fetchOffset; + $fetchOffset = 0; + } + + // The requested range end is above the adapter range end + if ($fetchOffset + $fetchLength > $adapterNbResults) { + $fetchLength = $adapterNbResults - $fetchOffset; + } + + // Getting the subslice from the adapter and adding it to the result slice + $fetchSlice = $adapter->getSlice($fetchOffset, $fetchLength); + foreach ($fetchSlice as $item) { + $slice[] = $item; + } + } + + return $slice; + } + + /** + * Refreshes the cache of the numbers of results of the adapters. + */ + protected function refreshAdaptersNbResults() + { + if (!isset($this->adaptersNbResultsCache)) { + $this->adaptersNbResultsCache = array(); + } + + foreach ($this->adapters as $index => $adapter) { + $this->adaptersNbResultsCache[$index] = $adapter->getNbResults(); + } + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineCollectionAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineCollectionAdapter.php new file mode 100644 index 0000000..86a0a40 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineCollectionAdapter.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\Common\Collections\Collection; + +/** + * DoctrineCollectionAdapter. + * + * @author Pablo Díez + */ +class DoctrineCollectionAdapter implements AdapterInterface +{ + private $collection; + + /** + * Constructor. + * + * @param Collection $collection A Doctrine collection. + */ + public function __construct(Collection $collection) + { + $this->collection = $collection; + } + + /** + * Returns the collection. + * + * @return Collection The collection. + */ + public function getCollection() + { + return $this->collection; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->collection->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return $this->collection->slice($offset, $length); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalAdapter.php new file mode 100644 index 0000000..7fad396 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalAdapter.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\DBAL\Query\QueryBuilder; +use Pagerfanta\Exception\InvalidArgumentException; + +/** + * @author Michael Williams + * @author Pablo Díez + */ +class DoctrineDbalAdapter implements AdapterInterface +{ + private $queryBuilder; + private $countQueryBuilderModifier; + + /** + * Constructor. + * + * @param QueryBuilder $queryBuilder A DBAL query builder. + * @param callable $countQueryBuilderModifier A callable to modifier the query builder to count. + */ + public function __construct(QueryBuilder $queryBuilder, $countQueryBuilderModifier) + { + if ($queryBuilder->getType() !== QueryBuilder::SELECT) { + throw new InvalidArgumentException('Only SELECT queries can be paginated.'); + } + + if (!is_callable($countQueryBuilderModifier)) { + throw new InvalidArgumentException('The count query builder modifier must be a callable.'); + } + + $this->queryBuilder = clone $queryBuilder; + $this->countQueryBuilderModifier = $countQueryBuilderModifier; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + $qb = $this->prepareCountQueryBuilder(); + $result = $qb->execute()->fetchColumn(); + + return (int) $result; + } + + private function prepareCountQueryBuilder() + { + $qb = clone $this->queryBuilder; + call_user_func($this->countQueryBuilderModifier, $qb); + + return $qb; + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $qb = clone $this->queryBuilder; + $result = $qb->setMaxResults($length) + ->setFirstResult($offset) + ->execute(); + + return $result->fetchAll(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalSingleTableAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalSingleTableAdapter.php new file mode 100644 index 0000000..5606028 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineDbalSingleTableAdapter.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\DBAL\Query\QueryBuilder; +use Pagerfanta\Exception\InvalidArgumentException; + +/** + * @author Michael Williams + * @author Pablo Díez + */ +class DoctrineDbalSingleTableAdapter extends DoctrineDbalAdapter +{ + /** + * Constructor. + * + * @param QueryBuilder $queryBuilder A DBAL query builder. + * @param string $countField Primary key for the table in query. Used in count expression. Must include table alias + */ + public function __construct(QueryBuilder $queryBuilder, $countField) + { + if ($this->hasQueryBuilderJoins($queryBuilder)) { + throw new InvalidArgumentException('The query builder cannot have joins.'); + } + + $countQueryBuilderModifier = $this->createCountQueryModifier($countField); + + parent::__construct($queryBuilder, $countQueryBuilderModifier); + } + + private function hasQueryBuilderJoins(QueryBuilder $queryBuilder) + { + $joins = $queryBuilder->getQueryPart('join'); + + return !empty($joins); + } + + private function createCountQueryModifier($countField) + { + $select = $this->createSelectForCountField($countField); + + return function (QueryBuilder $queryBuilder) use ($select) { + $queryBuilder->select($select) + ->resetQueryPart('orderBy') + ->setMaxResults(1); + }; + } + + private function createSelectForCountField($countField) + { + if ($this->countFieldHasNoAlias($countField)) { + throw new InvalidArgumentException('The $countField must contain a table alias in the string.'); + } + + return sprintf('COUNT(DISTINCT %s) AS total_results', $countField); + } + + private function countFieldHasNoAlias($countField) + { + return strpos($countField, '.') === false; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMMongoDBAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMMongoDBAdapter.php new file mode 100644 index 0000000..23f01b6 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMMongoDBAdapter.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\ODM\MongoDB\Query\Builder; + +/** + * DoctrineODMMongoDBAdapter. + * + * @author Pablo Díez + */ +class DoctrineODMMongoDBAdapter implements AdapterInterface +{ + private $queryBuilder; + + /** + * Constructor. + * + * @param Builder $queryBuilder A DoctrineMongo query builder. + */ + public function __construct(Builder $queryBuilder) + { + $this->queryBuilder = $queryBuilder; + } + + /** + * Returns the query builder. + * + * @return Builder The query builder. + */ + public function getQueryBuilder() + { + return $this->queryBuilder; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + $qb = clone $this->queryBuilder; + + return $qb + ->limit(0) + ->skip(0) + ->count() + ->getQuery() + ->execute(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return $this->queryBuilder + ->limit($length) + ->skip($offset) + ->getQuery() + ->execute(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMPhpcrAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMPhpcrAdapter.php new file mode 100644 index 0000000..cc509b8 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineODMPhpcrAdapter.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; +use Doctrine\ODM\PHPCR\Query\Query; + +/** + * Pagerfanta adapter for Doctrine PHPCR-ODM. + * + * @author David Buchmann + */ +class DoctrineODMPhpcrAdapter implements AdapterInterface +{ + private $queryBuilder; + + /** + * Constructor. + * + * @param QueryBuilder $queryBuilder A Doctrine PHPCR-ODM query builder. + */ + public function __construct(QueryBuilder $queryBuilder) + { + $this->queryBuilder = $queryBuilder; + } + + /** + * Returns the query builder. + * + * @return QueryBuilder The query builder. + */ + public function getQueryBuilder() + { + return $this->queryBuilder; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->queryBuilder->getQuery()->execute(null, Query::HYDRATE_PHPCR)->getRows()->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return $this->queryBuilder + ->getQuery() + ->setMaxResults($length) + ->setFirstResult($offset) + ->execute(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineORMAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineORMAdapter.php new file mode 100644 index 0000000..59a81dd --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineORMAdapter.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\ORM\Tools\Pagination\Paginator as DoctrinePaginator; + +/** + * DoctrineORMAdapter. + * + * @author Christophe Coevoet + */ +class DoctrineORMAdapter implements AdapterInterface +{ + /** + * @var \Doctrine\ORM\Tools\Pagination\Paginator + */ + private $paginator; + + /** + * Constructor. + * + * @param \Doctrine\ORM\Query|\Doctrine\ORM\QueryBuilder $query A Doctrine ORM query or query builder. + * @param boolean $fetchJoinCollection Whether the query joins a collection (true by default). + * @param boolean|null $useOutputWalkers Whether to use output walkers pagination mode + */ + public function __construct($query, $fetchJoinCollection = true, $useOutputWalkers = null) + { + $this->paginator = new DoctrinePaginator($query, $fetchJoinCollection); + $this->paginator->setUseOutputWalkers($useOutputWalkers); + } + + /** + * Returns the query + * + * @return \Doctrine\ORM\Query + */ + public function getQuery() + { + return $this->paginator->getQuery(); + } + + /** + * Returns whether the query joins a collection. + * + * @return boolean Whether the query joins a collection. + */ + public function getFetchJoinCollection() + { + return $this->paginator->getFetchJoinCollection(); + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return count($this->paginator); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $this->paginator + ->getQuery() + ->setFirstResult($offset) + ->setMaxResults($length); + + return $this->paginator->getIterator(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineSelectableAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineSelectableAdapter.php new file mode 100644 index 0000000..3d447bc --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/DoctrineSelectableAdapter.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Doctrine\Common\Collections\Criteria; +use Doctrine\Common\Collections\Selectable; + +/** + * DoctrineSelectableAdapter. + * + * @author Boris Guéry + */ +class DoctrineSelectableAdapter implements AdapterInterface +{ + /** + * @var Selectable + */ + private $selectable; + + /** + * @var Criteria + */ + private $criteria; + + /** + * Constructor. + * + * @param Selectable $selectable An implementation of the Selectable interface. + * @param Criteria $criteria A Doctrine criteria. + */ + public function __construct(Selectable $selectable, Criteria $criteria) + { + $this->selectable = $selectable; + $this->criteria = $criteria; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + $firstResult = null; + $maxResults = null; + + $criteria = $this->createCriteria($firstResult, $maxResults); + + return $this->selectable->matching($criteria)->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $firstResult = $offset; + $maxResults = $length; + + $criteria = $this->createCriteria($firstResult, $maxResults); + + return $this->selectable->matching($criteria); + } + + private function createCriteria($firstResult, $maxResult) + { + $criteria = clone $this->criteria; + $criteria->setFirstResult($firstResult); + $criteria->setMaxResults($maxResult); + + return $criteria; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ElasticaAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ElasticaAdapter.php new file mode 100644 index 0000000..df9c1d0 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/ElasticaAdapter.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Elastica\Query; +use Elastica\SearchableInterface; + +class ElasticaAdapter implements AdapterInterface +{ + /** + * @var Query + */ + private $query; + + /** + * @var \Elastica\ResultSet + */ + private $resultSet; + + /** + * @var SearchableInterface + */ + private $searchable; + + /** + * @var array + */ + private $options; + + /** + * @var int|null + * + * Used to limit the number of totalHits returned by ES. + * For more information, see: https://github.com/whiteoctober/Pagerfanta/pull/213#issue-87631892 + */ + private $maxResults; + + public function __construct(SearchableInterface $searchable, Query $query, array $options = array(), $maxResults = null) + { + $this->searchable = $searchable; + $this->query = $query; + $this->options = $options; + $this->maxResults = $maxResults; + } + + /** + * Returns the number of results. + * + * @return integer The number of results. + */ + public function getNbResults() + { + if (!$this->resultSet) { + $totalHits = $this->searchable->count($this->query); + } else { + $totalHits = $this->resultSet->getTotalHits(); + } + + if (null === $this->maxResults) { + return $totalHits; + } + + return min($totalHits, $this->maxResults); + } + + /** + * Returns the Elastica ResultSet. Will return null if getSlice has not yet been + * called. + * + * @return \Elastica\ResultSet|null + */ + public function getResultSet() + { + return $this->resultSet; + } + + /** + * Returns an slice of the results. + * + * @param integer $offset The offset. + * @param integer $length The length. + * + * @return array|\Traversable The slice. + */ + public function getSlice($offset, $length) + { + return $this->resultSet = $this->searchable->search($this->query, array_merge($this->options, array( + 'from' => $offset, + 'size' => $length + ))); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/FixedAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/FixedAdapter.php new file mode 100644 index 0000000..3c22076 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/FixedAdapter.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * Provides you with an adapter that returns always the same data. + * + * Best used when you need to do a custom paging solution and don't + * want to implement a full adapter for a one-off use case. + * + * @author Jordi Boggiano + */ +class FixedAdapter implements AdapterInterface +{ + private $nbResults; + private $results; + + /** + * @param int $nbResults + * @param array|\Traversable $results + */ + public function __construct($nbResults, $results) + { + $this->nbResults = $nbResults; + $this->results = $results; + } + + /** + * {@inheritDoc} + */ + public function getNbResults() + { + return $this->nbResults; + } + + /** + * {@inheritDoc} + */ + public function getSlice($offset, $length) + { + return $this->results; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MandangoAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MandangoAdapter.php new file mode 100644 index 0000000..a9b76ac --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MandangoAdapter.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Mandango\Query; + +/** + * MandangoAdapter. + * + * @author Pablo Díez + */ +class MandangoAdapter implements AdapterInterface +{ + private $query; + + /** + * Constructor. + * + * @param Query $query The query. + */ + public function __construct(Query $query) + { + $this->query = $query; + } + + /** + * Returns the query. + * + * @return Query The query. + */ + public function getQuery() + { + return $this->query; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->query->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return $this->query->limit($length)->skip($offset)->all(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MongoAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MongoAdapter.php new file mode 100644 index 0000000..eb134f9 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/MongoAdapter.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * MongoAdapter. + * + * @author Sergey Ponomaryov + */ +class MongoAdapter implements AdapterInterface +{ + private $cursor; + + /** + * Constructor. + * + * @param \MongoCursor $cursor The cursor. + */ + public function __construct(\MongoCursor $cursor) + { + $this->cursor = $cursor; + } + + /** + * Returns the cursor. + * + * @return \MongoCursor The cursor. + */ + public function getCursor() + { + return $this->cursor; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->cursor->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $this->cursor->limit($length); + $this->cursor->skip($offset); + + return $this->cursor; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/NullAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/NullAdapter.php new file mode 100644 index 0000000..452e354 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/NullAdapter.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * NullAdapter. + * + * @author Benjamin Dulau + */ +class NullAdapter implements AdapterInterface +{ + private $nbResults; + + /** + * Constructor. + * + * @param integer $nbResults Total item count. + */ + public function __construct($nbResults = 0) + { + $this->nbResults = (int) $nbResults; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->nbResults; + } + + /** + * The following methods are derived from code of the Zend Framework + * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd). + * + * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + if ($offset >= $this->nbResults) { + return array(); + } + + $nullArrayLength = $this->calculateNullArrayLength($offset, $length); + + return $this->createNullArray($nullArrayLength); + } + + private function calculateNullArrayLength($offset, $length) + { + $remainCount = $this->remainCount($offset); + if ($length > $remainCount) { + return $remainCount; + } + + return $length; + } + + private function remainCount($offset) + { + return $this->nbResults - $offset; + } + + private function createNullArray($length) + { + return array_fill(0, $length, null); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/Propel2Adapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/Propel2Adapter.php new file mode 100644 index 0000000..0a716b6 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/Propel2Adapter.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Propel\Runtime\ActiveQuery\ModelCriteria; + +/** + * Propel2Adapter. + * + * @author Raphael YAN + */ +class Propel2Adapter implements AdapterInterface +{ + /** + * @var ModelCriteria $query + */ + private $query; + + /** + * Constructor. + * + * @param ModelCriteria $query + */ + public function __construct(ModelCriteria $query) + { + $this->query = $query; + } + + /** + * Returns the query. + * + * @return ModelCriteria + */ + public function getQuery() + { + return $this->query; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + $q = clone $this->getQuery(); + + $q->offset(0); + + return $q->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $q = clone $this->getQuery(); + + $q->limit($length); + $q->offset($offset); + + return $q->find(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/PropelAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/PropelAdapter.php new file mode 100644 index 0000000..979be88 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/PropelAdapter.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +/** + * PropelAdapter. + * + * @author William DURAND + */ +class PropelAdapter implements AdapterInterface +{ + private $query; + + /** + * Constructor. + * + * @param \ModelCriteria $query + */ + public function __construct($query) + { + $this->query = $query; + } + + /** + * Returns the query. + * + * @return \ModelCriteria + */ + public function getQuery() + { + return $this->query; + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + $q = clone $this->getQuery(); + + $q->limit(0); + $q->offset(0); + + return $q->count(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + $q = clone $this->getQuery(); + + $q->limit($length); + $q->offset($offset); + + return $q->find(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/SolariumAdapter.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/SolariumAdapter.php new file mode 100644 index 0000000..7a59f41 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Adapter/SolariumAdapter.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Adapter; + +use Pagerfanta\Exception\InvalidArgumentException; +use Solarium\QueryType\Select\Query\Query; +use Solarium\Core\Client\Client; +use Solarium_Query_Select; +use Solarium_Client; + +/** + * SolariumAdapter. + * + * @author Igor Wiedler + */ +class SolariumAdapter implements AdapterInterface +{ + private $client; + private $query; + private $resultSet; + private $endPoint; + private $resultSetStart; + private $resultSetRows; + + /** + * Constructor. + * + * @param Solarium_Client|Client $client A Solarium client. + * @param Solarium_Query_Select|Query $query A Solarium select query. + */ + public function __construct($client, $query) + { + $this->checkClient($client); + $this->checkQuery($query); + + $this->client = $client; + $this->query = $query; + } + + private function checkClient($client) + { + if ($this->isClientInvalid($client)) { + throw new InvalidArgumentException($this->getClientInvalidMessage($client)); + } + } + + private function isClientInvalid($client) + { + return !($client instanceof Client) && + !($client instanceof Solarium_Client); + } + + private function getClientInvalidMessage($client) + { + return sprintf('The client object should be a Solarium_Client or Solarium\Core\Client\Client instance, %s given', + get_class($client) + ); + } + + private function checkQuery($query) + { + if ($this->isQueryInvalid($query)) { + throw new InvalidArgumentException($this->getQueryInvalidMessage($query)); + } + } + + private function isQueryInvalid($query) + { + return !($query instanceof Query) && + !($query instanceof Solarium_Query_Select); + } + + private function getQueryInvalidMessage($query) + { + return sprintf('The query object should be a Solarium_Query_Select or Solarium\QueryType\Select\Query\Query instance, %s given', + get_class($query) + ); + } + + /** + * {@inheritdoc} + */ + public function getNbResults() + { + return $this->getResultSet()->getNumFound(); + } + + /** + * {@inheritdoc} + */ + public function getSlice($offset, $length) + { + return $this->getResultSet($offset, $length); + } + + /** + * @param int $start + * @param int $rows + * + * @return \Solarium_Result_Select|\Solarium\QueryType\Select\Result\Result + **/ + public function getResultSet($start = null, $rows = null) + { + if ($this->resultSetStartAndRowsAreNotNullAndChange($start, $rows)) { + $this->resultSetStart = $start; + $this->resultSetRows = $rows; + + $this->modifyQuery(); + $this->clearResultSet(); + } + + if ($this->resultSetEmpty()) { + $this->resultSet = $this->createResultSet(); + } + + return $this->resultSet; + } + + private function resultSetStartAndRowsAreNotNullAndChange($start, $rows) + { + return $this->resultSetStartAndRowsAreNotNull($start, $rows) && + $this->resultSetStartAndRowsChange($start, $rows); + } + + private function resultSetStartAndRowsAreNotNull($start, $rows) + { + return $start !== null && $rows !== null; + } + + private function resultSetStartAndRowsChange($start, $rows) + { + return $start !== $this->resultSetStart || $rows !== $this->resultSetRows; + } + + private function modifyQuery() + { + $this->query + ->setStart($this->resultSetStart) + ->setRows($this->resultSetRows); + } + + private function createResultSet() + { + return $this->client->select($this->query, $this->endPoint); + } + + private function clearResultSet() + { + $this->resultSet = null; + } + + private function resultSetEmpty() + { + return $this->resultSet === null; + } + + public function setEndPoint($endPoint) + { + $this->endPoint = $endPoint; + + return $this; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/Exception.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/Exception.php new file mode 100644 index 0000000..27aca75 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/Exception.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * Exception. + * + * @author Pablo Díez + */ +interface Exception extends \Throwable +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/InvalidArgumentException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..d4fdb94 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * InvalidArgumentException. + * + * @author Pablo Díez + */ +class InvalidArgumentException extends \InvalidArgumentException implements Exception +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1CurrentPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1CurrentPageException.php new file mode 100644 index 0000000..da559ac --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1CurrentPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * LessThan1CurrentPageException. + * + * @author Pablo Díez + */ +class LessThan1CurrentPageException extends NotValidCurrentPageException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1MaxPerPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1MaxPerPageException.php new file mode 100644 index 0000000..847886f --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LessThan1MaxPerPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * LessThan1MaxPerPageException + * + * @author Pablo Díez + */ +class LessThan1MaxPerPageException extends NotValidMaxPerPageException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LogicException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LogicException.php new file mode 100644 index 0000000..14c9b11 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/LogicException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * LogicException. + * + * @author Pablo Díez + */ +class LogicException extends \LogicException implements Exception +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotBooleanException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotBooleanException.php new file mode 100644 index 0000000..ea3d85f --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotBooleanException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * @author Pablo Díez + */ +class NotBooleanException extends InvalidArgumentException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerCurrentPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerCurrentPageException.php new file mode 100644 index 0000000..119fd44 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerCurrentPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * NotIntegerCurrentPageException. + * + * @author Pablo Díez + */ +class NotIntegerCurrentPageException extends NotValidCurrentPageException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerException.php new file mode 100644 index 0000000..ff6de11 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * NotIntegerItemException. + * + * @author Alexandre Fayeaux + */ +class NotIntegerException extends InvalidArgumentException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerMaxPerPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerMaxPerPageException.php new file mode 100644 index 0000000..5fb1008 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotIntegerMaxPerPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * NotIntegerMaxPerPageException + * + * @author Pablo Díez + */ +class NotIntegerMaxPerPageException extends NotValidMaxPerPageException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidCurrentPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidCurrentPageException.php new file mode 100644 index 0000000..ef136de --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidCurrentPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * NotValidCurrentPageException. + * + * @author Pablo Díez + */ +class NotValidCurrentPageException extends InvalidArgumentException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidMaxPerPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidMaxPerPageException.php new file mode 100644 index 0000000..20e78b9 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/NotValidMaxPerPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * NotValidMaxPerPageException. + * + * @author Pablo Díez + */ +class NotValidMaxPerPageException extends InvalidArgumentException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/OutOfRangeCurrentPageException.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/OutOfRangeCurrentPageException.php new file mode 100644 index 0000000..5100ddb --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Exception/OutOfRangeCurrentPageException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\Exception; + +/** + * OutOfRangeCurrentPageException. + * + * @author Pablo Díez + */ +class OutOfRangeCurrentPageException extends NotValidCurrentPageException +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Pagerfanta.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Pagerfanta.php new file mode 100644 index 0000000..19d208c --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/Pagerfanta.php @@ -0,0 +1,542 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta; + +use OutOfBoundsException; +use Pagerfanta\Adapter\AdapterInterface; +use Pagerfanta\Exception\LogicException; +use Pagerfanta\Exception\NotBooleanException; +use Pagerfanta\Exception\NotIntegerException; +use Pagerfanta\Exception\NotIntegerMaxPerPageException; +use Pagerfanta\Exception\LessThan1MaxPerPageException; +use Pagerfanta\Exception\NotIntegerCurrentPageException; +use Pagerfanta\Exception\LessThan1CurrentPageException; +use Pagerfanta\Exception\OutOfRangeCurrentPageException; + +/** + * Represents a paginator. + * + * @author Pablo Díez + */ +class Pagerfanta implements \Countable, \IteratorAggregate, \JsonSerializable, PagerfantaInterface +{ + private $adapter; + private $allowOutOfRangePages; + private $normalizeOutOfRangePages; + private $maxPerPage; + private $currentPage; + private $nbResults; + private $currentPageResults; + + /** + * @param AdapterInterface $adapter An adapter. + */ + public function __construct(AdapterInterface $adapter) + { + $this->adapter = $adapter; + $this->allowOutOfRangePages = false; + $this->normalizeOutOfRangePages = false; + $this->maxPerPage = 10; + $this->currentPage = 1; + } + + /** + * Returns the adapter. + * + * @return AdapterInterface The adapter. + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Sets whether or not allow out of range pages. + * + * @param boolean $value + * + * @return self + */ + public function setAllowOutOfRangePages($value) + { + $this->allowOutOfRangePages = $this->filterBoolean($value); + + return $this; + } + + /** + * Returns whether or not allow out of range pages. + * + * @return boolean + */ + public function getAllowOutOfRangePages() + { + return $this->allowOutOfRangePages; + } + + /** + * Sets whether or not normalize out of range pages. + * + * @param boolean $value + * + * @return self + */ + public function setNormalizeOutOfRangePages($value) + { + $this->normalizeOutOfRangePages = $this->filterBoolean($value); + + return $this; + } + + /** + * Returns whether or not normalize out of range pages. + * + * @return boolean + */ + public function getNormalizeOutOfRangePages() + { + return $this->normalizeOutOfRangePages; + } + + private function filterBoolean($value) + { + if (!is_bool($value)) { + throw new NotBooleanException(); + } + + return $value; + } + + /** + * Sets the max per page. + * + * Tries to convert from string and float. + * + * @param integer $maxPerPage + * + * @return self + * + * @throws NotIntegerMaxPerPageException If the max per page is not an integer even converting. + * @throws LessThan1MaxPerPageException If the max per page is less than 1. + */ + public function setMaxPerPage($maxPerPage) + { + $this->maxPerPage = $this->filterMaxPerPage($maxPerPage); + $this->resetForMaxPerPageChange(); + + return $this; + } + + private function filterMaxPerPage($maxPerPage) + { + $maxPerPage = $this->toInteger($maxPerPage); + $this->checkMaxPerPage($maxPerPage); + + return $maxPerPage; + } + + private function checkMaxPerPage($maxPerPage) + { + if (!is_int($maxPerPage)) { + throw new NotIntegerMaxPerPageException(); + } + + if ($maxPerPage < 1) { + throw new LessThan1MaxPerPageException(); + } + } + + private function resetForMaxPerPageChange() + { + $this->currentPageResults = null; + $this->nbResults = null; + } + + /** + * Returns the max per page. + * + * @return integer + */ + public function getMaxPerPage() + { + return $this->maxPerPage; + } + + /** + * Sets the current page. + * + * Tries to convert from string and float. + * + * @param integer $currentPage + * + * @return self + * + * @throws NotIntegerCurrentPageException If the current page is not an integer even converting. + * @throws LessThan1CurrentPageException If the current page is less than 1. + * @throws OutOfRangeCurrentPageException If It is not allowed out of range pages and they are not normalized. + */ + public function setCurrentPage($currentPage) + { + $this->useDeprecatedCurrentPageBooleanArguments(func_get_args()); + + $this->currentPage = $this->filterCurrentPage($currentPage); + $this->resetForCurrentPageChange(); + + return $this; + } + + private function useDeprecatedCurrentPageBooleanArguments($arguments) + { + $this->useDeprecatedCurrentPageAllowOutOfRangePagesBooleanArgument($arguments); + $this->useDeprecatedCurrentPageNormalizeOutOfRangePagesBooleanArgument($arguments); + } + + private function useDeprecatedCurrentPageAllowOutOfRangePagesBooleanArgument($arguments) + { + $index = 1; + $method = 'setAllowOutOfRangePages'; + + $this->useDeprecatedBooleanArgument($arguments, $index, $method); + } + + private function useDeprecatedCurrentPageNormalizeOutOfRangePagesBooleanArgument($arguments) + { + $index = 2; + $method = 'setNormalizeOutOfRangePages'; + + $this->useDeprecatedBooleanArgument($arguments, $index, $method); + } + + private function useDeprecatedBooleanArgument($arguments, $index, $method) + { + if (isset($arguments[$index])) { + $this->$method($arguments[$index]); + } + } + + private function filterCurrentPage($currentPage) + { + $currentPage = $this->toInteger($currentPage); + $this->checkCurrentPage($currentPage); + $currentPage = $this->filterOutOfRangeCurrentPage($currentPage); + + return $currentPage; + } + + private function checkCurrentPage($currentPage) + { + if (!is_int($currentPage)) { + throw new NotIntegerCurrentPageException(); + } + + if ($currentPage < 1) { + throw new LessThan1CurrentPageException(); + } + } + + private function filterOutOfRangeCurrentPage($currentPage) + { + if ($this->notAllowedCurrentPageOutOfRange($currentPage)) { + return $this->normalizeOutOfRangeCurrentPage($currentPage); + } + + return $currentPage; + } + + private function notAllowedCurrentPageOutOfRange($currentPage) + { + return !$this->getAllowOutOfRangePages() && + $this->currentPageOutOfRange($currentPage); + } + + private function currentPageOutOfRange($currentPage) + { + return $currentPage > 1 && $currentPage > $this->getNbPages(); + } + + /** + * @param int $currentPage + * + * @return int + * + * @throws OutOfRangeCurrentPageException If the page should not be normalized + */ + private function normalizeOutOfRangeCurrentPage($currentPage) + { + if ($this->getNormalizeOutOfRangePages()) { + return $this->getNbPages(); + } + + throw new OutOfRangeCurrentPageException(sprintf('Page "%d" does not exist. The currentPage must be inferior to "%d"', $currentPage, $this->getNbPages())); + } + + private function resetForCurrentPageChange() + { + $this->currentPageResults = null; + } + + /** + * Returns the current page. + * + * @return integer + */ + public function getCurrentPage() + { + return $this->currentPage; + } + + /** + * Returns the results for the current page. + * + * @return array|\Traversable + */ + public function getCurrentPageResults() + { + if ($this->notCachedCurrentPageResults()) { + $this->currentPageResults = $this->getCurrentPageResultsFromAdapter(); + } + + return $this->currentPageResults; + } + + private function notCachedCurrentPageResults() + { + return $this->currentPageResults === null; + } + + private function getCurrentPageResultsFromAdapter() + { + $offset = $this->calculateOffsetForCurrentPageResults(); + $length = $this->getMaxPerPage(); + + return $this->adapter->getSlice($offset, $length); + } + + private function calculateOffsetForCurrentPageResults() + { + return ($this->getCurrentPage() - 1) * $this->getMaxPerPage(); + } + + /** + * Calculates the current page offset start + * + * @return int + */ + public function getCurrentPageOffsetStart() + { + return $this->getNbResults() ? + $this->calculateOffsetForCurrentPageResults() + 1 : + 0; + } + + /** + * Calculates the current page offset end + * + * @return int + */ + public function getCurrentPageOffsetEnd() + { + return $this->hasNextPage() ? + $this->getCurrentPage() * $this->getMaxPerPage() : + $this->getNbResults(); + } + + /** + * Returns the number of results. + * + * @return integer + */ + public function getNbResults() + { + if ($this->notCachedNbResults()) { + $this->nbResults = $this->getAdapter()->getNbResults(); + } + + return $this->nbResults; + } + + private function notCachedNbResults() + { + return $this->nbResults === null; + } + + /** + * Returns the number of pages. + * + * @return integer + */ + public function getNbPages() + { + $nbPages = $this->calculateNbPages(); + + if ($nbPages == 0) { + return $this->minimumNbPages(); + } + + return $nbPages; + } + + private function calculateNbPages() + { + return (int) ceil($this->getNbResults() / $this->getMaxPerPage()); + } + + private function minimumNbPages() + { + return 1; + } + + /** + * Returns if the number of results is higher than the max per page. + * + * @return boolean + */ + public function haveToPaginate() + { + return $this->getNbResults() > $this->maxPerPage; + } + + /** + * Returns whether there is previous page or not. + * + * @return boolean + */ + public function hasPreviousPage() + { + return $this->currentPage > 1; + } + + /** + * Returns the previous page. + * + * @return integer + * + * @throws LogicException If there is no previous page. + */ + public function getPreviousPage() + { + if (!$this->hasPreviousPage()) { + throw new LogicException('There is no previous page.'); + } + + return $this->currentPage - 1; + } + + /** + * Returns whether there is next page or not. + * + * @return boolean + */ + public function hasNextPage() + { + return $this->currentPage < $this->getNbPages(); + } + + /** + * Returns the next page. + * + * @return integer + * + * @throws LogicException If there is no next page. + */ + public function getNextPage() + { + if (!$this->hasNextPage()) { + throw new LogicException('There is no next page.'); + } + + return $this->currentPage + 1; + } + + /** + * Implements the \Countable interface. + * + * @return integer The number of results. + */ + public function count() + { + return $this->getNbResults(); + } + + /** + * Implements the \IteratorAggregate interface. + * + * @return \ArrayIterator instance with the current results. + */ + public function getIterator() + { + $results = $this->getCurrentPageResults(); + + if ($results instanceof \Iterator) { + return $results; + } + + if ($results instanceof \IteratorAggregate) { + return $results->getIterator(); + } + + return new \ArrayIterator($results); + } + + /** + * Implements the \JsonSerializable interface. + * + * @return array current page results + */ + public function jsonSerialize() + { + $results = $this->getCurrentPageResults(); + if ($results instanceof \Traversable) { + return iterator_to_array($results); + } + + return $results; + } + + private function toInteger($value) + { + if ($this->needsToIntegerConversion($value)) { + return (int) $value; + } + + return $value; + } + + private function needsToIntegerConversion($value) + { + return (is_string($value) || is_float($value)) && (int) $value == $value; + } + + /** + * Get page number of the item at specified position (1-based index) + * + * @param integer $position + * + * @return integer + */ + public function getPageNumberForItemAtPosition($position) + { + if (!is_int($position)) { + throw new NotIntegerException(); + } + + if ($this->getNbResults() < $position) { + throw new OutOfBoundsException(sprintf( + 'Item requested at position %d, but there are only %d items.', + $position, + $this->getNbResults() + )); + } + + return (int) ceil($position/$this->getMaxPerPage()); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/PagerfantaInterface.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/PagerfantaInterface.php new file mode 100644 index 0000000..c18a297 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/PagerfantaInterface.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta; + +/** + * @deprecated + */ +interface PagerfantaInterface +{ +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php new file mode 100644 index 0000000..65cc34a --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php @@ -0,0 +1,301 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\PagerfantaInterface; +use Pagerfanta\View\Template\TemplateInterface; +use Pagerfanta\View\Template\DefaultTemplate; + +/** + * @author Pablo Díez + */ +class DefaultView implements ViewInterface +{ + private $template; + + private $pagerfanta; + private $proximity; + + private $currentPage; + private $nbPages; + + private $startPage; + private $endPage; + + public function __construct(TemplateInterface $template = null) + { + $this->template = $template ?: $this->createDefaultTemplate(); + } + + protected function createDefaultTemplate() + { + return new DefaultTemplate(); + } + + /** + * {@inheritdoc} + */ + public function render(PagerfantaInterface $pagerfanta, $routeGenerator, array $options = array()) + { + $this->initializePagerfanta($pagerfanta); + $this->initializeOptions($options); + + $this->configureTemplate($routeGenerator, $options); + + return $this->generate(); + } + + private function initializePagerfanta(PagerfantaInterface $pagerfanta) + { + $this->pagerfanta = $pagerfanta; + + $this->currentPage = $pagerfanta->getCurrentPage(); + $this->nbPages = $pagerfanta->getNbPages(); + } + + private function initializeOptions($options) + { + $this->proximity = isset($options['proximity']) ? + (int) $options['proximity'] : + $this->getDefaultProximity(); + } + + protected function getDefaultProximity() + { + return 2; + } + + private function configureTemplate($routeGenerator, $options) + { + $this->template->setRouteGenerator($routeGenerator); + $this->template->setOptions($options); + } + + private function generate() + { + $pages = $this->generatePages(); + + return $this->generateContainer($pages); + } + + private function generateContainer($pages) + { + return str_replace('%pages%', $pages, $this->template->container()); + } + + private function generatePages() + { + $this->calculateStartAndEndPage(); + + return $this->previous(). + $this->first(). + $this->secondIfStartIs3(). + $this->dotsIfStartIsOver3(). + $this->pages(). + $this->dotsIfEndIsUnder3ToLast(). + $this->secondToLastIfEndIs3ToLast(). + $this->last(). + $this->next(); + } + + private function calculateStartAndEndPage() + { + $startPage = $this->currentPage - $this->proximity; + $endPage = $this->currentPage + $this->proximity; + + if ($this->startPageUnderflow($startPage)) { + $endPage = $this->calculateEndPageForStartPageUnderflow($startPage, $endPage); + $startPage = 1; + } + if ($this->endPageOverflow($endPage)) { + $startPage = $this->calculateStartPageForEndPageOverflow($startPage, $endPage); + $endPage = $this->nbPages; + } + + $this->startPage = $startPage; + $this->endPage = $endPage; + } + + private function startPageUnderflow($startPage) + { + return $startPage < 1; + } + + private function endPageOverflow($endPage) + { + return $endPage > $this->nbPages; + } + + private function calculateEndPageForStartPageUnderflow($startPage, $endPage) + { + return min($endPage + (1 - $startPage), $this->nbPages); + } + + private function calculateStartPageForEndPageOverflow($startPage, $endPage) + { + return max($startPage - ($endPage - $this->nbPages), 1); + } + + private function previous() + { + if ($this->pagerfanta->hasPreviousPage()) { + return $this->template->previousEnabled($this->pagerfanta->getPreviousPage()); + } + + return $this->template->previousDisabled(); + } + + private function first() + { + if ($this->startPage > 1) { + return $this->template->first(); + } + } + + private function secondIfStartIs3() + { + if ($this->startPage == 3) { + return $this->template->page(2); + } + } + + private function dotsIfStartIsOver3() + { + if ($this->startPage > 3) { + return $this->template->separator(); + } + } + + private function pages() + { + $pages = ''; + + foreach (range($this->startPage, $this->endPage) as $page) { + $pages .= $this->page($page); + } + + return $pages; + } + + private function page($page) + { + if ($page == $this->currentPage) { + return $this->template->current($page); + } + + return $this->template->page($page); + } + + private function dotsIfEndIsUnder3ToLast() + { + if ($this->endPage < $this->toLast(3)) { + return $this->template->separator(); + } + } + + private function secondToLastIfEndIs3ToLast() + { + if ($this->endPage == $this->toLast(3)) { + return $this->template->page($this->toLast(2)); + } + } + + private function toLast($n) + { + return $this->pagerfanta->getNbPages() - ($n - 1); + } + + private function last() + { + if ($this->pagerfanta->getNbPages() > $this->endPage) { + return $this->template->last($this->pagerfanta->getNbPages()); + } + } + + private function next() + { + if ($this->pagerfanta->hasNextPage()) { + return $this->template->nextEnabled($this->pagerfanta->getNextPage()); + } + + return $this->template->nextDisabled(); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'default'; + } +} + +/* + +CSS: + +.pagerfanta { +} + +.pagerfanta a, +.pagerfanta span { + display: inline-block; + border: 1px solid blue; + color: blue; + margin-right: .2em; + padding: .25em .35em; +} + +.pagerfanta a { + text-decoration: none; +} + +.pagerfanta a:hover { + background: #ccf; +} + +.pagerfanta .dots { + border-width: 0; +} + +.pagerfanta .current { + background: #ccf; + font-weight: bold; +} + +.pagerfanta .disabled { + border-color: #ccf; + color: #ccf; +} + +COLORS: + +.pagerfanta a, +.pagerfanta span { + border-color: blue; + color: blue; +} + +.pagerfanta a:hover { + background: #ccf; +} + +.pagerfanta .current { + background: #ccf; +} + +.pagerfanta .disabled { + border-color: #ccf; + color: #cf; +} + +*/ diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/OptionableView.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/OptionableView.php new file mode 100644 index 0000000..e6147c7 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/OptionableView.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\PagerfantaInterface; + +/** + * OptionableView. + * + * This view renders another view with a default options to reuse them in a project. + * + * @author Pablo Díez + */ +class OptionableView implements ViewInterface +{ + private $view; + private $defaultOptions; + + /** + * Constructor. + * + * @param ViewInterface $view A view. + * @param array $defaultOptions An array of default options. + */ + public function __construct(ViewInterface $view, array $defaultOptions) + { + $this->view = $view; + $this->defaultOptions = $defaultOptions; + } + + /** + * {@inheritdoc} + */ + public function render(PagerfantaInterface $pagerfanta, $routeGenerator, array $options = array()) + { + return $this->view->render($pagerfanta, $routeGenerator, array_merge($this->defaultOptions, $options)); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'optionable'; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/SemanticUiView.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/SemanticUiView.php new file mode 100644 index 0000000..62ca06b --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/SemanticUiView.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\View\Template\SemanticUiTemplate; + +/** + * SemanticUiView. + * + * View that can be used with the pagination module + * from the Semantic UI CSS Toolkit + * http://semantic-ui.com/ + * + * @author Loïc Frémont + */ +class SemanticUiView extends DefaultView +{ + protected function createDefaultTemplate() + { + return new SemanticUiTemplate(); + } + + protected function getDefaultProximity() + { + return 3; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'semantic_ui'; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php new file mode 100644 index 0000000..c251eef --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * @author Pablo Díez + */ +class DefaultTemplate extends Template +{ + static protected $defaultOptions = array( + 'prev_message' => 'Précédent', + 'next_message' => 'Next', + 'css_disabled_class' => 'disabled', + 'css_dots_class' => 'dots', + 'css_current_class' => 'current', + 'dots_text' => '...', + 'container_template' => '', + 'page_template' => '%text%', + 'span_template' => '%text%', + 'rel_previous' => 'prev', + 'rel_next' => 'next' + ); + + public function container() + { + return $this->option('container_template'); + } + + public function page($page) + { + $text = $page; + + return $this->pageWithText($page, $text); + } + + public function pageWithText($page, $text, $rel = null) + { + $search = array('%href%', '%text%', '%rel%'); + + $href = $this->generateRoute($page); + $replace = $rel ? array($href, $text, ' rel="' . $rel . '"') : array($href, $text, ''); + + return str_replace($search, $replace, $this->option('page_template')); + } + + public function previousDisabled() + { + return $this->generateSpan($this->option('css_disabled_class'), $this->option('prev_message')); + } + + public function previousEnabled($page) + { + return $this->pageWithText($page, $this->option('prev_message'), $this->option('rel_previous')); + } + + public function nextDisabled() + { + return $this->generateSpan($this->option('css_disabled_class'), $this->option('next_message')); + } + + public function nextEnabled($page) + { + return $this->pageWithText($page, $this->option('next_message'), $this->option('rel_next')); + } + + public function first() + { + return $this->page(1); + } + + public function last($page) + { + return $this->page($page); + } + + public function current($page) + { + return $this->generateSpan($this->option('css_current_class'), $page); + } + + public function separator() + { + return $this->generateSpan($this->option('css_dots_class'), $this->option('dots_text')); + } + + private function generateSpan($class, $page) + { + $search = array('%class%', '%text%'); + $replace = array($class, $page); + + return str_replace($search, $replace, $this->option('span_template')); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/SemanticUiTemplate.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/SemanticUiTemplate.php new file mode 100644 index 0000000..f607155 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/SemanticUiTemplate.php @@ -0,0 +1,142 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * @author Loïc Frémont + */ +class SemanticUiTemplate extends Template +{ + static protected $defaultOptions = array( + 'prev_message' => '← Previous', + 'next_message' => 'Next →', + 'dots_message' => '…', + 'active_suffix' => '', + 'css_container_class' => 'ui stackable fluid pagination menu', + 'css_item_class' => 'item', + 'css_prev_class' => 'prev', + 'css_next_class' => 'next', + 'css_disabled_class' => 'disabled', + 'css_dots_class' => 'disabled', + 'css_active_class' => 'active', + ); + + public function container() + { + return sprintf('
%%pages%%
', + $this->option('css_container_class') + ); + } + + public function page($page) + { + $text = $page; + + return $this->pageWithText($page, $text); + } + + public function pageWithText($page, $text) + { + $class = null; + + return $this->pageWithTextAndClass($page, $text, $class); + } + + private function pageWithTextAndClass($page, $text, $class) + { + $href = $this->generateRoute($page); + + return $this->link($class, $href, $text); + } + + public function previousDisabled() + { + $class = $this->previousDisabledClass(); + $text = $this->option('prev_message'); + + return $this->div($class, $text); + } + + private function previousDisabledClass() + { + return $this->option('css_prev_class').' '.$this->option('css_disabled_class'); + } + + public function previousEnabled($page) + { + $text = $this->option('prev_message'); + $class = $this->option('css_prev_class'); + + return $this->pageWithTextAndClass($page, $text, $class); + } + + public function nextDisabled() + { + $class = $this->nextDisabledClass(); + $text = $this->option('next_message'); + + return $this->div($class, $text); + } + + private function nextDisabledClass() + { + return $this->option('css_next_class').' '.$this->option('css_disabled_class'); + } + + public function nextEnabled($page) + { + $text = $this->option('next_message'); + $class = $this->option('css_next_class'); + + return $this->pageWithTextAndClass($page, $text, $class); + } + + public function first() + { + return $this->page(1); + } + + public function last($page) + { + return $this->page($page); + } + + public function current($page) + { + $text = trim($page.' '.$this->option('active_suffix')); + $class = $this->option('css_active_class'); + + return $this->div($class, $text); + } + + public function separator() + { + $class = $this->option('css_dots_class'); + $text = $this->option('dots_message'); + + return $this->div($class, $text); + } + + private function link($class, $href, $text) + { + $item_class = $this->option('css_item_class'); + + return sprintf('%s', $item_class, $class, $href, $text); + } + + private function div($class, $text) + { + $item_class = $this->option('css_item_class'); + + return sprintf('
%s
', $item_class, $class, $text); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/Template.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/Template.php new file mode 100644 index 0000000..0713602 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/Template.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * @author Pablo Díez + */ +abstract class Template implements TemplateInterface +{ + protected static $defaultOptions = array(); + + private $routeGenerator; + private $options; + + public function __construct() + { + $this->initializeOptions(); + } + + public function setRouteGenerator($routeGenerator) + { + $this->routeGenerator = $routeGenerator; + } + + public function setOptions(array $options) + { + $this->options = array_merge($this->options, $options); + } + + private function initializeOptions() + { + $this->options = static::$defaultOptions; + } + + protected function generateRoute($page) + { + return call_user_func($this->getRouteGenerator(), $page); + } + + private function getRouteGenerator() + { + if (!$this->routeGenerator) { + throw new \RuntimeException('There is no route generator.'); + } + + return $this->routeGenerator; + } + + protected function option($name) + { + if (!isset($this->options[$name])) { + throw new \InvalidArgumentException(sprintf('The option "%s" does not exist.', $name)); + } + + return $this->options[$name]; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TemplateInterface.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TemplateInterface.php new file mode 100644 index 0000000..5408127 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TemplateInterface.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * @author Pablo Díez + */ +interface TemplateInterface +{ + /** + * Renders the container for the pagination. + * + * The %pages% placeholder will be replaced by the rendering of pages + * + * @return string + */ + public function container(); + + /** + * Renders a given page. + * + * @param int $page + * + * @return string + */ + public function page($page); + + /** + * Renders a given page with a specified text. + * + * @param int $page + * @param string $text + * + * @return string + */ + public function pageWithText($page, $text); + + /** + * Renders the disabled state of the previous page. + * + * @return string + */ + public function previousDisabled(); + + /** + * Renders the enabled state of the previous page. + * + * @param int $page + * + * @return string + */ + public function previousEnabled($page); + + /** + * Renders the disabled state of the next page. + * + * @return string + */ + public function nextDisabled(); + + /** + * Renders the enabled state of the next page. + * + * @param int $page + * + * @return string + */ + public function nextEnabled($page); + + /** + * Renders the first page. + * + * @return string + */ + public function first(); + + /** + * Renders the last page. + * + * @param int $page + * + * @return string + */ + public function last($page); + + /** + * Renders the current page. + * + * @param int $page + * + * @return string + */ + public function current($page); + + /** + * Renders the separator between pages. + * + * @return string + */ + public function separator(); +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap3Template.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap3Template.php new file mode 100644 index 0000000..525352f --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap3Template.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * TwitterBootstrap3Template + */ +class TwitterBootstrap3Template extends TwitterBootstrapTemplate +{ + public function __construct() + { + parent::__construct(); + + $this->setOptions(array('active_suffix' => '(current)')); + } + + public function container() + { + return sprintf('
    %%pages%%
', + $this->option('css_container_class') + ); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap4Template.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap4Template.php new file mode 100644 index 0000000..9bd6a4c --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrap4Template.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * TwitterBootstrap4Template + */ +class TwitterBootstrap4Template extends TwitterBootstrap3Template +{ + protected function linkLi($class, $href, $text, $rel = null) + { + $liClass = implode(' ', array_filter(array('page-item', $class))); + $rel = $rel ? sprintf(' rel="%s"', $rel) : ''; + + return sprintf('
  • %s
  • ', $liClass, $href, $rel, $text); + } + + protected function spanLi($class, $text) + { + $liClass = implode(' ', array_filter(array('page-item', $class))); + + return sprintf('
  • %s
  • ', $liClass, $text); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrapTemplate.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrapTemplate.php new file mode 100644 index 0000000..da6dfa9 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/TwitterBootstrapTemplate.php @@ -0,0 +1,146 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View\Template; + +/** + * @author Pablo Díez + */ +class TwitterBootstrapTemplate extends Template +{ + static protected $defaultOptions = array( + 'prev_message' => '← Précédent', + 'next_message' => 'Suivant →', + 'dots_message' => '…', + 'active_suffix' => '', + 'css_container_class' => 'pagination', + 'css_prev_class' => 'prev', + 'css_next_class' => 'next', + 'css_disabled_class' => 'disabled', + 'css_dots_class' => 'disabled', + 'css_active_class' => 'active', + 'rel_previous' => 'prev', + 'rel_next' => 'next' + ); + + public function container() + { + return sprintf('
      %%pages%%
    ', + $this->option('css_container_class') + ); + } + + public function page($page) + { + $text = $page; + + return $this->pageWithText($page, $text); + } + + public function pageWithText($page, $text) + { + $class = null; + + return $this->pageWithTextAndClass($page, $text, $class); + } + + private function pageWithTextAndClass($page, $text, $class, $rel = null) + { + $href = $this->generateRoute($page); + + return $this->linkLi($class, $href, $text, $rel); + } + + public function previousDisabled() + { + $class = $this->previousDisabledClass(); + $text = $this->option('prev_message'); + + return $this->spanLi($class, $text); + } + + private function previousDisabledClass() + { + return $this->option('css_prev_class').' '.$this->option('css_disabled_class'); + } + + public function previousEnabled($page) + { + $text = $this->option('prev_message'); + $class = $this->option('css_prev_class'); + $rel = $this->option('rel_previous'); + + return $this->pageWithTextAndClass($page, $text, $class, $rel); + } + + public function nextDisabled() + { + $class = $this->nextDisabledClass(); + $text = $this->option('next_message'); + + return $this->spanLi($class, $text); + } + + private function nextDisabledClass() + { + return $this->option('css_next_class').' '.$this->option('css_disabled_class'); + } + + public function nextEnabled($page) + { + $text = $this->option('next_message'); + $class = $this->option('css_next_class'); + $rel = $this->option('rel_next'); + + return $this->pageWithTextAndClass($page, $text, $class, $rel); + } + + public function first() + { + return $this->page(1); + } + + public function last($page) + { + return $this->page($page); + } + + public function current($page) + { + $text = trim($page.' '.$this->option('active_suffix')); + $class = $this->option('css_active_class'); + + return $this->spanLi($class, $text); + } + + public function separator() + { + $class = $this->option('css_dots_class'); + $text = $this->option('dots_message'); + + return $this->spanLi($class, $text); + } + + protected function linkLi($class, $href, $text, $rel = null) + { + $liClass = $class ? sprintf(' class="%s"', $class) : ''; + $rel = $rel ? sprintf(' rel="%s"', $rel) : ''; + + return sprintf('%s', $liClass, $href, $rel, $text); + } + + protected function spanLi($class, $text) + { + $liClass = $class ? sprintf(' class="%s"', $class) : ''; + + return sprintf('%s', $liClass, $text); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap3View.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap3View.php new file mode 100644 index 0000000..f314e38 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap3View.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\View\Template\TwitterBootstrap3Template; + +/** + * TwitterBootstrap3View. + * + * View that can be used with the pagination module + * from the Twitter Bootstrap3 CSS Toolkit + * http://getbootstrap.com/ + * + */ +class TwitterBootstrap3View extends TwitterBootstrapView +{ + protected function createDefaultTemplate() + { + return new TwitterBootstrap3Template(); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'twitter_bootstrap3'; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap4View.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap4View.php new file mode 100644 index 0000000..de8190f --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrap4View.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\View\Template\TwitterBootstrap4Template; + +/** + * TwitterBootstrap4View. + * + * View that can be used with the pagination module + * from the Twitter Bootstrap4 CSS Toolkit + * http://getbootstrap.com/ + * + */ +class TwitterBootstrap4View extends TwitterBootstrapView +{ + protected function createDefaultTemplate() + { + return new TwitterBootstrap4Template(); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'twitter_bootstrap4'; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrapView.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrapView.php new file mode 100644 index 0000000..942f9c1 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/TwitterBootstrapView.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\View\Template\TwitterBootstrapTemplate; + +/** + * TwitterBootstrapView. + * + * View that can be used with the pagination module + * from the Twitter Bootstrap CSS Toolkit + * http://twitter.github.com/bootstrap/ + * + * @author Pablo Díez + * @author Jan Sorgalla + */ +class TwitterBootstrapView extends DefaultView +{ + protected function createDefaultTemplate() + { + return new TwitterBootstrapTemplate(); + } + + protected function getDefaultProximity() + { + return 3; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'twitter_bootstrap'; + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactory.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactory.php new file mode 100644 index 0000000..16e3b37 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactory.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\Exception\InvalidArgumentException; + +/** + * ViewFactory. + * + * @author Pablo Díez + */ +class ViewFactory implements ViewFactoryInterface +{ + private $views; + + /** + * Constructor. + */ + public function __construct() + { + $this->views = array(); + } + + /** + * {@inheritdoc} + */ + public function set($name, ViewInterface $view) + { + $this->views[$name] = $view; + } + + /** + * {@inheritdoc} + */ + public function has($name) + { + return isset($this->views[$name]); + } + + /** + * {@inheritdoc} + */ + public function add(array $views) + { + foreach ($views as $name => $view) { + $this->set($name, $view); + } + } + + /** + * {@inheritdoc} + */ + public function get($name) + { + if (!$this->has($name)) { + throw new InvalidArgumentException(sprintf('The view "%s" does not exist.', $name)); + } + + return $this->views[$name]; + } + + /** + * {@inheritdoc} + */ + public function remove($name) + { + if (!$this->has($name)) { + throw new InvalidArgumentException(sprintf('The view "%s" does not exist.', $name)); + } + + unset($this->views[$name]); + } + + /** + * {@inheritdoc} + */ + public function all() + { + return $this->views; + } + + /** + * {@inheritdoc} + */ + public function clear() + { + $this->views = array(); + } +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactoryInterface.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactoryInterface.php new file mode 100644 index 0000000..850e269 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewFactoryInterface.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +/** + * ViewFactoryInterface. + * + * @author Pablo Díez + */ +interface ViewFactoryInterface +{ + /** + * Sets a view. + * + * @param string $name The view name. + * @param ViewInterface $view The view. + */ + public function set($name, ViewInterface $view); + + /** + * Returns whether a view exists or not. + * + * @param string $name The name. + * + * @return boolean Whether a view exists or not. + */ + public function has($name); + + /** + * Adds views. + * + * @param array $views An array of views. + */ + public function add(array $views); + + /** + * Returns a view. + * + * @param string $name The name. + * + * @return ViewInterface The view. + * + * @throws \InvalidArgumentException If the view does not exist. + */ + public function get($name); + + /** + * Returns all the views. + * + * @return array The views. + */ + public function all(); + + /** + * Removes a view. + * + * @param string $name The name. + * + * @throws \InvalidArgumentException If the view does not exist. + */ + public function remove($name); + + /** + * Clears the views. + */ + public function clear(); +} diff --git a/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewInterface.php b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewInterface.php new file mode 100644 index 0000000..a8dad35 --- /dev/null +++ b/vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/ViewInterface.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Pagerfanta\View; + +use Pagerfanta\PagerfantaInterface; + +/** + * ViewInterface. + * + * @author Pablo Díez + */ +interface ViewInterface +{ + /** + * Renders a pagerfanta. + * + * The route generator can be any callable to generate + * the routes receiving the page number as first and + * unique argument. + * + * @param PagerfantaInterface $pagerfanta A pagerfanta. + * @param callable $routeGenerator A callable to generate the routes. + * @param array $options An array of options (optional). + */ + public function render(PagerfantaInterface $pagerfanta, $routeGenerator, array $options = array()); + + /** + * Returns the canonical name. + * + * @return string The canonical name. + */ + public function getName(); +} diff --git a/vendor/paragonie/random_compat/LICENSE b/vendor/paragonie/random_compat/LICENSE new file mode 100644 index 0000000..45c7017 --- /dev/null +++ b/vendor/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/paragonie/random_compat/build-phar.sh b/vendor/paragonie/random_compat/build-phar.sh new file mode 100644 index 0000000..b4a5ba3 --- /dev/null +++ b/vendor/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json new file mode 100644 index 0000000..1fa8de9 --- /dev/null +++ b/vendor/paragonie/random_compat/composer.json @@ -0,0 +1,34 @@ +{ + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "polyfill", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "vimeo/psalm": "^1", + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + } +} diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 0000000..eb50ebf --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 0000000..6a1d7f3 --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php new file mode 100644 index 0000000..c7731a5 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random.php @@ -0,0 +1,32 @@ +buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/vendor/paragonie/random_compat/psalm-autoload.php b/vendor/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 0000000..d71d1b8 --- /dev/null +++ b/vendor/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,9 @@ + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/.gitignore b/vendor/phar-io/manifest/.gitignore new file mode 100644 index 0000000..94d433b --- /dev/null +++ b/vendor/phar-io/manifest/.gitignore @@ -0,0 +1,8 @@ +/.idea +/.php_cs.cache +/composer.lock +/src/autoload.php +/tools +/vendor + +/build diff --git a/vendor/phar-io/manifest/.php_cs b/vendor/phar-io/manifest/.php_cs new file mode 100644 index 0000000..159d6a3 --- /dev/null +++ b/vendor/phar-io/manifest/.php_cs @@ -0,0 +1,67 @@ +files() + ->in('src') + ->in('tests') + ->name('*.php'); + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(\Symfony\CS\FixerInterface::NONE_LEVEL) + ->fixers( + array( + 'align_double_arrow', + 'align_equals', + 'concat_with_spaces', + 'duplicate_semicolon', + 'elseif', + 'empty_return', + 'encoding', + 'eof_ending', + 'extra_empty_lines', + 'function_call_space', + 'function_declaration', + 'indentation', + 'join_function', + 'line_after_namespace', + 'linefeed', + 'list_commas', + 'lowercase_constants', + 'lowercase_keywords', + 'method_argument_space', + 'multiple_use', + 'namespace_no_leading_whitespace', + 'no_blank_lines_after_class_opening', + 'no_empty_lines_after_phpdocs', + 'parenthesis', + 'php_closing_tag', + 'phpdoc_indent', + 'phpdoc_no_access', + 'phpdoc_no_empty_return', + 'phpdoc_no_package', + 'phpdoc_params', + 'phpdoc_scalar', + 'phpdoc_separation', + 'phpdoc_to_comment', + 'phpdoc_trim', + 'phpdoc_types', + 'phpdoc_var_without_name', + 'remove_lines_between_uses', + 'return', + 'self_accessor', + 'short_array_syntax', + 'short_tag', + 'single_line_after_imports', + 'single_quote', + 'spaces_before_semicolon', + 'spaces_cast', + 'ternary_spaces', + 'trailing_spaces', + 'trim_array_spaces', + 'unused_use', + 'visibility', + 'whitespacy_lines' + ) + ) + ->finder($finder); + diff --git a/vendor/phar-io/manifest/.travis.yml b/vendor/phar-io/manifest/.travis.yml new file mode 100644 index 0000000..b4be10f --- /dev/null +++ b/vendor/phar-io/manifest/.travis.yml @@ -0,0 +1,33 @@ +os: +- linux + +language: php + +before_install: + - wget https://phar.io/releases/phive.phar + - wget https://phar.io/releases/phive.phar.asc + - gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9B2D5D79 + - gpg --verify phive.phar.asc phive.phar + - chmod +x phive.phar + - sudo mv phive.phar /usr/bin/phive + +install: + - ant setup + +script: ./tools/phpunit + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.0snapshot + - 7.1snapshot + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +notifications: + email: false diff --git a/vendor/phar-io/manifest/LICENSE b/vendor/phar-io/manifest/LICENSE new file mode 100644 index 0000000..96051b1 --- /dev/null +++ b/vendor/phar-io/manifest/LICENSE @@ -0,0 +1,31 @@ +manifest + +Copyright (c) 2016 Arne Blankerts , Sebastian Heuer , Sebastian Bergmann , and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Arne Blankerts nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/manifest/README.md b/vendor/phar-io/manifest/README.md new file mode 100644 index 0000000..e6d0b05 --- /dev/null +++ b/vendor/phar-io/manifest/README.md @@ -0,0 +1,30 @@ +# Manifest + +Component for reading [phar.io](https://phar.io/) manifest information from a [PHP Archive (PHAR)](http://php.net/phar). + +[![Build Status](https://travis-ci.org/phar-io/manifest.svg?branch=master)](https://travis-ci.org/phar-io/manifest) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phar-io/manifest/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phar-io/manifest/?branch=master) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d8cc6035-69ad-477d-bd1a-ccc605480fd7/mini.png)](https://insight.sensiolabs.com/projects/d8cc6035-69ad-477d-bd1a-ccc605480fd7) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/manifest + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/manifest + +## Usage + +```php +use PharIo\Manifest\ManifestLoader; +use PharIo\Manifest\ManifestSerializer; + +$manifest = ManifestLoader::fromFile('manifest.xml'); + +var_dump($manifest); + +echo (new ManifestSerializer)->serializeToString($manifest); +``` diff --git a/vendor/phar-io/manifest/build.xml b/vendor/phar-io/manifest/build.xml new file mode 100644 index 0000000..fc6eb1a --- /dev/null +++ b/vendor/phar-io/manifest/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/composer.json b/vendor/phar-io/manifest/composer.json new file mode 100644 index 0000000..832134d --- /dev/null +++ b/vendor/phar-io/manifest/composer.json @@ -0,0 +1,42 @@ +{ + "name": "phar-io/manifest", + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/manifest/issues" + }, + "require": { + "php": "^5.6 || ^7.0", + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} + diff --git a/vendor/phar-io/manifest/examples/example-01.php b/vendor/phar-io/manifest/examples/example-01.php new file mode 100644 index 0000000..345c407 --- /dev/null +++ b/vendor/phar-io/manifest/examples/example-01.php @@ -0,0 +1,23 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PharIo\Manifest\ManifestLoader; +use PharIo\Manifest\ManifestSerializer; + +require __DIR__ . '/../vendor/autoload.php'; + +$manifest = ManifestLoader::fromFile(__DIR__ . '/../tests/_fixture/phpunit-5.6.5.xml'); + +echo sprintf( + "Manifest for %s (%s):\n\n", + $manifest->getName(), + $manifest->getVersion()->getVersionString() +); +echo (new ManifestSerializer)->serializeToString($manifest); diff --git a/vendor/phar-io/manifest/phive.xml b/vendor/phar-io/manifest/phive.xml new file mode 100644 index 0000000..69f2f91 --- /dev/null +++ b/vendor/phar-io/manifest/phive.xml @@ -0,0 +1,4 @@ + + + + diff --git a/vendor/phar-io/manifest/phpunit.xml b/vendor/phar-io/manifest/phpunit.xml new file mode 100644 index 0000000..2d7708e --- /dev/null +++ b/vendor/phar-io/manifest/phpunit.xml @@ -0,0 +1,20 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phar-io/manifest/src/ManifestDocumentMapper.php b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php new file mode 100644 index 0000000..d41e4f9 --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php @@ -0,0 +1,193 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\Exception as VersionException; +use PharIo\Version\VersionConstraintParser; + +class ManifestDocumentMapper { + /** + * @param ManifestDocument $document + * + * @returns Manifest + * + * @throws ManifestDocumentMapperException + */ + public function map(ManifestDocument $document) { + try { + $contains = $document->getContainsElement(); + $type = $this->mapType($contains); + $copyright = $this->mapCopyright($document->getCopyrightElement()); + $requirements = $this->mapRequirements($document->getRequiresElement()); + $bundledComponents = $this->mapBundledComponents($document); + + return new Manifest( + new ApplicationName($contains->getName()), + new Version($contains->getVersion()), + $type, + $copyright, + $requirements, + $bundledComponents + ); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e); + } catch (Exception $e) { + throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * @param ContainsElement $contains + * + * @return Type + * + * @throws ManifestDocumentMapperException + */ + private function mapType(ContainsElement $contains) { + switch ($contains->getType()) { + case 'application': + return Type::application(); + case 'library': + return Type::library(); + case 'extension': + return $this->mapExtension($contains->getExtensionElement()); + } + + throw new ManifestDocumentMapperException( + sprintf('Unsupported type %s', $contains->getType()) + ); + } + + /** + * @param CopyrightElement $copyright + * + * @return CopyrightInformation + * + * @throws InvalidUrlException + * @throws InvalidEmailException + */ + private function mapCopyright(CopyrightElement $copyright) { + $authors = new AuthorCollection(); + + foreach($copyright->getAuthorElements() as $authorElement) { + $authors->add( + new Author( + $authorElement->getName(), + new Email($authorElement->getEmail()) + ) + ); + } + + $licenseElement = $copyright->getLicenseElement(); + $license = new License( + $licenseElement->getType(), + new Url($licenseElement->getUrl()) + ); + + return new CopyrightInformation( + $authors, + $license + ); + } + + /** + * @param RequiresElement $requires + * + * @return RequirementCollection + * + * @throws ManifestDocumentMapperException + */ + private function mapRequirements(RequiresElement $requires) { + $collection = new RequirementCollection(); + $phpElement = $requires->getPHPElement(); + $parser = new VersionConstraintParser; + + try { + $versionConstraint = $parser->parse($phpElement->getVersion()); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + $e->getCode(), + $e + ); + } + + $collection->add( + new PhpVersionRequirement( + $versionConstraint + ) + ); + + if (!$phpElement->hasExtElements()) { + return $collection; + } + + foreach($phpElement->getExtElements() as $extElement) { + $collection->add( + new PhpExtensionRequirement($extElement->getName()) + ); + } + + return $collection; + } + + /** + * @param ManifestDocument $document + * + * @return BundledComponentCollection + */ + private function mapBundledComponents(ManifestDocument $document) { + $collection = new BundledComponentCollection(); + + if (!$document->hasBundlesElement()) { + return $collection; + } + + foreach($document->getBundlesElement()->getComponentElements() as $componentElement) { + $collection->add( + new BundledComponent( + $componentElement->getName(), + new Version( + $componentElement->getVersion() + ) + ) + ); + } + + return $collection; + } + + /** + * @param ExtensionElement $extension + * + * @return Extension + * + * @throws ManifestDocumentMapperException + */ + private function mapExtension(ExtensionElement $extension) { + try { + $parser = new VersionConstraintParser; + $versionConstraint = $parser->parse($extension->getCompatible()); + + return Type::extension( + new ApplicationName($extension->getFor()), + $versionConstraint + ); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + $e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestLoader.php b/vendor/phar-io/manifest/src/ManifestLoader.php new file mode 100644 index 0000000..81c5c90 --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestLoader.php @@ -0,0 +1,66 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ManifestLoader { + /** + * @param string $filename + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromFile($filename) { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromFile($filename) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + sprintf('Loading %s failed.', $filename), + $e->getCode(), + $e + ); + } + } + + /** + * @param string $filename + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromPhar($filename) { + return self::fromFile('phar://' . $filename . '/manifest.xml'); + } + + /** + * @param string $manifest + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromString($manifest) { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromString($manifest) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + 'Processing string failed', + $e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestSerializer.php b/vendor/phar-io/manifest/src/ManifestSerializer.php new file mode 100644 index 0000000..4c18ddd --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestSerializer.php @@ -0,0 +1,163 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\AnyVersionConstraint; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; +use XMLWriter; + +class ManifestSerializer { + /** + * @var XMLWriter + */ + private $xmlWriter; + + public function serializeToFile(Manifest $manifest, $filename) { + file_put_contents( + $filename, + $this->serializeToString($manifest) + ); + } + + public function serializeToString(Manifest $manifest) { + $this->startDocument(); + + $this->addContains($manifest->getName(), $manifest->getVersion(), $manifest->getType()); + $this->addCopyright($manifest->getCopyrightInformation()); + $this->addRequirements($manifest->getRequirements()); + $this->addBundles($manifest->getBundledComponents()); + + return $this->finishDocument(); + } + + private function startDocument() { + $xmlWriter = new XMLWriter(); + $xmlWriter->openMemory(); + $xmlWriter->setIndent(true); + $xmlWriter->setIndentString(str_repeat(' ', 4)); + $xmlWriter->startDocument('1.0', 'UTF-8'); + $xmlWriter->startElement('phar'); + $xmlWriter->writeAttribute('xmlns', 'https://phar.io/xml/manifest/1.0'); + + $this->xmlWriter = $xmlWriter; + } + + private function finishDocument() { + $this->xmlWriter->endElement(); + $this->xmlWriter->endDocument(); + + return $this->xmlWriter->outputMemory(); + } + + private function addContains($name, Version $version, Type $type) { + $this->xmlWriter->startElement('contains'); + $this->xmlWriter->writeAttribute('name', $name); + $this->xmlWriter->writeAttribute('version', $version->getVersionString()); + + switch (true) { + case $type->isApplication(): { + $this->xmlWriter->writeAttribute('type', 'application'); + break; + } + + case $type->isLibrary(): { + $this->xmlWriter->writeAttribute('type', 'library'); + break; + } + + case $type->isExtension(): { + /* @var $type Extension */ + $this->xmlWriter->writeAttribute('type', 'extension'); + $this->addExtension($type->getApplicationName(), $type->getVersionConstraint()); + break; + } + + default: { + $this->xmlWriter->writeAttribute('type', 'custom'); + } + } + + $this->xmlWriter->endElement(); + } + + private function addCopyright(CopyrightInformation $copyrightInformation) { + $this->xmlWriter->startElement('copyright'); + + foreach($copyrightInformation->getAuthors() as $author) { + $this->xmlWriter->startElement('author'); + $this->xmlWriter->writeAttribute('name', $author->getName()); + $this->xmlWriter->writeAttribute('email', (string) $author->getEmail()); + $this->xmlWriter->endElement(); + } + + $license = $copyrightInformation->getLicense(); + + $this->xmlWriter->startElement('license'); + $this->xmlWriter->writeAttribute('type', $license->getName()); + $this->xmlWriter->writeAttribute('url', $license->getUrl()); + $this->xmlWriter->endElement(); + + $this->xmlWriter->endElement(); + } + + private function addRequirements(RequirementCollection $requirementCollection) { + $phpRequirement = new AnyVersionConstraint(); + $extensions = []; + + foreach($requirementCollection as $requirement) { + if ($requirement instanceof PhpVersionRequirement) { + $phpRequirement = $requirement->getVersionConstraint(); + continue; + } + + if ($requirement instanceof PhpExtensionRequirement) { + $extensions[] = (string) $requirement; + } + } + + $this->xmlWriter->startElement('requires'); + $this->xmlWriter->startElement('php'); + $this->xmlWriter->writeAttribute('version', $phpRequirement->asString()); + + foreach($extensions as $extension) { + $this->xmlWriter->startElement('ext'); + $this->xmlWriter->writeAttribute('name', $extension); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + $this->xmlWriter->endElement(); + } + + private function addBundles(BundledComponentCollection $bundledComponentCollection) { + if (count($bundledComponentCollection) === 0) { + return; + } + $this->xmlWriter->startElement('bundles'); + + foreach($bundledComponentCollection as $bundledComponent) { + $this->xmlWriter->startElement('component'); + $this->xmlWriter->writeAttribute('name', $bundledComponent->getName()); + $this->xmlWriter->writeAttribute('version', $bundledComponent->getVersion()->getVersionString()); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + } + + private function addExtension($application, VersionConstraint $versionConstraint) { + $this->xmlWriter->startElement('extension'); + $this->xmlWriter->writeAttribute('for', $application); + $this->xmlWriter->writeAttribute('compatible', $versionConstraint->asString()); + $this->xmlWriter->endElement(); + } +} diff --git a/vendor/phar-io/manifest/src/exceptions/Exception.php b/vendor/phar-io/manifest/src/exceptions/Exception.php new file mode 100644 index 0000000..3ce46f2 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/Exception.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +interface Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php new file mode 100644 index 0000000..a53735a --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php @@ -0,0 +1,16 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidApplicationNameException extends \InvalidArgumentException implements Exception { + const NotAString = 1; + const InvalidFormat = 2; +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php new file mode 100644 index 0000000..854399b --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidEmailException extends \InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php new file mode 100644 index 0000000..cdd8323 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidUrlException extends \InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php new file mode 100644 index 0000000..8b40195 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php @@ -0,0 +1,6 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Application extends Type { + /** + * @return bool + */ + public function isApplication() { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/ApplicationName.php b/vendor/phar-io/manifest/src/values/ApplicationName.php new file mode 100644 index 0000000..1e71af4 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/ApplicationName.php @@ -0,0 +1,65 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ApplicationName { + /** + * @var string + */ + private $name; + + /** + * ApplicationName constructor. + * + * @param string $name + * + * @throws InvalidApplicationNameException + */ + public function __construct($name) { + $this->ensureIsString($name); + $this->ensureValidFormat($name); + $this->name = $name; + } + + /** + * @return string + */ + public function __toString() { + return $this->name; + } + + public function isEqual(ApplicationName $name) { + return $this->name === $name->name; + } + + /** + * @param string $name + * + * @throws InvalidApplicationNameException + */ + private function ensureValidFormat($name) { + if (!preg_match('#\w/\w#', $name)) { + throw new InvalidApplicationNameException( + sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name), + InvalidApplicationNameException::InvalidFormat + ); + } + } + + private function ensureIsString($name) { + if (!is_string($name)) { + throw new InvalidApplicationNameException( + 'Name must be a string', + InvalidApplicationNameException::NotAString + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Author.php b/vendor/phar-io/manifest/src/values/Author.php new file mode 100644 index 0000000..8295f51 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Author.php @@ -0,0 +1,57 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Author { + /** + * @var string + */ + private $name; + + /** + * @var Email + */ + private $email; + + /** + * @param string $name + * @param Email $email + */ + public function __construct($name, Email $email) { + $this->name = $name; + $this->email = $email; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Email + */ + public function getEmail() { + return $this->email; + } + + /** + * @return string + */ + public function __toString() { + return sprintf( + '%s <%s>', + $this->name, + $this->email + ); + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollection.php b/vendor/phar-io/manifest/src/values/AuthorCollection.php new file mode 100644 index 0000000..d915879 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorCollection implements \Countable, \IteratorAggregate { + /** + * @var Author[] + */ + private $authors = []; + + public function add(Author $author) { + $this->authors[] = $author; + } + + /** + * @return Author[] + */ + public function getAuthors() { + return $this->authors; + } + + /** + * @return int + */ + public function count() { + return count($this->authors); + } + + /** + * @return AuthorCollectionIterator + */ + public function getIterator() { + return new AuthorCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php new file mode 100644 index 0000000..792a050 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorCollectionIterator implements \Iterator { + /** + * @var Author[] + */ + private $authors = []; + + /** + * @var int + */ + private $position; + + public function __construct(AuthorCollection $authors) { + $this->authors = $authors->getAuthors(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->authors); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return Author + */ + public function current() { + return $this->authors[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponent.php b/vendor/phar-io/manifest/src/values/BundledComponent.php new file mode 100644 index 0000000..846d15a --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponent.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class BundledComponent { + /** + * @var string + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @param string $name + * @param Version $version + */ + public function __construct($name, Version $version) { + $this->name = $name; + $this->version = $version; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Version + */ + public function getVersion() { + return $this->version; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollection.php b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php new file mode 100644 index 0000000..2dbb918 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundledComponentCollection implements \Countable, \IteratorAggregate { + /** + * @var BundledComponent[] + */ + private $bundledComponents = []; + + public function add(BundledComponent $bundledComponent) { + $this->bundledComponents[] = $bundledComponent; + } + + /** + * @return BundledComponent[] + */ + public function getBundledComponents() { + return $this->bundledComponents; + } + + /** + * @return int + */ + public function count() { + return count($this->bundledComponents); + } + + /** + * @return BundledComponentCollectionIterator + */ + public function getIterator() { + return new BundledComponentCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php new file mode 100644 index 0000000..13b8f05 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundledComponentCollectionIterator implements \Iterator { + /** + * @var BundledComponent[] + */ + private $bundledComponents = []; + + /** + * @var int + */ + private $position; + + public function __construct(BundledComponentCollection $bundledComponents) { + $this->bundledComponents = $bundledComponents->getBundledComponents(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->bundledComponents); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return BundledComponent + */ + public function current() { + return $this->bundledComponents[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/CopyrightInformation.php b/vendor/phar-io/manifest/src/values/CopyrightInformation.php new file mode 100644 index 0000000..ece60b1 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/CopyrightInformation.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class CopyrightInformation { + /** + * @var AuthorCollection + */ + private $authors; + + /** + * @var License + */ + private $license; + + public function __construct(AuthorCollection $authors, License $license) { + $this->authors = $authors; + $this->license = $license; + } + + /** + * @return AuthorCollection + */ + public function getAuthors() { + return $this->authors; + } + + /** + * @return License + */ + public function getLicense() { + return $this->license; + } +} diff --git a/vendor/phar-io/manifest/src/values/Email.php b/vendor/phar-io/manifest/src/values/Email.php new file mode 100644 index 0000000..57cce04 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Email.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Email { + /** + * @var string + */ + private $email; + + /** + * @param string $email + * + * @throws InvalidEmailException + */ + public function __construct($email) { + $this->ensureEmailIsValid($email); + + $this->email = $email; + } + + /** + * @return string + */ + public function __toString() { + return $this->email; + } + + /** + * @param string $url + * + * @throws InvalidEmailException + */ + private function ensureEmailIsValid($url) { + if (filter_var($url, \FILTER_VALIDATE_EMAIL) === false) { + throw new InvalidEmailException; + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Extension.php b/vendor/phar-io/manifest/src/values/Extension.php new file mode 100644 index 0000000..90d6a6f --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Extension.php @@ -0,0 +1,75 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; + +class Extension extends Type { + /** + * @var ApplicationName + */ + private $application; + + /** + * @var VersionConstraint + */ + private $versionConstraint; + + /** + * @param ApplicationName $application + * @param VersionConstraint $versionConstraint + */ + public function __construct(ApplicationName $application, VersionConstraint $versionConstraint) { + $this->application = $application; + $this->versionConstraint = $versionConstraint; + } + + /** + * @return ApplicationName + */ + public function getApplicationName() { + return $this->application; + } + + /** + * @return VersionConstraint + */ + public function getVersionConstraint() { + return $this->versionConstraint; + } + + /** + * @return bool + */ + public function isExtension() { + return true; + } + + /** + * @param ApplicationName $name + * + * @return bool + */ + public function isExtensionFor(ApplicationName $name) { + return $this->application->isEqual($name); + } + + /** + * @param ApplicationName $name + * @param Version $version + * + * @return bool + */ + public function isCompatibleWith(ApplicationName $name, Version $version) { + return $this->isExtensionFor($name) && $this->versionConstraint->complies($version); + } +} diff --git a/vendor/phar-io/manifest/src/values/Library.php b/vendor/phar-io/manifest/src/values/Library.php new file mode 100644 index 0000000..a6ff944 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Library.php @@ -0,0 +1,20 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Library extends Type { + /** + * @return bool + */ + public function isLibrary() { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/License.php b/vendor/phar-io/manifest/src/values/License.php new file mode 100644 index 0000000..e278670 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/License.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class License { + /** + * @var string + */ + private $name; + + /** + * @var Url + */ + private $url; + + public function __construct($name, Url $url) { + $this->name = $name; + $this->url = $url; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Url + */ + public function getUrl() { + return $this->url; + } +} diff --git a/vendor/phar-io/manifest/src/values/Manifest.php b/vendor/phar-io/manifest/src/values/Manifest.php new file mode 100644 index 0000000..217acef --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Manifest.php @@ -0,0 +1,138 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class Manifest { + /** + * @var ApplicationName + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @var Type + */ + private $type; + + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var RequirementCollection + */ + private $requirements; + + /** + * @var BundledComponentCollection + */ + private $bundledComponents; + + public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) { + $this->name = $name; + $this->version = $version; + $this->type = $type; + $this->copyrightInformation = $copyrightInformation; + $this->requirements = $requirements; + $this->bundledComponents = $bundledComponents; + } + + /** + * @return ApplicationName + */ + public function getName() { + return $this->name; + } + + /** + * @return Version + */ + public function getVersion() { + return $this->version; + } + + /** + * @return Type + */ + public function getType() { + return $this->type; + } + + /** + * @return CopyrightInformation + */ + public function getCopyrightInformation() { + return $this->copyrightInformation; + } + + /** + * @return RequirementCollection + */ + public function getRequirements() { + return $this->requirements; + } + + /** + * @return BundledComponentCollection + */ + public function getBundledComponents() { + return $this->bundledComponents; + } + + /** + * @return bool + */ + public function isApplication() { + return $this->type->isApplication(); + } + + /** + * @return bool + */ + public function isLibrary() { + return $this->type->isLibrary(); + } + + /** + * @return bool + */ + public function isExtension() { + return $this->type->isExtension(); + } + + /** + * @param ApplicationName $application + * @param Version|null $version + * + * @return bool + */ + public function isExtensionFor(ApplicationName $application, Version $version = null) { + if (!$this->isExtension()) { + return false; + } + + /** @var Extension $type */ + $type = $this->type; + + if ($version !== null) { + return $type->isCompatibleWith($application, $version); + } + + return $type->isExtensionFor($application); + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php new file mode 100644 index 0000000..6dd9296 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php @@ -0,0 +1,32 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class PhpExtensionRequirement implements Requirement { + /** + * @var string + */ + private $extension; + + /** + * @param string $extension + */ + public function __construct($extension) { + $this->extension = $extension; + } + + /** + * @return string + */ + public function __toString() { + return $this->extension; + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php new file mode 100644 index 0000000..8ad3e76 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php @@ -0,0 +1,31 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +class PhpVersionRequirement implements Requirement { + /** + * @var VersionConstraint + */ + private $versionConstraint; + + public function __construct(VersionConstraint $versionConstraint) { + $this->versionConstraint = $versionConstraint; + } + + /** + * @return VersionConstraint + */ + public function getVersionConstraint() { + return $this->versionConstraint; + } +} diff --git a/vendor/phar-io/manifest/src/values/Requirement.php b/vendor/phar-io/manifest/src/values/Requirement.php new file mode 100644 index 0000000..03bb56d --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Requirement.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +interface Requirement { +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollection.php b/vendor/phar-io/manifest/src/values/RequirementCollection.php new file mode 100644 index 0000000..af0e09b --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequirementCollection implements \Countable, \IteratorAggregate { + /** + * @var Requirement[] + */ + private $requirements = []; + + public function add(Requirement $requirement) { + $this->requirements[] = $requirement; + } + + /** + * @return Requirement[] + */ + public function getRequirements() { + return $this->requirements; + } + + /** + * @return int + */ + public function count() { + return count($this->requirements); + } + + /** + * @return RequirementCollectionIterator + */ + public function getIterator() { + return new RequirementCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php new file mode 100644 index 0000000..9bb7003 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequirementCollectionIterator implements \Iterator { + /** + * @var Requirement[] + */ + private $requirements = []; + + /** + * @var int + */ + private $position; + + public function __construct(RequirementCollection $requirements) { + $this->requirements = $requirements->getRequirements(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->requirements); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return Requirement + */ + public function current() { + return $this->requirements[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/Type.php b/vendor/phar-io/manifest/src/values/Type.php new file mode 100644 index 0000000..31fbd44 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Type.php @@ -0,0 +1,60 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +abstract class Type { + /** + * @return Application + */ + public static function application() { + return new Application; + } + + /** + * @return Library + */ + public static function library() { + return new Library; + } + + /** + * @param ApplicationName $application + * @param VersionConstraint $versionConstraint + * + * @return Extension + */ + public static function extension(ApplicationName $application, VersionConstraint $versionConstraint) { + return new Extension($application, $versionConstraint); + } + + /** + * @return bool + */ + public function isApplication() { + return false; + } + + /** + * @return bool + */ + public function isLibrary() { + return false; + } + + /** + * @return bool + */ + public function isExtension() { + return false; + } +} diff --git a/vendor/phar-io/manifest/src/values/Url.php b/vendor/phar-io/manifest/src/values/Url.php new file mode 100644 index 0000000..37917c8 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Url.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Url { + /** + * @var string + */ + private $url; + + /** + * @param string $url + * + * @throws InvalidUrlException + */ + public function __construct($url) { + $this->ensureUrlIsValid($url); + + $this->url = $url; + } + + /** + * @return string + */ + public function __toString() { + return $this->url; + } + + /** + * @param string $url + * + * @throws InvalidUrlException + */ + private function ensureUrlIsValid($url) { + if (filter_var($url, \FILTER_VALIDATE_URL) === false) { + throw new InvalidUrlException; + } + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElement.php b/vendor/phar-io/manifest/src/xml/AuthorElement.php new file mode 100644 index 0000000..a32f397 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getEmail() { + return $this->getAttributeValue('email'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php new file mode 100644 index 0000000..1240d8c --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorElementCollection extends ElementCollection { + public function current() { + return new AuthorElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/BundlesElement.php b/vendor/phar-io/manifest/src/xml/BundlesElement.php new file mode 100644 index 0000000..b90023e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/BundlesElement.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundlesElement extends ManifestElement { + public function getComponentElements() { + return new ComponentElementCollection( + $this->getChildrenByName('component') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElement.php b/vendor/phar-io/manifest/src/xml/ComponentElement.php new file mode 100644 index 0000000..64ed6b0 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ComponentElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getVersion() { + return $this->getAttributeValue('version'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php new file mode 100644 index 0000000..9d375f9 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ComponentElementCollection extends ElementCollection { + public function current() { + return new ComponentElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ContainsElement.php b/vendor/phar-io/manifest/src/xml/ContainsElement.php new file mode 100644 index 0000000..8172f33 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ContainsElement.php @@ -0,0 +1,31 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ContainsElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getVersion() { + return $this->getAttributeValue('version'); + } + + public function getType() { + return $this->getAttributeValue('type'); + } + + public function getExtensionElement() { + return new ExtensionElement( + $this->getChildByName('extension') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/CopyrightElement.php b/vendor/phar-io/manifest/src/xml/CopyrightElement.php new file mode 100644 index 0000000..bf7848e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/CopyrightElement.php @@ -0,0 +1,25 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class CopyrightElement extends ManifestElement { + public function getAuthorElements() { + return new AuthorElementCollection( + $this->getChildrenByName('author') + ); + } + + public function getLicenseElement() { + return new LicenseElement( + $this->getChildByName('license') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ElementCollection.php b/vendor/phar-io/manifest/src/xml/ElementCollection.php new file mode 100644 index 0000000..284e77b --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ElementCollection.php @@ -0,0 +1,58 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; + +abstract class ElementCollection implements \Iterator { + /** + * @var DOMNodeList + */ + private $nodeList; + + private $position; + + /** + * ElementCollection constructor. + * + * @param DOMNodeList $nodeList + */ + public function __construct(DOMNodeList $nodeList) { + $this->nodeList = $nodeList; + $this->position = 0; + } + + abstract public function current(); + + /** + * @return DOMElement + */ + protected function getCurrentElement() { + return $this->nodeList->item($this->position); + } + + public function next() { + $this->position++; + } + + public function key() { + return $this->position; + } + + public function valid() { + return $this->position < $this->nodeList->length; + } + + public function rewind() { + $this->position = 0; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElement.php b/vendor/phar-io/manifest/src/xml/ExtElement.php new file mode 100644 index 0000000..7a824ab --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElement.php @@ -0,0 +1,17 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElementCollection.php b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php new file mode 100644 index 0000000..17acc62 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php @@ -0,0 +1,20 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtElementCollection extends ElementCollection { + public function current() { + return new ExtElement( + $this->getCurrentElement() + ); + } + +} diff --git a/vendor/phar-io/manifest/src/xml/ExtensionElement.php b/vendor/phar-io/manifest/src/xml/ExtensionElement.php new file mode 100644 index 0000000..536c085 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtensionElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtensionElement extends ManifestElement { + public function getFor() { + return $this->getAttributeValue('for'); + } + + public function getCompatible() { + return $this->getAttributeValue('compatible'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/LicenseElement.php b/vendor/phar-io/manifest/src/xml/LicenseElement.php new file mode 100644 index 0000000..ee001df --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/LicenseElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class LicenseElement extends ManifestElement { + public function getType() { + return $this->getAttributeValue('type'); + } + + public function getUrl() { + return $this->getAttributeValue('url'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestDocument.php b/vendor/phar-io/manifest/src/xml/ManifestDocument.php new file mode 100644 index 0000000..9b0bd9d --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestDocument.php @@ -0,0 +1,118 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMDocument; +use DOMElement; + +class ManifestDocument { + const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** + * @var DOMDocument + */ + private $dom; + + /** + * ManifestDocument constructor. + * + * @param DOMDocument $dom + */ + private function __construct(DOMDocument $dom) { + $this->ensureCorrectDocumentType($dom); + + $this->dom = $dom; + } + + public static function fromFile($filename) { + if (!file_exists($filename)) { + throw new ManifestDocumentException( + sprintf('File "%s" not found', $filename) + ); + } + + return self::fromString( + file_get_contents($filename) + ); + } + + public static function fromString($xmlString) { + $prev = libxml_use_internal_errors(true); + libxml_clear_errors(); + + $dom = new DOMDocument(); + $dom->loadXML($xmlString); + + $errors = libxml_get_errors(); + libxml_use_internal_errors($prev); + + if (count($errors) !== 0) { + throw new ManifestDocumentLoadingException($errors); + } + + return new self($dom); + } + + public function getContainsElement() { + return new ContainsElement( + $this->fetchElementByName('contains') + ); + } + + public function getCopyrightElement() { + return new CopyrightElement( + $this->fetchElementByName('copyright') + ); + } + + public function getRequiresElement() { + return new RequiresElement( + $this->fetchElementByName('requires') + ); + } + + public function hasBundlesElement() { + return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1; + } + + public function getBundlesElement() { + return new BundlesElement( + $this->fetchElementByName('bundles') + ); + } + + private function ensureCorrectDocumentType(DOMDocument $dom) { + $root = $dom->documentElement; + + if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) { + throw new ManifestDocumentException('Not a phar.io manifest document'); + } + } + + /** + * @param $elementName + * + * @return DOMElement + * + * @throws ManifestDocumentException + */ + private function fetchElementByName($elementName) { + $element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestDocumentException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php b/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php new file mode 100644 index 0000000..59ac5c6 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use LibXMLError; + +class ManifestDocumentLoadingException extends \Exception implements Exception { + /** + * @var LibXMLError[] + */ + private $libxmlErrors; + + /** + * ManifestDocumentLoadingException constructor. + * + * @param LibXMLError[] $libxmlErrors + */ + public function __construct(array $libxmlErrors) { + $this->libxmlErrors = $libxmlErrors; + $first = $this->libxmlErrors[0]; + + parent::__construct( + sprintf( + '%s (Line: %d / Column: %d / File: %s)', + $first->message, + $first->line, + $first->column, + $first->file + ), + $first->code + ); + } + + /** + * @return LibXMLError[] + */ + public function getLibxmlErrors() { + return $this->libxmlErrors; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestElement.php b/vendor/phar-io/manifest/src/xml/ManifestElement.php new file mode 100644 index 0000000..09d07cc --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestElement.php @@ -0,0 +1,100 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; + +class ManifestElement { + const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** + * @var DOMElement + */ + private $element; + + /** + * ContainsElement constructor. + * + * @param DOMElement $element + */ + public function __construct(DOMElement $element) { + $this->element = $element; + } + + /** + * @param string $name + * + * @return string + * + * @throws ManifestElementException + */ + protected function getAttributeValue($name) { + if (!$this->element->hasAttribute($name)) { + throw new ManifestElementException( + sprintf( + 'Attribute %s not set on element %s', + $name, + $this->element->localName + ) + ); + } + + return $this->element->getAttribute($name); + } + + /** + * @param $elementName + * + * @return DOMElement + * + * @throws ManifestElementException + */ + protected function getChildByName($elementName) { + $element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestElementException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } + + /** + * @param $elementName + * + * @return DOMNodeList + * + * @throws ManifestElementException + */ + protected function getChildrenByName($elementName) { + $elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName); + + if ($elementList->length === 0) { + throw new ManifestElementException( + sprintf('Element(s) %s missing', $elementName) + ); + } + + return $elementList; + } + + /** + * @param string $elementName + * + * @return bool + */ + protected function hasChild($elementName) { + return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0; + } +} diff --git a/vendor/phar-io/manifest/src/xml/PhpElement.php b/vendor/phar-io/manifest/src/xml/PhpElement.php new file mode 100644 index 0000000..e7340c0 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/PhpElement.php @@ -0,0 +1,27 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class PhpElement extends ManifestElement { + public function getVersion() { + return $this->getAttributeValue('version'); + } + + public function hasExtElements() { + return $this->hasChild('ext'); + } + + public function getExtElements() { + return new ExtElementCollection( + $this->getChildrenByName('ext') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/RequiresElement.php b/vendor/phar-io/manifest/src/xml/RequiresElement.php new file mode 100644 index 0000000..5f41b2e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/RequiresElement.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequiresElement extends ManifestElement { + public function getPHPElement() { + return new PhpElement( + $this->getChildByName('php') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php b/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php new file mode 100644 index 0000000..e261231 --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php @@ -0,0 +1,110 @@ +assertInstanceOf( + Manifest::class, + $mapper->map($manifestDocument) + ); + } + + public function dataProvider() { + return [ + 'application' => [__DIR__ . '/_fixture/phpunit-5.6.5.xml'], + 'library' => [__DIR__ . '/_fixture/library.xml'], + 'extension' => [__DIR__ . '/_fixture/extension.xml'] + ]; + } + + public function testThrowsExceptionOnUnsupportedType() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/custom.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + public function testInvalidVersionInformationThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversion.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + public function testInvalidVersionConstraintThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversionconstraint.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + /** + * @uses \PharIo\Manifest\ExtensionElement + */ + public function testInvalidCompatibleConstraintThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/extension-invalidcompatible.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + +} diff --git a/vendor/phar-io/manifest/tests/ManifestLoaderTest.php b/vendor/phar-io/manifest/tests/ManifestLoaderTest.php new file mode 100644 index 0000000..73b682e --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestLoaderTest.php @@ -0,0 +1,83 @@ +assertInstanceOf( + Manifest::class, + ManifestLoader::fromFile(__DIR__ . '/_fixture/library.xml') + ); + } + + public function testCanBeLoadedFromString() { + $this->assertInstanceOf( + Manifest::class, + ManifestLoader::fromString( + file_get_contents(__DIR__ . '/_fixture/library.xml') + ) + ); + } + + public function testCanBeLoadedFromPhar() { + $this->assertInstanceOf( + Manifest::class, + ManifestLoader::fromPhar(__DIR__ . '/_fixture/test.phar') + ); + + } + + public function testLoadingNonExistingFileThrowsException() { + $this->expectException(ManifestLoaderException::class); + ManifestLoader::fromFile('/not/existing'); + } + + /** + * @uses \PharIo\Manifest\ManifestDocumentLoadingException + */ + public function testLoadingInvalidXmlThrowsException() { + $this->expectException(ManifestLoaderException::class); + ManifestLoader::fromString(''); + } + +} diff --git a/vendor/phar-io/manifest/tests/ManifestSerializerTest.php b/vendor/phar-io/manifest/tests/ManifestSerializerTest.php new file mode 100644 index 0000000..4433020 --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestSerializerTest.php @@ -0,0 +1,114 @@ +assertXmlStringEqualsXmlString( + $expected, + $serializer->serializeToString($manifest) + ); + } + + public function dataProvider() { + return [ + 'application' => [file_get_contents(__DIR__ . '/_fixture/phpunit-5.6.5.xml')], + 'library' => [file_get_contents(__DIR__ . '/_fixture/library.xml')], + 'extension' => [file_get_contents(__DIR__ . '/_fixture/extension.xml')] + ]; + } + + /** + * @uses \PharIo\Manifest\Library + * @uses \PharIo\Manifest\ApplicationName + */ + public function testCanSerializeToFile() { + $src = __DIR__ . '/_fixture/library.xml'; + $dest = '/tmp/' . uniqid('serializer', true); + $manifest = ManifestLoader::fromFile($src); + $serializer = new ManifestSerializer(); + $serializer->serializeToFile($manifest, $dest); + $this->assertXmlFileEqualsXmlFile($src, $dest); + unlink($dest); + } + + /** + * @uses \PharIo\Manifest\ApplicationName + */ + public function testCanHandleUnknownType() { + $type = $this->getMockForAbstractClass(Type::class); + $manifest = new Manifest( + new ApplicationName('testvendor/testname'), + new Version('1.0.0'), + $type, + new CopyrightInformation( + new AuthorCollection(), + new License('bsd-3', new Url('https://some/uri')) + ), + new RequirementCollection(), + new BundledComponentCollection() + ); + + $serializer = new ManifestSerializer(); + $this->assertXmlStringEqualsXmlFile( + __DIR__ . '/_fixture/custom.xml', + $serializer->serializeToString($manifest) + ); + } +} diff --git a/vendor/phar-io/manifest/tests/_fixture/custom.xml b/vendor/phar-io/manifest/tests/_fixture/custom.xml new file mode 100644 index 0000000..4f43828 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/custom.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml b/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml new file mode 100644 index 0000000..a78111c --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/extension.xml b/vendor/phar-io/manifest/tests/_fixture/extension.xml new file mode 100644 index 0000000..a870aee --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/extension.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml b/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml new file mode 100644 index 0000000..788dd4c --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml b/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml new file mode 100644 index 0000000..f881f8b --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/library.xml b/vendor/phar-io/manifest/tests/_fixture/library.xml new file mode 100644 index 0000000..a5e2523 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/library.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/manifest.xml b/vendor/phar-io/manifest/tests/_fixture/manifest.xml new file mode 100644 index 0000000..a5e2523 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/manifest.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml b/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml new file mode 100644 index 0000000..aadbea2 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/test.phar b/vendor/phar-io/manifest/tests/_fixture/test.phar new file mode 100644 index 0000000..d2a3e39 Binary files /dev/null and b/vendor/phar-io/manifest/tests/_fixture/test.phar differ diff --git a/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php b/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php new file mode 100644 index 0000000..d87e84e --- /dev/null +++ b/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php @@ -0,0 +1,19 @@ +loadXML(''); + $exception = new ManifestDocumentLoadingException(libxml_get_errors()); + libxml_use_internal_errors($prev); + + $this->assertContainsOnlyInstancesOf(LibXMLError::class, $exception->getLibxmlErrors()); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php b/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php new file mode 100644 index 0000000..c959415 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php @@ -0,0 +1,48 @@ +assertInstanceOf( + ApplicationName::class, + new ApplicationName('foo/bar') + ); + } + + public function testUsingInvalidFormatForNameThrowsException() { + $this->expectException(InvalidApplicationNameException::class); + $this->expectExceptionCode(InvalidApplicationNameException::InvalidFormat); + new ApplicationName('foo'); + } + + public function testUsingWrongTypeForNameThrowsException() { + $this->expectException(InvalidApplicationNameException::class); + $this->expectExceptionCode(InvalidApplicationNameException::NotAString); + new ApplicationName(123); + } + + public function testReturnsTrueForEqualNamesWhenCompared() { + $app = new ApplicationName('foo/bar'); + $this->assertTrue( + $app->isEqual($app) + ); + } + + public function testReturnsFalseForNonEqualNamesWhenCompared() { + $app1 = new ApplicationName('foo/bar'); + $app2 = new ApplicationName('foo/foo'); + $this->assertFalse( + $app1->isEqual($app2) + ); + } + + public function testCanBeConvertedToString() { + $this->assertEquals( + 'foo/bar', + new ApplicationName('foo/bar') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ApplicationTest.php b/vendor/phar-io/manifest/tests/values/ApplicationTest.php new file mode 100644 index 0000000..86b5da6 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ApplicationTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Application + * @covers PharIo\Manifest\Type + */ +class ApplicationTest extends TestCase { + /** + * @var Application + */ + private $type; + + protected function setUp() { + $this->type = Type::application(); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Application::class, $this->type); + } + + public function testIsApplication() { + $this->assertTrue($this->type->isApplication()); + } + + public function testIsNotLibrary() { + $this->assertFalse($this->type->isLibrary()); + } + + public function testIsNotExtension() { + $this->assertFalse($this->type->isExtension()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php b/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php new file mode 100644 index 0000000..0fa1b95 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php @@ -0,0 +1,62 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\AuthorCollection + * @covers \PharIo\Manifest\AuthorCollectionIterator + * + * @uses \PharIo\Manifest\Author + * @uses \PharIo\Manifest\Email + */ +class AuthorCollectionTest extends TestCase { + /** + * @var AuthorCollection + */ + private $collection; + + /** + * @var Author + */ + private $item; + + protected function setUp() { + $this->collection = new AuthorCollection; + $this->item = new Author('Joe Developer', new Email('user@example.com')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(AuthorCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add( + new Author('Dummy First', new Email('dummy@example.com')) + ); + $this->collection->add($this->item); + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } +} diff --git a/vendor/phar-io/manifest/tests/values/AuthorTest.php b/vendor/phar-io/manifest/tests/values/AuthorTest.php new file mode 100644 index 0000000..b7317fa --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/AuthorTest.php @@ -0,0 +1,45 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Author + * + * @uses PharIo\Manifest\Email + */ +class AuthorTest extends TestCase { + /** + * @var Author + */ + private $author; + + protected function setUp() { + $this->author = new Author('Joe Developer', new Email('user@example.com')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Author::class, $this->author); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('Joe Developer', $this->author->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('user@example.com', $this->author->getEmail()); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('Joe Developer ', $this->author); + } +} diff --git a/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php b/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php new file mode 100644 index 0000000..66cd0c4 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php @@ -0,0 +1,63 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\BundledComponentCollection + * @covers \PharIo\Manifest\BundledComponentCollectionIterator + * + * @uses \PharIo\Manifest\BundledComponent + * @uses \PharIo\Version\Version + */ +class BundledComponentCollectionTest extends TestCase { + /** + * @var BundledComponentCollection + */ + private $collection; + + /** + * @var BundledComponent + */ + private $item; + + protected function setUp() { + $this->collection = new BundledComponentCollection; + $this->item = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(BundledComponentCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add($this->createMock(BundledComponent::class)); + $this->collection->add($this->item); + + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/values/BundledComponentTest.php b/vendor/phar-io/manifest/tests/values/BundledComponentTest.php new file mode 100644 index 0000000..01b8e13 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/BundledComponentTest.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\BundledComponent + * + * @uses \PharIo\Version\Version + */ +class BundledComponentTest extends TestCase { + /** + * @var BundledComponent + */ + private $bundledComponent; + + protected function setUp() { + $this->bundledComponent = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(BundledComponent::class, $this->bundledComponent); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phpunit/php-code-coverage', $this->bundledComponent->getName()); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals('4.0.2', $this->bundledComponent->getVersion()->getVersionString()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php b/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php new file mode 100644 index 0000000..de738f4 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php @@ -0,0 +1,62 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\CopyrightInformation + * + * @uses PharIo\Manifest\AuthorCollection + * @uses PharIo\Manifest\AuthorCollectionIterator + * @uses PharIo\Manifest\Author + * @uses PharIo\Manifest\Email + * @uses PharIo\Manifest\License + * @uses PharIo\Manifest\Url + */ +class CopyrightInformationTest extends TestCase { + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var Author + */ + private $author; + + /** + * @var License + */ + private $license; + + protected function setUp() { + $this->author = new Author('Joe Developer', new Email('user@example.com')); + $this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + + $authors = new AuthorCollection; + $authors->add($this->author); + + $this->copyrightInformation = new CopyrightInformation($authors, $this->license); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(CopyrightInformation::class, $this->copyrightInformation); + } + + public function testAuthorsCanBeRetrieved() { + $this->assertContains($this->author, $this->copyrightInformation->getAuthors()); + } + + public function testLicenseCanBeRetrieved() { + $this->assertEquals($this->license, $this->copyrightInformation->getLicense()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/EmailTest.php b/vendor/phar-io/manifest/tests/values/EmailTest.php new file mode 100644 index 0000000..ee38531 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/EmailTest.php @@ -0,0 +1,35 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Email + */ +class EmailTest extends TestCase { + public function testCanBeCreatedForValidEmail() { + $this->assertInstanceOf(Email::class, new Email('user@example.com')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('user@example.com', new Email('user@example.com')); + } + + /** + * @covers PharIo\Manifest\InvalidEmailException + */ + public function testCannotBeCreatedForInvalidEmail() { + $this->expectException(InvalidEmailException::class); + + new Email('invalid'); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ExtensionTest.php b/vendor/phar-io/manifest/tests/values/ExtensionTest.php new file mode 100644 index 0000000..1c9d676 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ExtensionTest.php @@ -0,0 +1,109 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\AnyVersionConstraint; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; +use PharIo\Version\VersionConstraintParser; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\Extension + * @covers \PharIo\Manifest\Type + * + * @uses \PharIo\Version\VersionConstraint + * @uses \PharIo\Manifest\ApplicationName + */ +class ExtensionTest extends TestCase { + /** + * @var Extension + */ + private $type; + + /** + * @var ApplicationName|\PHPUnit_Framework_MockObject_MockObject + */ + private $name; + + protected function setUp() { + $this->name = $this->createMock(ApplicationName::class); + $this->type = Type::extension($this->name, new AnyVersionConstraint); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Extension::class, $this->type); + } + + public function testIsNotApplication() { + $this->assertFalse($this->type->isApplication()); + } + + public function testIsNotLibrary() { + $this->assertFalse($this->type->isLibrary()); + } + + public function testIsExtension() { + $this->assertTrue($this->type->isExtension()); + } + + public function testApplicationCanBeRetrieved() + { + $this->assertInstanceOf(ApplicationName::class, $this->type->getApplicationName()); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertInstanceOf( + VersionConstraint::class, + $this->type->getVersionConstraint() + ); + } + + public function testApplicationCanBeQueried() + { + $this->name->method('isEqual')->willReturn(true); + $this->assertTrue( + $this->type->isExtensionFor($this->createMock(ApplicationName::class)) + ); + } + + public function testCompatibleWithReturnsTrueForMatchingVersionConstraintAndApplicaiton() { + $app = new ApplicationName('foo/bar'); + $extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('1.0.0'); + + $this->assertTrue( + $extension->isCompatibleWith($app, $version) + ); + } + + public function testCompatibleWithReturnsFalseForNotMatchingVersionConstraint() { + $app = new ApplicationName('foo/bar'); + $extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('2.0.0'); + + $this->assertFalse( + $extension->isCompatibleWith($app, $version) + ); + } + + public function testCompatibleWithReturnsFalseForNotMatchingApplication() { + $app1 = new ApplicationName('foo/bar'); + $app2 = new ApplicationName('foo/foo'); + $extension = Type::extension($app1, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('1.0.0'); + + $this->assertFalse( + $extension->isCompatibleWith($app2, $version) + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/LibraryTest.php b/vendor/phar-io/manifest/tests/values/LibraryTest.php new file mode 100644 index 0000000..f8d1c64 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/LibraryTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Library + * @covers PharIo\Manifest\Type + */ +class LibraryTest extends TestCase { + /** + * @var Library + */ + private $type; + + protected function setUp() { + $this->type = Type::library(); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Library::class, $this->type); + } + + public function testIsNotApplication() { + $this->assertFalse($this->type->isApplication()); + } + + public function testIsLibrary() { + $this->assertTrue($this->type->isLibrary()); + } + + public function testIsNotExtension() { + $this->assertFalse($this->type->isExtension()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/LicenseTest.php b/vendor/phar-io/manifest/tests/values/LicenseTest.php new file mode 100644 index 0000000..c9c5c3c --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/LicenseTest.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\License + * + * @uses PharIo\Manifest\Url + */ +class LicenseTest extends TestCase { + /** + * @var License + */ + private $license; + + protected function setUp() { + $this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(License::class, $this->license); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('BSD-3-Clause', $this->license->getName()); + } + + public function testUrlCanBeRetrieved() { + $this->assertEquals('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE', $this->license->getUrl()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ManifestTest.php b/vendor/phar-io/manifest/tests/values/ManifestTest.php new file mode 100644 index 0000000..cff0a68 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ManifestTest.php @@ -0,0 +1,187 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\AnyVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\Manifest + * + * @uses \PharIo\Manifest\ApplicationName + * @uses \PharIo\Manifest\Author + * @uses \PharIo\Manifest\AuthorCollection + * @uses \PharIo\Manifest\BundledComponent + * @uses \PharIo\Manifest\BundledComponentCollection + * @uses \PharIo\Manifest\CopyrightInformation + * @uses \PharIo\Manifest\Email + * @uses \PharIo\Manifest\License + * @uses \PharIo\Manifest\RequirementCollection + * @uses \PharIo\Manifest\PhpVersionRequirement + * @uses \PharIo\Manifest\Type + * @uses \PharIo\Manifest\Application + * @uses \PharIo\Manifest\Url + * @uses \PharIo\Version\Version + * @uses \PharIo\Version\VersionConstraint + */ +class ManifestTest extends TestCase { + /** + * @var ApplicationName + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @var Type + */ + private $type; + + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var RequirementCollection + */ + private $requirements; + + /** + * @var BundledComponentCollection + */ + private $bundledComponents; + + /** + * @var Manifest + */ + private $manifest; + + protected function setUp() { + $this->version = new Version('5.6.5'); + + $this->type = Type::application(); + + $author = new Author('Joe Developer', new Email('user@example.com')); + $license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + + $authors = new AuthorCollection; + $authors->add($author); + + $this->copyrightInformation = new CopyrightInformation($authors, $license); + + $this->requirements = new RequirementCollection; + $this->requirements->add(new PhpVersionRequirement(new AnyVersionConstraint)); + + $this->bundledComponents = new BundledComponentCollection; + $this->bundledComponents->add(new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2'))); + + $this->name = new ApplicationName('phpunit/phpunit'); + + $this->manifest = new Manifest( + $this->name, + $this->version, + $this->type, + $this->copyrightInformation, + $this->requirements, + $this->bundledComponents + ); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Manifest::class, $this->manifest); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals($this->name, $this->manifest->getName()); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals($this->version, $this->manifest->getVersion()); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals($this->type, $this->manifest->getType()); + } + + public function testTypeCanBeQueried() { + $this->assertTrue($this->manifest->isApplication()); + $this->assertFalse($this->manifest->isLibrary()); + $this->assertFalse($this->manifest->isExtension()); + } + + public function testCopyrightInformationCanBeRetrieved() { + $this->assertEquals($this->copyrightInformation, $this->manifest->getCopyrightInformation()); + } + + public function testRequirementsCanBeRetrieved() { + $this->assertEquals($this->requirements, $this->manifest->getRequirements()); + } + + public function testBundledComponentsCanBeRetrieved() { + $this->assertEquals($this->bundledComponents, $this->manifest->getBundledComponents()); + } + + /** + * @uses \PharIo\Manifest\Extension + */ + public function testExtendedApplicationCanBeQueriedForExtension() + { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::extension($appName, new AnyVersionConstraint), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertTrue($manifest->isExtensionFor($appName)); + } + + public function testNonExtensionReturnsFalseWhenQueriesForExtension() { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::library(), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertFalse($manifest->isExtensionFor($appName)); + } + + /** + * @uses \PharIo\Manifest\Extension + */ + public function testExtendedApplicationCanBeQueriedForExtensionWithVersion() + { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::extension($appName, new AnyVersionConstraint), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertTrue($manifest->isExtensionFor($appName, new Version('1.2.3'))); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php b/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php new file mode 100644 index 0000000..ae1c058 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php @@ -0,0 +1,26 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\PhpExtensionRequirement + */ +class PhpExtensionRequirementTest extends TestCase { + public function testCanBeCreated() { + $this->assertInstanceOf(PhpExtensionRequirement::class, new PhpExtensionRequirement('dom')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('dom', new PhpExtensionRequirement('dom')); + } +} diff --git a/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php b/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php new file mode 100644 index 0000000..67ac41a --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php @@ -0,0 +1,38 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\ExactVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\PhpVersionRequirement + * + * @uses \PharIo\Version\VersionConstraint + */ +class PhpVersionRequirementTest extends TestCase { + /** + * @var PhpVersionRequirement + */ + private $requirement; + + protected function setUp() { + $this->requirement = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(PhpVersionRequirement::class, $this->requirement); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertEquals('7.1.0', $this->requirement->getVersionConstraint()->asString()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php b/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php new file mode 100644 index 0000000..2afeb1a --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php @@ -0,0 +1,63 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\ExactVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\RequirementCollection + * @covers \PharIo\Manifest\RequirementCollectionIterator + * + * @uses \PharIo\Manifest\PhpVersionRequirement + * @uses \PharIo\Version\VersionConstraint + */ +class RequirementCollectionTest extends TestCase { + /** + * @var RequirementCollection + */ + private $collection; + + /** + * @var Requirement + */ + private $item; + + protected function setUp() { + $this->collection = new RequirementCollection; + $this->item = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(RequirementCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add(new PhpVersionRequirement(new ExactVersionConstraint('5.6.0'))); + $this->collection->add($this->item); + + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/values/UrlTest.php b/vendor/phar-io/manifest/tests/values/UrlTest.php new file mode 100644 index 0000000..20f09c1 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/UrlTest.php @@ -0,0 +1,35 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Url + */ +class UrlTest extends TestCase { + public function testCanBeCreatedForValidUrl() { + $this->assertInstanceOf(Url::class, new Url('https://phar.io/')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('https://phar.io/', new Url('https://phar.io/')); + } + + /** + * @covers PharIo\Manifest\InvalidUrlException + */ + public function testCannotBeCreatedForInvalidUrl() { + $this->expectException(InvalidUrlException::class); + + new Url('invalid'); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php new file mode 100644 index 0000000..327a7e3 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php @@ -0,0 +1,18 @@ +loadXML(''); + $collection = new AuthorElementCollection($dom->childNodes); + + foreach($collection as $authorElement) { + $this->assertInstanceOf(AuthorElement::class, $authorElement); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php b/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php new file mode 100644 index 0000000..430c0ca --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->author = new AuthorElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('Reiner Zufall', $this->author->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('reiner@zufall.de', $this->author->getEmail()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php b/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php new file mode 100644 index 0000000..7972617 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php @@ -0,0 +1,41 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->bundles = new BundlesElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetComponentElementsIsCalledButNodesAreMissing() { + $this->expectException(ManifestElementException::class); + $this->bundles->getComponentElements(); + } + + public function testGetComponentElementsReturnsComponentElementCollection() { + $this->addComponent(); + $this->assertInstanceOf( + ComponentElementCollection::class, $this->bundles->getComponentElements() + ); + } + + private function addComponent() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'component') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php new file mode 100644 index 0000000..3a2716f --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php @@ -0,0 +1,18 @@ +loadXML(''); + $collection = new ComponentElementCollection($dom->childNodes); + + foreach($collection as $componentElement) { + $this->assertInstanceOf(ComponentElement::class, $componentElement); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php b/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php new file mode 100644 index 0000000..ab89fbd --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->component = new ComponentElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phar-io/phive', $this->component->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('0.6.0', $this->component->getVersion()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php b/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php new file mode 100644 index 0000000..f77313d --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php @@ -0,0 +1,63 @@ +loadXML(''); + $this->domElement = $dom->documentElement; + $this->contains = new ContainsElement($this->domElement); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals('5.6.5', $this->contains->getVersion()); + } + + public function testThrowsExceptionWhenVersionAttributeIsMissing() { + $this->domElement->removeAttribute('version'); + $this->expectException(ManifestElementException::class); + $this->contains->getVersion(); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phpunit/phpunit', $this->contains->getName()); + } + + public function testThrowsExceptionWhenNameAttributeIsMissing() { + $this->domElement->removeAttribute('name'); + $this->expectException(ManifestElementException::class); + $this->contains->getName(); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals('application', $this->contains->getType()); + } + + public function testThrowsExceptionWhenTypeAttributeIsMissing() { + $this->domElement->removeAttribute('type'); + $this->expectException(ManifestElementException::class); + $this->contains->getType(); + } + + public function testGetExtensionElementReturnsExtensionElement() { + $this->domElement->appendChild( + $this->domElement->ownerDocument->createElementNS('https://phar.io/xml/manifest/1.0', 'extension') + ); + $this->assertInstanceOf(ExtensionElement::class, $this->contains->getExtensionElement()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php b/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php new file mode 100644 index 0000000..9ad8eb3 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php @@ -0,0 +1,52 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->copyright = new CopyrightElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetAuthroElementsIsCalledButNodesAreMissing() { + $this->expectException(ManifestElementException::class); + $this->copyright->getAuthorElements(); + } + + public function testThrowsExceptionWhenGetLicenseElementIsCalledButNodeIsMissing() { + $this->expectException(ManifestElementException::class); + $this->copyright->getLicenseElement(); + } + + public function testGetAuthorElementsReturnsAuthorElementCollection() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'author') + ); + $this->assertInstanceOf( + AuthorElementCollection::class, $this->copyright->getAuthorElements() + ); + } + + public function testGetLicenseElementReturnsLicenseElement() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'license') + ); + $this->assertInstanceOf( + LicenseElement::class, $this->copyright->getLicenseElement() + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php new file mode 100644 index 0000000..463e4d6 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php @@ -0,0 +1,19 @@ +loadXML(''); + $collection = new ExtElementCollection($dom->childNodes); + + foreach($collection as $position => $extElement) { + $this->assertInstanceOf(ExtElement::class, $extElement); + $this->assertEquals(0, $position); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtElementTest.php b/vendor/phar-io/manifest/tests/xml/ExtElementTest.php new file mode 100644 index 0000000..097b522 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtElementTest.php @@ -0,0 +1,21 @@ +loadXML(''); + $this->ext = new ExtElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('dom', $this->ext->getName()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php b/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php new file mode 100644 index 0000000..2ae0112 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->extension = new ExtensionElement($dom->documentElement); + } + + public function testNForCanBeRetrieved() { + $this->assertEquals('phar-io/phive', $this->extension->getFor()); + } + + public function testCompatibleVersionConstraintCanBeRetrieved() { + $this->assertEquals('~0.6', $this->extension->getCompatible()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php b/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php new file mode 100644 index 0000000..00d4a6c --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->license = new LicenseElement($dom->documentElement); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals('BSD-3', $this->license->getType()); + } + + public function testUrlCanBeRetrieved() { + $this->assertEquals('https://some.tld/LICENSE', $this->license->getUrl()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php b/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php new file mode 100644 index 0000000..b5bb8cd --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php @@ -0,0 +1,110 @@ +expectException(ManifestDocumentException::class); + ManifestDocument::fromFile('/does/not/exist'); + } + + public function testCanBeCreatedFromFile() { + $this->assertInstanceOf( + ManifestDocument::class, + ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml') + ); + } + + public function testCaneBeConstructedFromString() { + $content = file_get_contents(__DIR__ . '/../_fixture/phpunit-5.6.5.xml'); + $this->assertInstanceOf( + ManifestDocument::class, + ManifestDocument::fromString($content) + ); + } + + public function testThrowsExceptionOnInvalidXML() { + $this->expectException(ManifestDocumentLoadingException::class); + ManifestDocument::fromString(''); + } + + public function testLoadingDocumentWithWrongRootNameThrowsException() { + $this->expectException(ManifestDocumentException::class); + ManifestDocument::fromString(''); + } + + public function testLoadingDocumentWithWrongNamespaceThrowsException() { + $this->expectException(ManifestDocumentException::class); + ManifestDocument::fromString(''); + } + + public function testContainsElementCanBeRetrieved() { + $this->assertInstanceOf( + ContainsElement::class, + $this->loadFixture()->getContainsElement() + ); + } + + public function testRequiresElementCanBeRetrieved() { + $this->assertInstanceOf( + RequiresElement::class, + $this->loadFixture()->getRequiresElement() + ); + } + + public function testCopyrightElementCanBeRetrieved() { + $this->assertInstanceOf( + CopyrightElement::class, + $this->loadFixture()->getCopyrightElement() + ); + } + + public function testBundlesElementCanBeRetrieved() { + $this->assertInstanceOf( + BundlesElement::class, + $this->loadFixture()->getBundlesElement() + ); + } + + public function testThrowsExceptionWhenContainsIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getContainsElement(); + } + + public function testThrowsExceptionWhenCopyirhgtIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getCopyrightElement(); + } + + public function testThrowsExceptionWhenRequiresIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getRequiresElement(); + } + + public function testThrowsExceptionWhenBundlesIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getBundlesElement(); + } + + public function testHasBundlesReturnsTrueWhenBundlesNodeIsPresent() { + $this->assertTrue( + $this->loadFixture()->hasBundlesElement() + ); + } + + public function testHasBundlesReturnsFalseWhenBundlesNoNodeIsPresent() { + $this->assertFalse( + $this->loadEmptyFixture()->hasBundlesElement() + ); + } + + private function loadFixture() { + return ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml'); + } + + private function loadEmptyFixture() { + return ManifestDocument::fromString( + '' + ); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/PhpElementTest.php b/vendor/phar-io/manifest/tests/xml/PhpElementTest.php new file mode 100644 index 0000000..546187a --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/PhpElementTest.php @@ -0,0 +1,48 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->php = new PhpElement($this->dom->documentElement); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertEquals('^5.6 || ^7.0', $this->php->getVersion()); + } + + public function testHasExtElementsReturnsFalseWhenNoExtensionsAreRequired() { + $this->assertFalse($this->php->hasExtElements()); + } + + public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() { + $this->addExtElement(); + $this->assertTrue($this->php->hasExtElements()); + } + + public function testGetExtElementsReturnsExtElementCollection() { + $this->addExtElement(); + $this->assertInstanceOf(ExtElementCollection::class, $this->php->getExtElements()); + } + + private function addExtElement() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'ext') + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php b/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php new file mode 100644 index 0000000..907b0a6 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php @@ -0,0 +1,37 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->requires = new RequiresElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetPhpElementIsCalledButElementIsMissing() { + $this->expectException(ManifestElementException::class); + $this->requires->getPHPElement(); + } + + public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'php') + ); + + $this->assertInstanceOf(PhpElement::class, $this->requires->getPHPElement()); + } + +} diff --git a/vendor/phar-io/version/.gitignore b/vendor/phar-io/version/.gitignore new file mode 100644 index 0000000..1c8f2e6 --- /dev/null +++ b/vendor/phar-io/version/.gitignore @@ -0,0 +1,7 @@ +/.idea +/.php_cs.cache +/composer.lock +/src/autoload.php +/tools +/vendor + diff --git a/vendor/phar-io/version/.php_cs b/vendor/phar-io/version/.php_cs new file mode 100644 index 0000000..159d6a3 --- /dev/null +++ b/vendor/phar-io/version/.php_cs @@ -0,0 +1,67 @@ +files() + ->in('src') + ->in('tests') + ->name('*.php'); + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(\Symfony\CS\FixerInterface::NONE_LEVEL) + ->fixers( + array( + 'align_double_arrow', + 'align_equals', + 'concat_with_spaces', + 'duplicate_semicolon', + 'elseif', + 'empty_return', + 'encoding', + 'eof_ending', + 'extra_empty_lines', + 'function_call_space', + 'function_declaration', + 'indentation', + 'join_function', + 'line_after_namespace', + 'linefeed', + 'list_commas', + 'lowercase_constants', + 'lowercase_keywords', + 'method_argument_space', + 'multiple_use', + 'namespace_no_leading_whitespace', + 'no_blank_lines_after_class_opening', + 'no_empty_lines_after_phpdocs', + 'parenthesis', + 'php_closing_tag', + 'phpdoc_indent', + 'phpdoc_no_access', + 'phpdoc_no_empty_return', + 'phpdoc_no_package', + 'phpdoc_params', + 'phpdoc_scalar', + 'phpdoc_separation', + 'phpdoc_to_comment', + 'phpdoc_trim', + 'phpdoc_types', + 'phpdoc_var_without_name', + 'remove_lines_between_uses', + 'return', + 'self_accessor', + 'short_array_syntax', + 'short_tag', + 'single_line_after_imports', + 'single_quote', + 'spaces_before_semicolon', + 'spaces_cast', + 'ternary_spaces', + 'trailing_spaces', + 'trim_array_spaces', + 'unused_use', + 'visibility', + 'whitespacy_lines' + ) + ) + ->finder($finder); + diff --git a/vendor/phar-io/version/.travis.yml b/vendor/phar-io/version/.travis.yml new file mode 100644 index 0000000..b4be10f --- /dev/null +++ b/vendor/phar-io/version/.travis.yml @@ -0,0 +1,33 @@ +os: +- linux + +language: php + +before_install: + - wget https://phar.io/releases/phive.phar + - wget https://phar.io/releases/phive.phar.asc + - gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9B2D5D79 + - gpg --verify phive.phar.asc phive.phar + - chmod +x phive.phar + - sudo mv phive.phar /usr/bin/phive + +install: + - ant setup + +script: ./tools/phpunit + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.0snapshot + - 7.1snapshot + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +notifications: + email: false diff --git a/vendor/phar-io/version/LICENSE b/vendor/phar-io/version/LICENSE new file mode 100644 index 0000000..359dbc5 --- /dev/null +++ b/vendor/phar-io/version/LICENSE @@ -0,0 +1,31 @@ +phar-io/version + +Copyright (c) 2016-2017 Arne Blankerts , Sebastian Heuer and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Arne Blankerts nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/version/README.md b/vendor/phar-io/version/README.md new file mode 100644 index 0000000..df448f8 --- /dev/null +++ b/vendor/phar-io/version/README.md @@ -0,0 +1,16 @@ +# Version + +Library for handling version information and constraints + +[![Build Status](https://travis-ci.org/phar-io/version.svg?branch=master)](https://travis-ci.org/phar-io/version) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/version + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/version + diff --git a/vendor/phar-io/version/build.xml b/vendor/phar-io/version/build.xml new file mode 100644 index 0000000..943c957 --- /dev/null +++ b/vendor/phar-io/version/build.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/version/composer.json b/vendor/phar-io/version/composer.json new file mode 100644 index 0000000..891e8b1 --- /dev/null +++ b/vendor/phar-io/version/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phar-io/version", + "description": "Library for handling version information and constraints", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/version/issues" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} + diff --git a/vendor/phar-io/version/phive.xml b/vendor/phar-io/version/phive.xml new file mode 100644 index 0000000..0c3bc6f --- /dev/null +++ b/vendor/phar-io/version/phive.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/vendor/phar-io/version/phpunit.xml b/vendor/phar-io/version/phpunit.xml new file mode 100644 index 0000000..c21ffbc --- /dev/null +++ b/vendor/phar-io/version/phpunit.xml @@ -0,0 +1,19 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phar-io/version/src/AbstractVersionConstraint.php b/vendor/phar-io/version/src/AbstractVersionConstraint.php new file mode 100644 index 0000000..b732dbc --- /dev/null +++ b/vendor/phar-io/version/src/AbstractVersionConstraint.php @@ -0,0 +1,32 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +abstract class AbstractVersionConstraint implements VersionConstraint { + /** + * @var string + */ + private $originalValue = ''; + + /** + * @param string $originalValue + */ + public function __construct($originalValue) { + $this->originalValue = $originalValue; + } + + /** + * @return string + */ + public function asString() { + return $this->originalValue; + } +} diff --git a/vendor/phar-io/version/src/AndVersionConstraintGroup.php b/vendor/phar-io/version/src/AndVersionConstraintGroup.php new file mode 100644 index 0000000..455dcd1 --- /dev/null +++ b/vendor/phar-io/version/src/AndVersionConstraintGroup.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class AndVersionConstraintGroup extends AbstractVersionConstraint { + /** + * @var VersionConstraint[] + */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + foreach ($this->constraints as $constraint) { + if (!$constraint->complies($version)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/phar-io/version/src/AnyVersionConstraint.php b/vendor/phar-io/version/src/AnyVersionConstraint.php new file mode 100644 index 0000000..13ca2ef --- /dev/null +++ b/vendor/phar-io/version/src/AnyVersionConstraint.php @@ -0,0 +1,29 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class AnyVersionConstraint implements VersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return true; + } + + /** + * @return string + */ + public function asString() { + return '*'; + } +} diff --git a/vendor/phar-io/version/src/ExactVersionConstraint.php b/vendor/phar-io/version/src/ExactVersionConstraint.php new file mode 100644 index 0000000..b214117 --- /dev/null +++ b/vendor/phar-io/version/src/ExactVersionConstraint.php @@ -0,0 +1,22 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class ExactVersionConstraint extends AbstractVersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $this->asString() == $version->getVersionString(); + } +} diff --git a/vendor/phar-io/version/src/Exception.php b/vendor/phar-io/version/src/Exception.php new file mode 100644 index 0000000..b99e4dd --- /dev/null +++ b/vendor/phar-io/version/src/Exception.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +interface Exception { +} diff --git a/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php b/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php new file mode 100644 index 0000000..a237d79 --- /dev/null +++ b/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php @@ -0,0 +1,38 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint { + /** + * @var Version + */ + private $minimalVersion; + + /** + * @param string $originalValue + * @param Version $minimalVersion + */ + public function __construct($originalValue, Version $minimalVersion) { + parent::__construct($originalValue); + + $this->minimalVersion = $minimalVersion; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $version->getVersionString() == $this->minimalVersion->getVersionString() || + $version->isGreaterThan($this->minimalVersion); + } +} diff --git a/vendor/phar-io/version/src/InvalidVersionException.php b/vendor/phar-io/version/src/InvalidVersionException.php new file mode 100644 index 0000000..e52f5d7 --- /dev/null +++ b/vendor/phar-io/version/src/InvalidVersionException.php @@ -0,0 +1,5 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class OrVersionConstraintGroup extends AbstractVersionConstraint { + /** + * @var VersionConstraint[] + */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + foreach ($this->constraints as $constraint) { + if ($constraint->complies($version)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/phar-io/version/src/PreReleaseSuffix.php b/vendor/phar-io/version/src/PreReleaseSuffix.php new file mode 100644 index 0000000..d9e7ee7 --- /dev/null +++ b/vendor/phar-io/version/src/PreReleaseSuffix.php @@ -0,0 +1,41 @@ +value = $value; + $this->number = $number; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @return int|null + */ + public function getNumber() + { + return $this->number; + } +} diff --git a/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php b/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php new file mode 100644 index 0000000..dbeaa06 --- /dev/null +++ b/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint { + /** + * @var int + */ + private $major = 0; + + /** + * @var int + */ + private $minor = 0; + + /** + * @param string $originalValue + * @param int $major + * @param int $minor + */ + public function __construct($originalValue, $major, $minor) { + parent::__construct($originalValue); + + $this->major = $major; + $this->minor = $minor; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + if ($version->getMajor()->getValue() != $this->major) { + return false; + } + + return $version->getMinor()->getValue() == $this->minor; + } +} diff --git a/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php b/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php new file mode 100644 index 0000000..51b12d9 --- /dev/null +++ b/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php @@ -0,0 +1,37 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class SpecificMajorVersionConstraint extends AbstractVersionConstraint { + /** + * @var int + */ + private $major = 0; + + /** + * @param string $originalValue + * @param int $major + */ + public function __construct($originalValue, $major) { + parent::__construct($originalValue); + + $this->major = $major; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $version->getMajor()->getValue() == $this->major; + } +} diff --git a/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php b/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php new file mode 100644 index 0000000..45488c2 --- /dev/null +++ b/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +final class UnsupportedVersionConstraintException extends \RuntimeException implements Exception { +} diff --git a/vendor/phar-io/version/src/Version.php b/vendor/phar-io/version/src/Version.php new file mode 100644 index 0000000..825ed44 --- /dev/null +++ b/vendor/phar-io/version/src/Version.php @@ -0,0 +1,162 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class Version { + /** + * @var VersionNumber + */ + private $major; + + /** + * @var VersionNumber + */ + private $minor; + + /** + * @var VersionNumber + */ + private $patch; + + /** + * @var PreReleaseSuffix + */ + private $preReleaseSuffix; + + /** + * @var string + */ + private $versionString = ''; + + /** + * @param string $versionString + */ + public function __construct($versionString) { + $this->ensureVersionStringIsValid($versionString); + + $this->versionString = $versionString; + } + + /** + * @param array $matches + */ + private function parseVersion(array $matches) { + $this->major = new VersionNumber($matches['Major']); + $this->minor = new VersionNumber($matches['Minor']); + $this->patch = isset($matches['Patch']) ? new VersionNumber($matches['Patch']) : new VersionNumber(null); + + if (isset($matches['ReleaseType'])) { + $preReleaseNumber = isset($matches['ReleaseTypeCount']) ? (int) $matches['ReleaseTypeCount'] : null; + + $this->preReleaseSuffix = new PreReleaseSuffix($matches['ReleaseType'], $preReleaseNumber); + } + } + + /** + * @return PreReleaseSuffix + */ + public function getPreReleaseSuffix() + { + return $this->preReleaseSuffix; + } + + /** + * @return string + */ + public function getVersionString() { + return $this->versionString; + } + + /** + * @param Version $version + * + * @return bool + */ + public function isGreaterThan(Version $version) { + if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) { + return false; + } + + if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) { + return true; + } + + if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) { + return false; + } + + if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) { + return true; + } + + if ($version->getPatch()->getValue() >= $this->getPatch()->getValue()) { + return false; + } + + if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) { + return true; + } + + return false; + } + + /** + * @return VersionNumber + */ + public function getMajor() { + return $this->major; + } + + /** + * @return VersionNumber + */ + public function getMinor() { + return $this->minor; + } + + /** + * @return VersionNumber + */ + public function getPatch() { + return $this->patch; + } + + /** + * @param string $version + * + * @throws InvalidVersionException + */ + private function ensureVersionStringIsValid($version) { + $regex = '/^v? + (?(0|(?:[1-9][0-9]*))) + \\. + (?(0|(?:[1-9][0-9]*))) + (\\. + (?(0|(?:[1-9][0-9]*))) + )? + (?: + - + (?(?:(dev|beta|b|RC|alpha|a|patch|p))) + (?: + (?[0-9]) + )? + )? + $/x'; + + if (preg_match($regex, $version, $matches) !== 1) { + throw new InvalidVersionException( + sprintf("Version string '%s' does not follow SemVer semantics", $version) + ); + } + + $this->parseVersion($matches); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraint.php b/vendor/phar-io/version/src/VersionConstraint.php new file mode 100644 index 0000000..9558163 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraint.php @@ -0,0 +1,26 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +interface VersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version); + + /** + * @return string + */ + public function asString(); + +} diff --git a/vendor/phar-io/version/src/VersionConstraintParser.php b/vendor/phar-io/version/src/VersionConstraintParser.php new file mode 100644 index 0000000..0a24f87 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintParser.php @@ -0,0 +1,122 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class VersionConstraintParser { + /** + * @param string $value + * + * @return VersionConstraint + * + * @throws UnsupportedVersionConstraintException + */ + public function parse($value) { + + if (strpos($value, '||') !== false) { + return $this->handleOrGroup($value); + } + + if (!preg_match('/^[\^~\*]?[\d.\*]+$/', $value)) { + throw new UnsupportedVersionConstraintException( + sprintf('Version constraint %s is not supported.', $value) + ); + } + + switch ($value[0]) { + case '~': + return $this->handleTildeOperator($value); + case '^': + return $this->handleCaretOperator($value); + } + + $version = new VersionConstraintValue($value); + + if ($version->getMajor()->isAny()) { + return new AnyVersionConstraint(); + } + + if ($version->getMinor()->isAny()) { + return new SpecificMajorVersionConstraint( + $value, + $version->getMajor()->getValue() + ); + } + + if ($version->getPatch()->isAny()) { + return new SpecificMajorAndMinorVersionConstraint( + $value, + $version->getMajor()->getValue(), + $version->getMinor()->getValue() + ); + } + + return new ExactVersionConstraint($value); + } + + /** + * @param $value + * + * @return OrVersionConstraintGroup + */ + private function handleOrGroup($value) { + $constraints = []; + + foreach (explode('||', $value) as $groupSegment) { + $constraints[] = $this->parse(trim($groupSegment)); + } + + return new OrVersionConstraintGroup($value, $constraints); + } + + /** + * @param string $value + * + * @return AndVersionConstraintGroup + */ + private function handleTildeOperator($value) { + $version = new Version(substr($value, 1)); + $constraints = [ + new GreaterThanOrEqualToVersionConstraint($value, $version) + ]; + + if ($version->getPatch()->isAny()) { + $constraints[] = new SpecificMajorVersionConstraint( + $value, + $version->getMajor()->getValue() + ); + } else { + $constraints[] = new SpecificMajorAndMinorVersionConstraint( + $value, + $version->getMajor()->getValue(), + $version->getMinor()->getValue() + ); + } + + return new AndVersionConstraintGroup($value, $constraints); + } + + /** + * @param string $value + * + * @return AndVersionConstraintGroup + */ + private function handleCaretOperator($value) { + $version = new Version(substr($value, 1)); + + return new AndVersionConstraintGroup( + $value, + [ + new GreaterThanOrEqualToVersionConstraint($value, $version), + new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue()) + ] + ); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraintValue.php b/vendor/phar-io/version/src/VersionConstraintValue.php new file mode 100644 index 0000000..ad59068 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintValue.php @@ -0,0 +1,123 @@ +versionString = $versionString; + + $this->parseVersion($versionString); + } + + /** + * @param $versionString + */ + private function parseVersion($versionString) { + $this->extractBuildMetaData($versionString); + $this->extractLabel($versionString); + + $versionSegments = explode('.', $versionString); + $this->major = new VersionNumber($versionSegments[0]); + + $minorValue = isset($versionSegments[1]) ? $versionSegments[1] : null; + $patchValue = isset($versionSegments[2]) ? $versionSegments[2] : null; + + $this->minor = new VersionNumber($minorValue); + $this->patch = new VersionNumber($patchValue); + } + + /** + * @param string $versionString + */ + private function extractBuildMetaData(&$versionString) { + if (preg_match('/\+(.*)/', $versionString, $matches) == 1) { + $this->buildMetaData = $matches[1]; + $versionString = str_replace($matches[0], '', $versionString); + } + } + + /** + * @param string $versionString + */ + private function extractLabel(&$versionString) { + if (preg_match('/\-(.*)/', $versionString, $matches) == 1) { + $this->label = $matches[1]; + $versionString = str_replace($matches[0], '', $versionString); + } + } + + /** + * @return string + */ + public function getLabel() { + return $this->label; + } + + /** + * @return string + */ + public function getBuildMetaData() { + return $this->buildMetaData; + } + + /** + * @return string + */ + public function getVersionString() { + return $this->versionString; + } + + /** + * @return VersionNumber + */ + public function getMajor() { + return $this->major; + } + + /** + * @return VersionNumber + */ + public function getMinor() { + return $this->minor; + } + + /** + * @return VersionNumber + */ + public function getPatch() { + return $this->patch; + } +} diff --git a/vendor/phar-io/version/src/VersionNumber.php b/vendor/phar-io/version/src/VersionNumber.php new file mode 100644 index 0000000..ab512ed --- /dev/null +++ b/vendor/phar-io/version/src/VersionNumber.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class VersionNumber { + /** + * @var int + */ + private $value; + + /** + * @param mixed $value + */ + public function __construct($value) { + if (is_numeric($value)) { + $this->value = $value; + } + } + + /** + * @return bool + */ + public function isAny() { + return $this->value === null; + } + + /** + * @return int + */ + public function getValue() { + return $this->value; + } +} diff --git a/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php b/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php new file mode 100644 index 0000000..683e9d0 --- /dev/null +++ b/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php @@ -0,0 +1,125 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\VersionConstraintParser + */ +class VersionConstraintParserTest extends TestCase { + /** + * @dataProvider versionStringProvider + * + * @param string $versionString + * @param VersionConstraint $expectedConstraint + */ + public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint) { + $parser = new VersionConstraintParser; + + $this->assertEquals($expectedConstraint, $parser->parse($versionString)); + } + + /** + * @dataProvider unsupportedVersionStringProvider + * + * @param string $versionString + */ + public function testThrowsExceptionIfVersionStringIsNotSupported($versionString) { + $parser = new VersionConstraintParser; + + $this->expectException(UnsupportedVersionConstraintException::class); + + $parser->parse($versionString); + } + + /** + * @return array + */ + public function versionStringProvider() { + return [ + ['1.0.2', new ExactVersionConstraint('1.0.2')], + [ + '~4.6', + new AndVersionConstraintGroup( + '~4.6', + [ + new GreaterThanOrEqualToVersionConstraint('~4.6', new Version('4.6')), + new SpecificMajorVersionConstraint('~4.6', 4) + ] + ) + ], + [ + '~4.6.2', + new AndVersionConstraintGroup( + '~4.6.2', + [ + new GreaterThanOrEqualToVersionConstraint('~4.6.2', new Version('4.6.2')), + new SpecificMajorAndMinorVersionConstraint('~4.6.2', 4, 6) + ] + ) + ], + [ + '^2.6.1', + new AndVersionConstraintGroup( + '^2.6.1', + [ + new GreaterThanOrEqualToVersionConstraint('^2.6.1', new Version('2.6.1')), + new SpecificMajorVersionConstraint('^2.6.1', 2) + ] + ) + ], + ['5.1.*', new SpecificMajorAndMinorVersionConstraint('5.1.*', 5, 1)], + ['5.*', new SpecificMajorVersionConstraint('5.*', 5)], + ['*', new AnyVersionConstraint()], + [ + '1.0.2 || 1.0.5', + new OrVersionConstraintGroup( + '1.0.2 || 1.0.5', + [ + new ExactVersionConstraint('1.0.2'), + new ExactVersionConstraint('1.0.5') + ] + ) + ], + [ + '^5.6 || ^7.0', + new OrVersionConstraintGroup( + '^5.6 || ^7.0', + [ + new AndVersionConstraintGroup( + '^5.6', [ + new GreaterThanOrEqualToVersionConstraint('^5.6', new Version('5.6')), + new SpecificMajorVersionConstraint('^5.6', 5) + ] + ), + new AndVersionConstraintGroup( + '^7.0', [ + new GreaterThanOrEqualToVersionConstraint('^7.0', new Version('7.0')), + new SpecificMajorVersionConstraint('^7.0', 7) + ] + ) + ] + ) + ] + ]; + } + + public function unsupportedVersionStringProvider() { + return [ + ['foo'], + ['+1.0.2'], + ['>=2.0'], + ['^5.6 || >= 7.0'], + ['2.0 || foo'] + ]; + } +} diff --git a/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php new file mode 100644 index 0000000..c618566 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php @@ -0,0 +1,25 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\AbstractVersionConstraint + */ +class AbstractVersionConstraintTest extends TestCase { + public function testAsString() { + /** @var AbstractVersionConstraint|\PHPUnit_Framework_MockObject_MockObject $constraint */ + $constraint = $this->getMockForAbstractClass(AbstractVersionConstraint::class, ['foo']); + + $this->assertSame('foo', $constraint->asString()); + } +} diff --git a/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php b/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php new file mode 100644 index 0000000..ce7f5da --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php @@ -0,0 +1,52 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\AndVersionConstraintGroup + */ +class AndVersionConstraintGroupTest extends TestCase { + public function testReturnsFalseIfOneConstraintReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertFalse($group->complies(new Version('1.0.0'))); + } + + public function testReturnsTrueIfAllConstraintsReturnsTrue() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } +} diff --git a/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php new file mode 100644 index 0000000..331785e --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\AnyVersionConstraint + */ +class AnyVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + [new Version('1.0.2')], + [new Version('4.8')], + [new Version('0.1.1-dev')] + ]; + } + + /** + * @dataProvider versionProvider + * + * @param Version $version + */ + public function testReturnsTrue(Version $version) { + $constraint = new AnyVersionConstraint; + + $this->assertTrue($constraint->complies($version)); + } + + public function testAsString() { + $this->assertSame('*', (new AnyVersionConstraint())->asString()); + } +} diff --git a/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php new file mode 100644 index 0000000..6b906fa --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php @@ -0,0 +1,58 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\ExactVersionConstraint + */ +class ExactVersionConstraintTest extends TestCase { + public function compliantVersionProvider() { + return [ + ['1.0.2', new Version('1.0.2')], + ['4.8.9', new Version('4.8.9')], + ['4.8', new Version('4.8')], + ]; + } + + public function nonCompliantVersionProvider() { + return [ + ['1.0.2', new Version('1.0.3')], + ['4.8.9', new Version('4.7.9')], + ['4.8', new Version('4.8.5')], + ]; + } + + /** + * @dataProvider compliantVersionProvider + * + * @param string $constraintValue + * @param Version $version + */ + public function testReturnsTrueForCompliantVersion($constraintValue, Version $version) { + $constraint = new ExactVersionConstraint($constraintValue); + + $this->assertTrue($constraint->complies($version)); + } + + /** + * @dataProvider nonCompliantVersionProvider + * + * @param string $constraintValue + * @param Version $version + */ + public function testReturnsFalseForNonCompliantVersion($constraintValue, Version $version) { + $constraint = new ExactVersionConstraint($constraintValue); + + $this->assertFalse($constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php new file mode 100644 index 0000000..2ae54a8 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\GreaterThanOrEqualToVersionConstraint + */ +class GreaterThanOrEqualToVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [new Version('1.0.2'), new Version('1.0.2'), true], + [new Version('1.0.2'), new Version('1.0.3'), true], + [new Version('1.0.2'), new Version('1.1.1'), true], + [new Version('1.0.2'), new Version('2.0.0'), true], + [new Version('1.0.2'), new Version('1.0.3'), true], + // non-compliant versions + [new Version('1.0.2'), new Version('1.0.1'), false], + [new Version('1.9.8'), new Version('0.9.9'), false], + [new Version('2.3.1'), new Version('2.2.3'), false], + [new Version('3.0.2'), new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param Version $constraintVersion + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions(Version $constraintVersion, Version $version, $expectedResult) { + $constraint = new GreaterThanOrEqualToVersionConstraint('foo', $constraintVersion); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php b/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php new file mode 100644 index 0000000..4c6f594 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php @@ -0,0 +1,65 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\OrVersionConstraintGroup + */ +class OrVersionConstraintGroupTest extends TestCase { + public function testReturnsTrueIfOneConstraintReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } + + public function testReturnsTrueIfAllConstraintsReturnsTrue() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } + + public function testReturnsFalseIfAllConstraintsReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertFalse($group->complies(new Version('1.0.0'))); + } +} diff --git a/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php new file mode 100644 index 0000000..d3ab123 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php @@ -0,0 +1,45 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\SpecificMajorAndMinorVersionConstraint + */ +class SpecificMajorAndMinorVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [1, 0, new Version('1.0.2'), true], + [1, 0, new Version('1.0.3'), true], + [1, 1, new Version('1.1.1'), true], + // non-compliant versions + [2, 9, new Version('0.9.9'), false], + [3, 2, new Version('2.2.3'), false], + [2, 8, new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param int $major + * @param int $minor + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions($major, $minor, Version $version, $expectedResult) { + $constraint = new SpecificMajorAndMinorVersionConstraint('foo', $major, $minor); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php new file mode 100644 index 0000000..fc78c7e --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Version\SpecificMajorVersionConstraint + */ +class SpecificMajorVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [1, new Version('1.0.2'), true], + [1, new Version('1.0.3'), true], + [1, new Version('1.1.1'), true], + // non-compliant versions + [2, new Version('0.9.9'), false], + [3, new Version('2.2.3'), false], + [3, new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param int $major + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions($major, Version $version, $expectedResult) { + $constraint = new SpecificMajorVersionConstraint('foo', $major); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/VersionTest.php b/vendor/phar-io/version/tests/Unit/VersionTest.php new file mode 100644 index 0000000..4d0eee4 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/VersionTest.php @@ -0,0 +1,104 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\Version + */ +class VersionTest extends TestCase { + /** + * @dataProvider versionProvider + * + * @param string $versionString + * @param string $expectedMajor + * @param string $expectedMinor + * @param string $expectedPatch + * @param string $expectedPreReleaseValue + * @param int $expectedReleaseCount + */ + public function testParsesVersionNumbers($versionString, $expectedMajor, $expectedMinor, $expectedPatch, $expectedPreReleaseValue = '', $expectedReleaseCount = 0) { + $version = new Version($versionString); + + $this->assertSame($expectedMajor, $version->getMajor()->getValue()); + $this->assertSame($expectedMinor, $version->getMinor()->getValue()); + $this->assertSame($expectedPatch, $version->getPatch()->getValue()); + if ($expectedPreReleaseValue !== '') { + $this->assertSame($expectedPreReleaseValue, $version->getPreReleaseSuffix()->getValue()); + } + if ($expectedReleaseCount !== 0) { + $this->assertSame($expectedReleaseCount, $version->getPreReleaseSuffix()->getNumber()); + } + + $this->assertSame($versionString, $version->getVersionString()); + } + + public function versionProvider() { + return [ + ['0.0.1', '0', '0', '1'], + ['0.1.2', '0', '1', '2'], + ['1.0.0-alpha', '1', '0', '0', 'alpha'], + ['3.4.12-dev3', '3', '4', '12', 'dev', 3], + ]; + } + + /** + * @dataProvider versionGreaterThanProvider + * + * @param Version $versionA + * @param Version $versionB + * @param bool $expectedResult + */ + public function testIsGreaterThan(Version $versionA, Version $versionB, $expectedResult) { + $this->assertSame($expectedResult, $versionA->isGreaterThan($versionB)); + } + + /** + * @return array + */ + public function versionGreaterThanProvider() { + return [ + [new Version('1.0.0'), new Version('1.0.1'), false], + [new Version('1.0.1'), new Version('1.0.0'), true], + [new Version('1.1.0'), new Version('1.0.1'), true], + [new Version('1.1.0'), new Version('2.0.1'), false], + [new Version('1.1.0'), new Version('1.1.0'), false], + [new Version('2.5.8'), new Version('1.6.8'), true], + [new Version('2.5.8'), new Version('2.6.8'), false], + [new Version('2.5.8'), new Version('3.1.2'), false], + ]; + } + + /** + * @dataProvider invalidVersionStringProvider + * + * @param string $versionString + */ + public function testThrowsExceptionIfVersionStringDoesNotFollowSemVer($versionString) + { + $this->expectException(InvalidVersionException::class); + new Version($versionString); + } + + /** + * @return array + */ + public function invalidVersionStringProvider() + { + return [ + ['foo'], + ['0.0.1-dev+ABC', '0', '0', '1', 'dev', 'ABC'], + ['1.0.0-x.7.z.92', '1', '0', '0', 'x.7.z.92'] + ]; + } + +} diff --git a/vendor/php-di/invoker/CONTRIBUTING.md b/vendor/php-di/invoker/CONTRIBUTING.md new file mode 100644 index 0000000..852fd1a --- /dev/null +++ b/vendor/php-di/invoker/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Contributing + +First of all, **thank you** for contributing! + +Here are a few rules to follow in order to ease code reviews and merging: + +- follow [PSR-1](http://www.php-fig.org/psr/1/) and [PSR-2](http://www.php-fig.org/psr/2/) +- run the test suite +- write (or update) unit tests when applicable +- write documentation for new features +- use [commit messages that make sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) + +One may ask you to [squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) too. This is used to "clean" your pull request before merging it (we don't want commits such as `fix tests`, `fix 2`, `fix 3`, etc.). + +When creating your pull request on GitHub, please write a description which gives the context and/or explains why you are creating it. diff --git a/vendor/php-di/invoker/LICENSE b/vendor/php-di/invoker/LICENSE new file mode 100644 index 0000000..b2b0416 --- /dev/null +++ b/vendor/php-di/invoker/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Matthieu Napoli + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/php-di/invoker/README.md b/vendor/php-di/invoker/README.md new file mode 100644 index 0000000..19adfe5 --- /dev/null +++ b/vendor/php-di/invoker/README.md @@ -0,0 +1,234 @@ +# Invoker + +Generic and extensible callable invoker. + +[![Build Status](https://img.shields.io/travis/PHP-DI/Invoker.svg?style=flat-square)](https://travis-ci.org/PHP-DI/Invoker) +[![Coverage Status](https://img.shields.io/coveralls/PHP-DI/Invoker/master.svg?style=flat-square)](https://coveralls.io/r/PHP-DI/Invoker?branch=master) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/PHP-DI/Invoker.svg?style=flat-square)](https://scrutinizer-ci.com/g/PHP-DI/Invoker/?branch=master) +[![Latest Version](https://img.shields.io/github/release/PHP-DI/invoker.svg?style=flat-square)](https://packagist.org/packages/PHP-DI/invoker) + +## Why? + +Who doesn't need an over-engineered `call_user_func()`? + +### Named parameters + +Does this [Silex](http://silex.sensiolabs.org) example look familiar: + +```php +$app->get('/project/{project}/issue/{issue}', function ($project, $issue) { + // ... +}); +``` + +Or this command defined with [Silly](https://github.com/mnapoli/silly#usage): + +```php +$app->command('greet [name] [--yell]', function ($name, $yell) { + // ... +}); +``` + +Same pattern in [Slim](http://www.slimframework.com): + +```php +$app->get('/hello/:name', function ($name) { + // ... +}); +``` + +You get the point. These frameworks invoke the controller/command/handler using something akin to named parameters: whatever the order of the parameters, they are matched by their name. + +**This library allows to invoke callables with named parameters in a generic and extensible way.** + +### Dependency injection + +Anyone familiar with AngularJS is familiar with how dependency injection is performed: + +```js +angular.controller('MyController', ['dep1', 'dep2', function(dep1, dep2) { + // ... +}]); +``` + +In PHP we find this pattern again in some frameworks and DI containers with partial to full support. For example in Silex you can type-hint the application to get it injected, but it only works with `Silex\Application`: + +```php +$app->get('/hello/{name}', function (Silex\Application $app, $name) { + // ... +}); +``` + +In Silly, it only works with `OutputInterface` to inject the application output: + +```php +$app->command('greet [name]', function ($name, OutputInterface $output) { + // ... +}); +``` + +[PHP-DI](http://php-di.org/doc/container.html) provides a way to invoke a callable and resolve all dependencies from the container using type-hints: + +```php +$container->call(function (Logger $logger, EntityManager $em) { + // ... +}); +``` + +**This library provides clear extension points to let frameworks implement any kind of dependency injection support they want.** + +### TL/DR + +In short, this library is meant to be a base building block for calling a function with named parameters and/or dependency injection. + +## Installation + +```sh +$ composer require PHP-DI/invoker +``` + +## Usage + +### Default behavior + +By default the `Invoker` can call using named parameters: + +```php +$invoker = new Invoker\Invoker; + +$invoker->call(function () { + echo 'Hello world!'; +}); + +// Simple parameter array +$invoker->call(function ($name) { + echo 'Hello ' . $name; +}, ['John']); + +// Named parameters +$invoker->call(function ($name) { + echo 'Hello ' . $name; +}, [ + 'name' => 'John' +]); + +// Use the default value +$invoker->call(function ($name = 'world') { + echo 'Hello ' . $name; +}); + +// Invoke any PHP callable +$invoker->call(['MyClass', 'myStaticMethod']); + +// Using Class::method syntax +$invoker->call('MyClass::myStaticMethod'); +``` + +Dependency injection in parameters is supported but needs to be configured with your container. Read on or jump to [*Built-in support for dependency injection*](#built-in-support-for-dependency-injection) if you are impatient. + +Additionally, callables can also be resolved from your container. Read on or jump to [*Resolving callables from a container*](#resolving-callables-from-a-container) if you are impatient. + +### Parameter resolvers + +Extending the behavior of the `Invoker` is easy and is done by implementing a [`ParameterResolver`](https://github.com/PHP-DI/Invoker/blob/master/src/ParameterResolver/ParameterResolver.php). + +This is explained in details the [Parameter resolvers documentation](doc/parameter-resolvers.md). + +#### Built-in support for dependency injection + +Rather than have you re-implement support for dependency injection with different containers every time, this package ships with 2 optional resolvers: + +- [`TypeHintContainerResolver`](https://github.com/PHP-DI/Invoker/blob/master/src/ParameterResolver/Container/TypeHintContainerResolver.php) + + This resolver will inject container entries by searching for the class name using the type-hint: + + ```php + $invoker->call(function (Psr\Logger\LoggerInterface $logger) { + // ... + }); + ``` + + In this example it will `->get('Psr\Logger\LoggerInterface')` from the container and inject it. + + This resolver is only useful if you store objects in your container using the class (or interface) name. Silex or Symfony for example store services under a custom name (e.g. `twig`, `db`, etc.) instead of the class name: in that case use the resolver shown below. + +- [`ParameterNameContainerResolver`](https://github.com/PHP-DI/Invoker/blob/master/src/ParameterResolver/Container/ParameterNameContainerResolver.php) + + This resolver will inject container entries by searching for the name of the parameter: + + ```php + $invoker->call(function ($twig) { + // ... + }); + ``` + + In this example it will `->get('twig')` from the container and inject it. + +These resolvers can work with any dependency injection container compliant with [container-interop](https://github.com/container-interop/container-interop). If you container is not compliant you can use the [Acclimate](https://github.com/jeremeamia/acclimate-container) package. + +Setting up those resolvers is simple: + +```php +// $container must be an instance of Interop\Container\ContainerInterface +$container = ... + +$containerResolver = new TypeHintContainerResolver($container); +// or +$containerResolver = new ParameterNameContainerResolver($container); + +$invoker = new Invoker\Invoker; +// Register it before all the other parameter resolvers +$invoker->getParameterResolver()->prependResolver($containerResolver); +``` + +You can also register both resolvers at the same time if you wish by prepending both. Implementing support for more tricky things is easy and up to you! + +### Resolving callables from a container + +The `Invoker` can be wired to your DI container to resolve the callables. + +For example with an invokable class: + +```php +class MyHandler +{ + public function __invoke() + { + // ... + } +} + +// By default this doesn't work: an instance of the class should be provided +$invoker->call('MyHandler'); + +// If we set up the container to use +$invoker = new Invoker\Invoker(null, $container); +// Now 'MyHandler' is resolved using the container! +$invoker->call('MyHandler'); +``` + +The same works for a class method: + +```php +class WelcomeController +{ + public function home() + { + // ... + } +} + +// By default this doesn't work: home() is not a static method +$invoker->call(['WelcomeController', 'home']); + +// If we set up the container to use +$invoker = new Invoker\Invoker(null, $container); +// Now 'WelcomeController' is resolved using the container! +$invoker->call(['WelcomeController', 'home']); +// Alternatively we can use the Class::method syntax +$invoker->call('WelcomeController::home'); +``` + +That feature can be used as the base building block for a framework's dispatcher. + +Again, any [container-interop](https://github.com/container-interop/container-interop) compliant container can be provided, and [Acclimate](https://github.com/jeremeamia/acclimate-container) can be used for incompatible containers. diff --git a/vendor/php-di/invoker/composer.json b/vendor/php-di/invoker/composer.json new file mode 100644 index 0000000..3f0c041 --- /dev/null +++ b/vendor/php-di/invoker/composer.json @@ -0,0 +1,25 @@ +{ + "name": "php-di/invoker", + "description": "Generic and extensible callable invoker", + "keywords": ["invoker", "dependency-injection", "dependency", "injection", "callable", "invoke"], + "homepage": "https://github.com/PHP-DI/Invoker", + "license": "MIT", + "type": "library", + "autoload": { + "psr-4": { + "Invoker\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Invoker\\Test\\": "tests/" + } + }, + "require": { + "container-interop/container-interop": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.5", + "athletic/athletic": "~0.1.8" + } +} diff --git a/vendor/php-di/invoker/doc/parameter-resolvers.md b/vendor/php-di/invoker/doc/parameter-resolvers.md new file mode 100644 index 0000000..bfccb7f --- /dev/null +++ b/vendor/php-di/invoker/doc/parameter-resolvers.md @@ -0,0 +1,109 @@ +# Parameter resolvers + +Extending the behavior of the `Invoker` is easy and is done by implementing a [`ParameterResolver`](https://github.com/PHP-DI/Invoker/blob/master/src/ParameterResolver/ParameterResolver.php): + +```php +interface ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ); +} +``` + +- `$providedParameters` contains the parameters provided by the user when calling `$invoker->call($callable, $parameters)` +- `$resolvedParameters` contains parameters that have already been resolved by other parameter resolvers + +An `Invoker` can chain multiple parameter resolvers to mix behaviors, e.g. you can mix "named parameters" support with "dependency injection" support. This is why a `ParameterResolver` should skip parameters that are already resolved in `$resolvedParameters`. + +Here is an implementation example for dumb dependency injection that creates a new instance of the classes type-hinted: + +```php +class MyParameterResolver implements ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + foreach ($reflection->getParameters() as $index => $parameter) { + if (array_key_exists($index, $resolvedParameters)) { + // Skip already resolved parameters + continue; + } + + $class = $parameter->getClass(); + + if ($class) { + $resolvedParameters[$index] = $class->newInstance(); + } + } + + return $resolvedParameters; + } +} +``` + +To use it: + +```php +$invoker = new Invoker\Invoker(new MyParameterResolver); + +$invoker->call(function (ArticleManager $articleManager) { + $articleManager->publishArticle('Hello world', 'This is the article content.'); +}); +``` + +A new instance of `ArticleManager` will be created by our parameter resolver. + +## Chaining parameter resolvers + +The fun starts to happen when we want to add support for many things: + +- named parameters +- dependency injection for type-hinted parameters +- ... + +This is where we should use the [`ResolverChain`](https://github.com/PHP-DI/Invoker/blob/master/src/ParameterResolver/ResolverChain.php). This resolver implements the [Chain of responsibility](http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern) design pattern. + +For example the default chain is: + +```php +$parameterResolver = new ResolverChain([ + new NumericArrayResolver, + new AssociativeArrayResolver, + new DefaultValueResolver, +]); +``` + +It allows to support even the weirdest use cases like: + +```php +$parameters = []; + +// First parameter will receive "Welcome" +$parameters[] = 'Welcome'; + +// Parameter named "content" will receive "Hello world!" +$parameters['content'] = 'Hello world!'; + +// $published is not defined so it will use its default value +$invoker->call(function ($title, $content, $published = true) { + // ... +}, $parameters); +``` + +We can put our custom parameter resolver in the list and created a super-duper invoker that also supports basic dependency injection: + +```php +$parameterResolver = new ResolverChain([ + new MyParameterResolver, // Our resolver is at the top for highest priority + new NumericArrayResolver, + new AssociativeArrayResolver, + new DefaultValueResolver, +]); + +$invoker = new Invoker\Invoker($parameterResolver); +``` diff --git a/vendor/php-di/invoker/src/CallableResolver.php b/vendor/php-di/invoker/src/CallableResolver.php new file mode 100644 index 0000000..463b49f --- /dev/null +++ b/vendor/php-di/invoker/src/CallableResolver.php @@ -0,0 +1,127 @@ + + */ +class CallableResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Resolve the given callable into a real PHP callable. + * + * @param callable|string|array $callable + * + * @return callable Real PHP callable. + * + * @throws NotCallableException + */ + public function resolve($callable) + { + if (is_string($callable) && strpos($callable, '::') !== false) { + $callable = explode('::', $callable, 2); + } + + $callable = $this->resolveFromContainer($callable); + + if (! is_callable($callable)) { + throw NotCallableException::fromInvalidCallable($callable, true); + } + + return $callable; + } + + /** + * @param callable|string|array $callable + * @return callable + * @throws NotCallableException + */ + private function resolveFromContainer($callable) + { + // Shortcut for a very common use case + if ($callable instanceof \Closure) { + return $callable; + } + + $isStaticCallToNonStaticMethod = false; + + // If it's already a callable there is nothing to do + if (is_callable($callable)) { + $isStaticCallToNonStaticMethod = $this->isStaticCallToNonStaticMethod($callable); + if (! $isStaticCallToNonStaticMethod) { + return $callable; + } + } + + // The callable is a container entry name + if (is_string($callable)) { + try { + return $this->container->get($callable); + } catch (NotFoundException $e) { + throw NotCallableException::fromInvalidCallable($callable, true); + } + } + + // The callable is an array whose first item is a container entry name + // e.g. ['some-container-entry', 'methodToCall'] + if (is_array($callable) && is_string($callable[0])) { + try { + // Replace the container entry name by the actual object + $callable[0] = $this->container->get($callable[0]); + return $callable; + } catch (NotFoundException $e) { + if ($isStaticCallToNonStaticMethod) { + throw new NotCallableException(sprintf( + 'Cannot call %s::%s() because %s() is not a static method and "%s" is not a container entry', + $callable[0], + $callable[1], + $callable[1], + $callable[0] + )); + } + throw new NotCallableException(sprintf( + 'Cannot call %s on %s because it is not a class nor a valid container entry', + $callable[1], + $callable[0] + )); + } + } + + // Unrecognized stuff, we let it fail later + return $callable; + } + + /** + * Check if the callable represents a static call to a non-static method. + * + * @param mixed $callable + * @return bool + */ + private function isStaticCallToNonStaticMethod($callable) + { + if (is_array($callable) && is_string($callable[0])) { + list($class, $method) = $callable; + $reflection = new \ReflectionMethod($class, $method); + + return ! $reflection->isStatic(); + } + + return false; + } +} diff --git a/vendor/php-di/invoker/src/Exception/InvocationException.php b/vendor/php-di/invoker/src/Exception/InvocationException.php new file mode 100644 index 0000000..a5f6ffc --- /dev/null +++ b/vendor/php-di/invoker/src/Exception/InvocationException.php @@ -0,0 +1,12 @@ + + */ +class InvocationException extends \Exception +{ +} diff --git a/vendor/php-di/invoker/src/Exception/NotCallableException.php b/vendor/php-di/invoker/src/Exception/NotCallableException.php new file mode 100644 index 0000000..6fd5d2e --- /dev/null +++ b/vendor/php-di/invoker/src/Exception/NotCallableException.php @@ -0,0 +1,35 @@ + + */ +class NotCallableException extends InvocationException +{ + /** + * @param string $value + * @param bool $containerEntry + * @return self + */ + public static function fromInvalidCallable($value, $containerEntry = false) + { + if (is_object($value)) { + $message = sprintf('Instance of %s is not a callable', get_class($value)); + } elseif (is_array($value) && isset($value[0]) && isset($value[1])) { + $class = is_object($value[0]) ? get_class($value[0]) : $value[0]; + $extra = method_exists($class, '__call') ? ' A __call() method exists but magic methods are not supported.' : ''; + $message = sprintf('%s::%s() is not a callable.%s', $class, $value[1], $extra); + } else { + if ($containerEntry) { + $message = var_export($value, true) . ' is neither a callable nor a valid container entry'; + } else { + $message = var_export($value, true) . ' is not a callable'; + } + } + + return new self($message); + } +} diff --git a/vendor/php-di/invoker/src/Exception/NotEnoughParametersException.php b/vendor/php-di/invoker/src/Exception/NotEnoughParametersException.php new file mode 100644 index 0000000..1be4eb9 --- /dev/null +++ b/vendor/php-di/invoker/src/Exception/NotEnoughParametersException.php @@ -0,0 +1,12 @@ + + */ +class NotEnoughParametersException extends InvocationException +{ +} diff --git a/vendor/php-di/invoker/src/Invoker.php b/vendor/php-di/invoker/src/Invoker.php new file mode 100644 index 0000000..ffdcd0b --- /dev/null +++ b/vendor/php-di/invoker/src/Invoker.php @@ -0,0 +1,122 @@ + + */ +class Invoker implements InvokerInterface +{ + /** + * @var CallableResolver|null + */ + private $callableResolver; + + /** + * @var ParameterResolver + */ + private $parameterResolver; + + /** + * @var ContainerInterface|null + */ + private $container; + + public function __construct(ParameterResolver $parameterResolver = null, ContainerInterface $container = null) + { + $this->parameterResolver = $parameterResolver ?: $this->createParameterResolver(); + $this->container = $container; + + if ($container) { + $this->callableResolver = new CallableResolver($container); + } + } + + /** + * {@inheritdoc} + */ + public function call($callable, array $parameters = array()) + { + if ($this->callableResolver) { + $callable = $this->callableResolver->resolve($callable); + } + + if (! is_callable($callable)) { + throw new NotCallableException(sprintf( + '%s is not a callable', + is_object($callable) ? 'Instance of ' . get_class($callable) : var_export($callable, true) + )); + } + + $callableReflection = CallableReflection::create($callable); + + $args = $this->parameterResolver->getParameters($callableReflection, $parameters, array()); + + // Sort by array key because call_user_func_array ignores numeric keys + ksort($args); + + // Check all parameters are resolved + $diff = array_diff_key($callableReflection->getParameters(), $args); + if (! empty($diff)) { + /** @var \ReflectionParameter $parameter */ + $parameter = reset($diff); + throw new NotEnoughParametersException(sprintf( + 'Unable to invoke the callable because no value was given for parameter %d ($%s)', + $parameter->getPosition() + 1, + $parameter->name + )); + } + + return call_user_func_array($callable, $args); + } + + /** + * Create the default parameter resolver. + * + * @return ParameterResolver + */ + private function createParameterResolver() + { + return new ResolverChain(array( + new NumericArrayResolver, + new AssociativeArrayResolver, + new DefaultValueResolver, + )); + } + + /** + * @return ParameterResolver By default it's a ResolverChain + */ + public function getParameterResolver() + { + return $this->parameterResolver; + } + + /** + * @return ContainerInterface|null + */ + public function getContainer() + { + return $this->container; + } + + /** + * @return CallableResolver|null Returns null if no container was given in the constructor. + */ + public function getCallableResolver() + { + return $this->callableResolver; + } +} diff --git a/vendor/php-di/invoker/src/InvokerInterface.php b/vendor/php-di/invoker/src/InvokerInterface.php new file mode 100644 index 0000000..cd6980e --- /dev/null +++ b/vendor/php-di/invoker/src/InvokerInterface.php @@ -0,0 +1,29 @@ + + */ +interface InvokerInterface +{ + /** + * Call the given function using the given parameters. + * + * @param callable $callable Function to call. + * @param array $parameters Parameters to use. + * + * @return mixed Result of the function. + * + * @throws InvocationException Base exception class for all the sub-exceptions below. + * @throws NotCallableException + * @throws NotEnoughParametersException + */ + public function call($callable, array $parameters = array()); +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/AssociativeArrayResolver.php b/vendor/php-di/invoker/src/ParameterResolver/AssociativeArrayResolver.php new file mode 100644 index 0000000..d51f2c7 --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/AssociativeArrayResolver.php @@ -0,0 +1,39 @@ +call($callable, ['foo' => 'bar'])` will inject the string `'bar'` + * in the parameter named `$foo`. + * + * Parameters that are not indexed by a string are ignored. + * + * @author Matthieu Napoli + */ +class AssociativeArrayResolver implements ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + if (array_key_exists($parameter->name, $providedParameters)) { + $resolvedParameters[$index] = $providedParameters[$parameter->name]; + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/Container/ParameterNameContainerResolver.php b/vendor/php-di/invoker/src/ParameterResolver/Container/ParameterNameContainerResolver.php new file mode 100644 index 0000000..983dea4 --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/Container/ParameterNameContainerResolver.php @@ -0,0 +1,51 @@ + + */ +class ParameterNameContainerResolver implements ParameterResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + /** + * @param ContainerInterface $container The container to get entries from. + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + $name = $parameter->name; + + if ($name && $this->container->has($name)) { + $resolvedParameters[$index] = $this->container->get($name); + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/Container/TypeHintContainerResolver.php b/vendor/php-di/invoker/src/ParameterResolver/Container/TypeHintContainerResolver.php new file mode 100644 index 0000000..65a4079 --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/Container/TypeHintContainerResolver.php @@ -0,0 +1,51 @@ + + */ +class TypeHintContainerResolver implements ParameterResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + /** + * @param ContainerInterface $container The container to get entries from. + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + $parameterClass = $parameter->getClass(); + + if ($parameterClass && $this->container->has($parameterClass->name)) { + $resolvedParameters[$index] = $this->container->get($parameterClass->name); + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/DefaultValueResolver.php b/vendor/php-di/invoker/src/ParameterResolver/DefaultValueResolver.php new file mode 100644 index 0000000..6fa8f8c --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/DefaultValueResolver.php @@ -0,0 +1,40 @@ + + */ +class DefaultValueResolver implements ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + /** @var \ReflectionParameter $parameter */ + if ($parameter->isOptional()) { + try { + $resolvedParameters[$index] = $parameter->getDefaultValue(); + } catch (ReflectionException $e) { + // Can't get default values from PHP internal classes and functions + } + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/NumericArrayResolver.php b/vendor/php-di/invoker/src/ParameterResolver/NumericArrayResolver.php new file mode 100644 index 0000000..dc5f02c --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/NumericArrayResolver.php @@ -0,0 +1,39 @@ +call($callable, ['foo', 'bar'])` will simply resolve the parameters + * to `['foo', 'bar']`. + * + * Parameters that are not indexed by a number (i.e. parameter position) + * will be ignored. + * + * @author Matthieu Napoli + */ +class NumericArrayResolver implements ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $providedParameters = array_diff_key($providedParameters, $resolvedParameters); + } + + foreach ($providedParameters as $key => $value) { + if (is_int($key)) { + $resolvedParameters[$key] = $value; + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/ParameterResolver.php b/vendor/php-di/invoker/src/ParameterResolver/ParameterResolver.php new file mode 100644 index 0000000..39c7abc --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/ParameterResolver.php @@ -0,0 +1,33 @@ + + */ +interface ParameterResolver +{ + /** + * Resolves the parameters to use to call the callable. + * + * `$resolvedParameters` contains parameters that have already been resolved. + * + * Each ParameterResolver must resolve parameters that are not already + * in `$resolvedParameters`. That allows to chain multiple ParameterResolver. + * + * @param ReflectionFunctionAbstract $reflection Reflection object for the callable. + * @param array $providedParameters Parameters provided by the caller. + * @param array $resolvedParameters Parameters resolved (indexed by parameter position). + * + * @return array + */ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ); +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/ResolverChain.php b/vendor/php-di/invoker/src/ParameterResolver/ResolverChain.php new file mode 100644 index 0000000..d524746 --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/ResolverChain.php @@ -0,0 +1,69 @@ + + */ +class ResolverChain implements ParameterResolver +{ + /** + * @var ParameterResolver[] + */ + private $resolvers = array(); + + public function __construct(array $resolvers = array()) + { + $this->resolvers = $resolvers; + } + + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $reflectionParameters = $reflection->getParameters(); + + foreach ($this->resolvers as $resolver) { + $resolvedParameters = $resolver->getParameters( + $reflection, + $providedParameters, + $resolvedParameters + ); + + $diff = array_diff_key($reflectionParameters, $resolvedParameters); + if (empty($diff)) { + // Stop traversing: all parameters are resolved + return $resolvedParameters; + } + } + + return $resolvedParameters; + } + + /** + * Push a parameter resolver after the ones already registered. + * + * @param ParameterResolver $resolver + */ + public function appendResolver(ParameterResolver $resolver) + { + $this->resolvers[] = $resolver; + } + + /** + * Insert a parameter resolver before the ones already registered. + * + * @param ParameterResolver $resolver + */ + public function prependResolver(ParameterResolver $resolver) + { + array_unshift($this->resolvers, $resolver); + } +} diff --git a/vendor/php-di/invoker/src/ParameterResolver/TypeHintResolver.php b/vendor/php-di/invoker/src/ParameterResolver/TypeHintResolver.php new file mode 100644 index 0000000..d2fcc28 --- /dev/null +++ b/vendor/php-di/invoker/src/ParameterResolver/TypeHintResolver.php @@ -0,0 +1,39 @@ + + */ +class TypeHintResolver implements ParameterResolver +{ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + $parameterClass = $parameter->getClass(); + + if ($parameterClass && array_key_exists($parameterClass->name, $providedParameters)) { + $resolvedParameters[$index] = $providedParameters[$parameterClass->name]; + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/invoker/src/Reflection/CallableReflection.php b/vendor/php-di/invoker/src/Reflection/CallableReflection.php new file mode 100644 index 0000000..f65f6e1 --- /dev/null +++ b/vendor/php-di/invoker/src/Reflection/CallableReflection.php @@ -0,0 +1,61 @@ + + */ +class CallableReflection +{ + /** + * @param callable $callable + * + * @return \ReflectionFunctionAbstract + * + * @throws NotCallableException + * + * TODO Use the `callable` type-hint once support for PHP 5.4 and up. + */ + public static function create($callable) + { + // Closure + if ($callable instanceof \Closure) { + return new \ReflectionFunction($callable); + } + + // Array callable + if (is_array($callable)) { + list($class, $method) = $callable; + + if (! method_exists($class, $method)) { + throw NotCallableException::fromInvalidCallable($callable); + } + + return new \ReflectionMethod($class, $method); + } + + // Callable object (i.e. implementing __invoke()) + if (is_object($callable) && method_exists($callable, '__invoke')) { + return new \ReflectionMethod($callable, '__invoke'); + } + + // Callable class (i.e. implementing __invoke()) + if (is_string($callable) && class_exists($callable) && method_exists($callable, '__invoke')) { + return new \ReflectionMethod($callable, '__invoke'); + } + + // Standard function + if (is_string($callable) && function_exists($callable)) { + return new \ReflectionFunction($callable); + } + + throw new NotCallableException(sprintf( + '%s is not a callable', + is_string($callable) ? $callable : 'Instance of ' . get_class($callable) + )); + } +} diff --git a/vendor/php-di/php-di/.coveralls.yml b/vendor/php-di/php-di/.coveralls.yml new file mode 100644 index 0000000..bc71b62 --- /dev/null +++ b/vendor/php-di/php-di/.coveralls.yml @@ -0,0 +1,2 @@ +coverage_clover: clover.xml +json_path: coveralls-upload.json diff --git a/vendor/php-di/php-di/.gitattributes b/vendor/php-di/php-di/.gitattributes new file mode 100644 index 0000000..362238c --- /dev/null +++ b/vendor/php-di/php-di/.gitattributes @@ -0,0 +1,8 @@ +# .gitattributes +tests/ export-ignore +website/ export-ignore +doc/ export-ignore +news/ export-ignore + +# Auto detect text files and perform LF normalization +* text=auto diff --git a/vendor/php-di/php-di/.gitignore b/vendor/php-di/php-di/.gitignore new file mode 100644 index 0000000..b39e0cd --- /dev/null +++ b/vendor/php-di/php-di/.gitignore @@ -0,0 +1,9 @@ +/.idea/ +/vendor/ +/composer.phar +/composer.lock +/theme/ +/.couscous/ +/website/bower_components/ +/website/css/all.min.css +/logo/ diff --git a/vendor/php-di/php-di/.phpstorm.meta.php b/vendor/php-di/php-di/.phpstorm.meta.php new file mode 100644 index 0000000..9168ea9 --- /dev/null +++ b/vendor/php-di/php-di/.phpstorm.meta.php @@ -0,0 +1,21 @@ + [ + "" == "@", + ], + \Interop\Container\ContainerInterface::get('') => [ + "" == "@", + ], + \DI\Container::get('') => [ + "" == "@", + ], + \EasyMock\EasyMock::easyMock('') => [ + "" == "@", + ], + \EasyMock\EasyMock::easySpy('') => [ + "" == "@", + ], + ]; +} diff --git a/vendor/php-di/php-di/.travis.yml b/vendor/php-di/php-di/.travis.yml new file mode 100644 index 0000000..50491d5 --- /dev/null +++ b/vendor/php-di/php-di/.travis.yml @@ -0,0 +1,26 @@ +language: php + +sudo: false + +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + +matrix: + include: + - php: 5.5 + env: dependencies=lowest + +before_script: + - if [[ $(phpenv version-name) == '5.6' ]]; then composer require satooshi/php-coveralls:dev-master -n ; fi + - if [[ $(phpenv version-name) != '5.6' ]]; then composer install -n ; fi + - if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-stable -n; fi; + +script: + - if [[ $(phpenv version-name) == '5.6' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi + - if [[ $(phpenv version-name) != '5.6' ]]; then vendor/bin/phpunit ; fi + +after_script: + - if [[ $(phpenv version-name) == '5.6' ]]; then php vendor/bin/coveralls -v ; fi diff --git a/vendor/php-di/php-di/404.md b/vendor/php-di/php-di/404.md new file mode 100644 index 0000000..c4e870f --- /dev/null +++ b/vendor/php-di/php-di/404.md @@ -0,0 +1,3 @@ +--- +layout: 404 +--- diff --git a/vendor/php-di/php-di/CONTRIBUTING.md b/vendor/php-di/php-di/CONTRIBUTING.md new file mode 100644 index 0000000..6e3bd24 --- /dev/null +++ b/vendor/php-di/php-di/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing + +[![Build Status](https://travis-ci.org/PHP-DI/PHP-DI.png?branch=master)](https://travis-ci.org/PHP-DI/PHP-DI) [![Coverage Status](https://coveralls.io/repos/PHP-DI/PHP-DI/badge.png?branch=master)](https://coveralls.io/r/PHP-DI/PHP-DI?branch=master) + +PHP-DI is licensed under the MIT License. + + +## Set up + +* Check out the sources using git or download them + +```bash +$ git clone https://github.com/PHP-DI/PHP-DI.git +``` + +* Install the libraries using composer: + +```bash +$ curl -s http://getcomposer.org/installer | php +$ php composer.phar install +``` + +If you are running Windows or are having trouble, read [the official documentation](http://getcomposer.org/doc/00-intro.md#installation). + + +## Run the tests + +The tests are run with [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html): + +```bash +$ phpunit +``` + + +## Learning the internals + +Read the [How it works](doc/how-it-works.md) documentation. + + +## What to do? + +- Add tests: pick up uncovered situations in the [code coverage report](https://coveralls.io/r/PHP-DI/PHP-DI) +- Resolve issues: [issue list](https://github.com/PHP-DI/PHP-DI/issues) +- Improve the documentation +- … + + +## Coding style + +The code follows PSR0, PSR1 and [PSR2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). + +Also, do not hesitate to add your name to the author list of a class in the docblock if you improve it. diff --git a/vendor/php-di/php-di/LICENSE b/vendor/php-di/php-di/LICENSE new file mode 100644 index 0000000..f24e183 --- /dev/null +++ b/vendor/php-di/php-di/LICENSE @@ -0,0 +1,18 @@ +PHP-DI - PHP Dependency Injection + +Copyright (C) Matthieu Napoli + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/php-di/php-di/README.md b/vendor/php-di/php-di/README.md new file mode 100644 index 0000000..a9f9e40 --- /dev/null +++ b/vendor/php-di/php-di/README.md @@ -0,0 +1,20 @@ +--- +layout: home +--- + +[![](doc/img.png)](http://php-di.org/) + +[![Build Status](https://img.shields.io/travis/PHP-DI/PHP-DI.svg?style=flat-square)](https://travis-ci.org/PHP-DI/PHP-DI) +[![Coverage Status](https://img.shields.io/coveralls/PHP-DI/PHP-DI/master.svg?style=flat-square)](https://coveralls.io/r/PHP-DI/PHP-DI?branch=master) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/PHP-DI/PHP-DI.svg?style=flat-square)](https://scrutinizer-ci.com/g/PHP-DI/PHP-DI/?branch=master) +[![Downloads per months](https://img.shields.io/packagist/dm/PHP-DI/PHP-DI.svg?style=flat-square)](https://packagist.org/packages/PHP-DI/PHP-DI) +[![Total downloads](https://img.shields.io/packagist/dt/PHP-DI/PHP-DI.svg?style=flat-square)](https://packagist.org/packages/PHP-DI/PHP-DI) + +[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/PHP-DI/PHP-DI.svg)](http://isitmaintained.com/project/PHP-DI/PHP-DI "Average time to resolve an issue") +[![Percentage of issues still open](http://isitmaintained.com/badge/open/PHP-DI/PHP-DI.svg)](http://isitmaintained.com/project/PHP-DI/PHP-DI "Percentage of issues still open") + +PHP-DI is a dependency injection container meant to be practical, powerful, and framework-agnostic. + +Read more on the website: **[php-di.org](http://php-di.org)** + +Join us in the Gitter chat room: [![Gitter chat](https://badges.gitter.im/PHP-DI/PHP-DI.png)](https://gitter.im/PHP-DI/PHP-DI) diff --git a/vendor/php-di/php-di/benchmarks/DI/ContainerBench.php b/vendor/php-di/php-di/benchmarks/DI/ContainerBench.php new file mode 100644 index 0000000..0aeb102 --- /dev/null +++ b/vendor/php-di/php-di/benchmarks/DI/ContainerBench.php @@ -0,0 +1,70 @@ +addDefinitions([ + stdClass::class => function (ContainerInterface $container) { + return new stdClass(); + }, + ]); + + $extraDefinitionsToSimulateRealisticContainer = array(); + for ($i = 0; $i < 1000; $i++) { + $extraDefinitionsToSimulateRealisticContainer[stdClass::class . $i] = function (ContainerInterface $container) { + return new stdClass(); + }; + } + $builder->addDefinitions($extraDefinitionsToSimulateRealisticContainer); + $this->container = $builder->build(); + } + + /** + * @Revs(10000) + */ + public function benchGetDummyClass() + { + $value = $this->container->get(stdClass::class); + } + + /** + * @Revs(10000) + */ + public function benchCheckAndGetDummyClass() + { + $value = $this->container->has(stdClass::class) ? $this->container->get(stdClass::class) : null; + } + + /** + * @Revs(10000) + */ + public function benchMakeDummyClass() + { + $value = $this->container->make(stdClass::class); + } + + + /** + * @Revs(10000) + */ + public function benchCheckAndMakeDummyClass() + { + $value = $this->container->has(stdClass::class) ? $this->container->make(stdClass::class) : null; + } +} diff --git a/vendor/php-di/php-di/change-log.md b/vendor/php-di/php-di/change-log.md new file mode 100644 index 0000000..5864148 --- /dev/null +++ b/vendor/php-di/php-di/change-log.md @@ -0,0 +1,384 @@ +# Change log + +## 5.4.6 + +- Fix [#554](https://github.com/PHP-DI/PHP-DI/issues/554): `Container::make()` fails when combined with `decorate()`. + +## 5.4.5 + +Fixup of 5.4.4. + +- [#531](https://github.com/PHP-DI/PHP-DI/issues/531): performance improvement. + +## 5.4.4 + +This release was broken because it was tagged against the wrong branch. + +- [#531](https://github.com/PHP-DI/PHP-DI/issues/531): performance improvement. + +## 5.4.3 + +- [#467](https://github.com/PHP-DI/PHP-DI/issues/467): register the container against the PSR ContainerInterface + +## 5.4.2 + +- Minor patch to add the `provide: psr/container-implementation` to `composer.json`. + +## 5.4.1 + +- [PSR-11](http://www.php-fig.org/psr/) compliance + +Note that PHP-DI was already compliant with PSR-11 because it was implementing container-interop, and container-interop 1.2 extends PSR-11. This new version just makes it more explicit and will allow to drop container-interop support in the next major versions. + +## 5.4 + +Read the [news entry](news/20-php-di-5-4-released.md). + +New features: + +- [#362](https://github.com/PHP-DI/PHP-DI/issues/362) implemented in [#428](https://github.com/PHP-DI/PHP-DI/pull/428), [#430](https://github.com/PHP-DI/PHP-DI/pull/430), [#431](https://github.com/PHP-DI/PHP-DI/pull/431) and [#432](https://github.com/PHP-DI/PHP-DI/pull/432): factory parameters can now be configured, for example: + ```php + return [ + 'Database' => DI\factory(function ($host) {...}) + ->parameter('host', DI\get('db.host')), + ]; + ``` + Read the [factories documentation](http://php-di.org/doc/php-definitions.html#factories) to learn more. Feature implemented by [@predakanga](https://github.com/predakanga). + +Improvements: + +- [#429](https://github.com/PHP-DI/PHP-DI/pull/429): performance improvements in definition resolution (by [@mnapoli](https://github.com/mnapoli)) +- [#421](https://github.com/PHP-DI/PHP-DI/issues/421): once a `ContainerBuilder` has built a container, it is locked to prevent confusion when adding new definitions to it (by [@mnapoli](https://github.com/mnapoli)) +- [#423](https://github.com/PHP-DI/PHP-DI/pull/423): improved exception messages (by [@mnapoli](https://github.com/mnapoli)) + +## 5.3 + +Read the [news entry](news/19-php-di-5-3-released.md). + +- release of the [2.0 version](https://github.com/PHP-DI/Symfony-Bridge/releases/tag/2.0.0) of the Symfony bridge (by [@mnapoli](https://github.com/mnapoli)) +- PHP 5.5 or above is now required +- a lot of documentation improvements by 9 different contributors +- [#389](https://github.com/PHP-DI/PHP-DI/pull/389): exception message improvement by [@mopahle](https://github.com/mopahle) +- [#359](https://github.com/PHP-DI/PHP-DI/issues/359), [#411](https://github.com/PHP-DI/PHP-DI/issues/411), [#414](https://github.com/PHP-DI/PHP-DI/pull/414), [#412](https://github.com/PHP-DI/PHP-DI/pull/412): compatibility with ProxyManager 1.* and 2.* (by [@holtkamp](https://github.com/holtkamp) and [@mnapoli](https://github.com/mnapoli)) +- [#416](https://github.com/PHP-DI/PHP-DI/pull/416): dumping definitions was refactored into a more lightweight and simple solution; definition "dumpers" have been removed (internal classes), definitions can now be cast to string directly (by [@mnapoli](https://github.com/mnapoli)) + +## 5.2 + +Read the [news entry](news/17-php-di-5-2-released.md). + +Improvements: + +- [#347](https://github.com/PHP-DI/PHP-DI/pull/347) (includes [#333](https://github.com/PHP-DI/PHP-DI/pull/333) and [#345](https://github.com/PHP-DI/PHP-DI/pull/345)): by [@jdreesen](https://github.com/jdreesen), [@quimcalpe](https://github.com/quimcalpe) and [@mnapoli](https://github.com/mnapoli) + - Allow injection of any container object as factory parameter via type hinting + - Allow injection of a `DI\Factory\RequestedEntry` object to get the requested entry name +- [#272](https://github.com/PHP-DI/PHP-DI/issues/272): Support `"Class::method""` syntax for callables (by [@jdreesen](https://github.com/jdreesen)) +- [#332](https://github.com/PHP-DI/PHP-DI/issues/332): IDE support (plugin and documentation) (by [@pulyaevskiy](https://github.com/pulyaevskiy), [@avant1](https://github.com/avant1) and [@mnapoli](https://github.com/mnapoli)) +- [#326](https://github.com/PHP-DI/PHP-DI/pull/326): Exception messages are simpler and more consistent (by [@mnapoli](https://github.com/mnapoli)) +- [#325](https://github.com/PHP-DI/PHP-DI/pull/325): Add a "Edit this page" button in the website to encourage users to improve the documentation (by [@jdreesen](https://github.com/jdreesen)) + +Bugfixes: + +- [#321](https://github.com/PHP-DI/PHP-DI/pull/321): Allow factory definitions to reference arbitrary container entries as callables (by [@jdreesen](https://github.com/jdreesen)) +- [#335](https://github.com/PHP-DI/PHP-DI/issues/335): Class imports in traits are now considered when parsing annotations (by [@thebigb](https://github.com/thebigb)) + +## 5.1 + +Read the [news entry](news/16-php-di-5-1-released.md). + +Improvements: + +- [Zend Framework 2 integration](https://github.com/PHP-DI/ZF2-Bridge) (by @Rastusik) +- [#308](https://github.com/PHP-DI/PHP-DI/pull/308): Instantiate factories using the container (`DI\factory(['FooFactory', 'create'])`) +- Many performances improvements - some benchmarks show up to 35% performance improvements, real results may vary of course +- Many documentation improvements (@jdreesen, @mindplay-dk, @mnapoli, @holtkamp, @Rastusik) +- [#296](https://github.com/PHP-DI/PHP-DI/issues/296): Provide a faster `ArrayCache` implementation, mostly useful in micro-benchmarks + +Bugfixes: + +- [#257](https://github.com/PHP-DI/PHP-DI/issues/257) & [#274](https://github.com/PHP-DI/PHP-DI/issues/274): Private properties of parent classes are not injected when using annotations +- [#300](https://github.com/PHP-DI/PHP-DI/pull/300): Exception if object definition extends an incompatible definition +- [#306](https://github.com/PHP-DI/PHP-DI/issues/306): Errors when using parameters passed by reference (fixed by @bradynpoulsen) +- [#318](https://github.com/PHP-DI/PHP-DI/issues/318): `Container::call()` ignores parameter's default value + +Internal changes: + +- [#276](https://github.com/PHP-DI/PHP-DI/pull/276): Tests now pass on Windows (@bgaillard) + +## 5.0 + +This is the complete change log. You can also read the [migration guide](doc/migration/5.0.md) for upgrading, or [the news article](news/15-php-di-5-0-released.md) for a nicer introduction to this new version. + +Improvements: + +- Moved to an organization on GitHub: [github.com/PHP-DI/PHP-DI](https://github.com/PHP-DI/PHP-DI) +- The package has been renamed to: from `mnapoli/php-di` to [`php-di/php-di`](https://packagist.org/packages/php-di/php-di) +- New [Silex integration](doc/frameworks/silex.md) +- Lighter package: from 10 to 3 Composer dependencies! +- [#235](https://github.com/PHP-DI/PHP-DI/issues/235): `DI\link()` is now deprecated in favor of `DI\get()`. There is no BC break as `DI\link()` still works. +- [#207](https://github.com/PHP-DI/PHP-DI/issues/207): Support for `DI\link()` in arrays +- [#203](https://github.com/PHP-DI/PHP-DI/issues/203): New `DI\string()` helper ([documentation](doc/php-definitions.md)) +- [#208](https://github.com/PHP-DI/PHP-DI/issues/208): Support for nested definitions +- [#226](https://github.com/PHP-DI/PHP-DI/pull/226): `DI\factory()` can now be omitted with closures: + + ```php + // before + 'My\Class' => DI\factory(function () { ... }) + // now (optional shortcut) + 'My\Class' => function () { ... } + ``` +- [#193](https://github.com/PHP-DI/PHP-DI/issues/193): `DI\object()->method()` now supports calling the same method twice (or more). +- [#248](https://github.com/PHP-DI/PHP-DI/issues/248): New `DI\decorate()` helper to decorate a previously defined entry ([documentation](doc/definition-overriding.md)) +- [#215](https://github.com/PHP-DI/PHP-DI/pull/215): New `DI\add()` helper to add entries to an existing array ([documentation](doc/definition-overriding.md)) +- [#218](https://github.com/PHP-DI/PHP-DI/issues/218): `ContainerBuilder::addDefinitions()` can now take an array of definitions +- [#211](https://github.com/PHP-DI/PHP-DI/pull/211): `ContainerBuilder::addDefinitions()` is now fluent (return `$this`) +- [#250](https://github.com/PHP-DI/PHP-DI/issues/250): `Container::call()` now also accepts parameters not indexed by name as well as embedded definitions ([documentation](doc/container.md)) +- Various performance improvements, e.g. lower the number of files loaded, simpler architecture, … + +BC breaks: + +- PHP-DI now requires a version of PHP >= 5.4.0 +- The package is lighter by default: + - [#251](https://github.com/PHP-DI/PHP-DI/issues/251): Annotations are disabled by default, if you use annotations enable them with `$containerBuilder->useAnnotations(true)`. Additionally the `doctrine/annotations` package isn't required by default anymore, so you also need to run `composer require doctrine/annotations`. + - `doctrine/cache` is not installed by default anymore, you need to require it in `composer.json` (`~1.0`) if you want to configure a cache for PHP-DI + - [#198](https://github.com/PHP-DI/PHP-DI/issues/198): `ocramius/proxy-manager` is not installed by default anymore, you need to require it in `composer.json` (`~1.0`) if you want to use **lazy injection** +- Closures are now converted into factory definitions automatically. If you ever defined a closure as a value (e.g. to have the closure injected in a class), you need to wrap the closure with the new `DI\value()` helper. +- [#223](https://github.com/PHP-DI/PHP-DI/issues/223): `DI\ContainerInterface` was deprecated since v4.1 and has been removed + +Internal changes in case you were replacing/extending some parts: + +- the definition sources architecture has been refactored, if you defined custom definition sources you will need to update your code (it should be much easier now) +- [#252](https://github.com/PHP-DI/PHP-DI/pull/252): `DI\Scope` internal implementation has changed. You are encouraged to use the constants (`DI\Scope::SINGLETON` and `DI\Scope::PROTOTYPE`) instead of the static methods, but backward compatibility is kept (static methods still work). +- [#241](https://github.com/PHP-DI/PHP-DI/issues/241): `Container::call()` now uses the *Invoker* external library + +## 4.4 + +Read the [news entry](news/13-php-di-4-4-released.md). + +- [#185](https://github.com/PHP-DI/PHP-DI/issues/185) Support for invokable objects in `Container::call()` +- [#192](https://github.com/PHP-DI/PHP-DI/pull/192) Support for invokable classes in `Container::call()` (will instantiate the class) +- [#184](https://github.com/PHP-DI/PHP-DI/pull/184) Option to ignore phpdoc errors + +## 4.3 + +Read the [news entry](news/11-php-di-4-3-released.md). + +- [#176](https://github.com/PHP-DI/PHP-DI/pull/176) New definition type for reading environment variables: `DI\env()` +- [#181](https://github.com/PHP-DI/PHP-DI/pull/181) `DI\FactoryInterface` and `DI\InvokerInterface` are now auto-registered inside the container so that you can inject them without any configuration needed +- [#173](https://github.com/PHP-DI/PHP-DI/pull/173) `$container->call(['MyClass', 'method]);` will get `MyClass` from the container if `method()` is not a static method + +## 4.2.2 + +- Fixed [#180](https://github.com/PHP-DI/PHP-DI/pull/180): `Container::call()` with object methods (`[$object, 'method']`) is now supported + +## 4.2.1 + +- Support for PHP 5.3.3, which was previously incomplete because of a bug in the reflection (there is now a workaround for this bug) + +But if you can, seriously avoid this (really old) PHP version and upgrade. + +## 4.2 + +Read the [news entry](news/10-php-di-4-2-released.md). + +**Minor BC-break**: Optional parameters (that were not configured) were injected, they are now ignored, which is what naturally makes sense since they are optional. +Example: + +```php + public function __construct(Bar $bar = null) + { + $this->bar = $bar ?: $this->createDefaultBar(); + } +``` + +Before 4.2, PHP-DI would try to inject a `Bar` instance. From 4.2 and onwards, it will inject `null`. + +Of course, you can still explicitly define an injection for the optional parameters and that will work. + +All changes: + +* [#162](https://github.com/PHP-DI/PHP-DI/pull/162) Added `Container::call()` to call functions with dependency injection +* [#156](https://github.com/PHP-DI/PHP-DI/issues/156) Wildcards (`*`) in definitions +* [#164](https://github.com/PHP-DI/PHP-DI/issues/164) Prototype scope is now available for `factory()` definitions too +* FIXED [#168](https://github.com/PHP-DI/PHP-DI/pull/168) `Container::has()` now returns false for interfaces and abstract classes that are not mapped in the definitions +* FIXED [#171](https://github.com/PHP-DI/PHP-DI/issues/171) Optional parameters are now ignored (not injected) if not set in the definitions (see the BC-break warning above) + +## 4.1 + +Read the [news entry](news/09-php-di-4-1-released.md). + +BC-breaks: None. + +* [#138](https://github.com/PHP-DI/PHP-DI/issues/138) [Container-interop](https://github.com/container-interop/container-interop) compliance +* [#143](https://github.com/PHP-DI/PHP-DI/issues/143) Much more explicit exception messages +* [#157](https://github.com/PHP-DI/PHP-DI/issues/157) HHVM support +* [#158](https://github.com/PHP-DI/PHP-DI/issues/158) Improved the documentation for [Symfony 2 integration](http://php-di.org/doc/frameworks/symfony2.html) + +## 4.0 + +Major changes: + +* The configuration format has changed ([read more here to understand why](news/06-php-di-4-0-new-definitions.md)) + +Read the migration guide if you are using 3.x: [Migration guide from 3.x to 4.0](doc/migration/4.0.md). + +BC-breaks: + +* YAML, XML and JSON definitions have been removed, and the PHP definition format has changed (see above) +* `ContainerSingleton` has been removed +* You cannot configure an injection as lazy anymore, you can only configure a container entry as lazy +* The Container constructor now takes mandatory parameters. Use the ContainerBuilder to create a Container. +* Removed `ContainerBuilder::setDefinitionsValidation()` (no definition validation anymore) +* `ContainerBuilder::useReflection()` is now named: `ContainerBuilder::useAutowiring()` +* `ContainerBuilder::addDefinitionsFromFile()` is now named: `ContainerBuilder::addDefinitions()` +* The `$proxy` parameter in `Container::get($name, $proxy = true)` hase been removed. To get a proxy, you now need to define an entry as "lazy". + +Other changes: + +* Added `ContainerInterface` and `FactoryInterface`, both implemented by the container. +* [#115](https://github.com/PHP-DI/PHP-DI/issues/115) Added `Container::has()` +* [#142](https://github.com/PHP-DI/PHP-DI/issues/142) Added `Container::make()` to resolve an entry +* [#127](https://github.com/PHP-DI/PHP-DI/issues/127) Added support for cases where PHP-DI is wrapped by another container (like Acclimate): PHP-DI can now use the wrapping container to perform injections +* [#128](https://github.com/PHP-DI/PHP-DI/issues/128) Configure entry aliases +* [#110](https://github.com/PHP-DI/PHP-DI/issues/110) XML definitions are not supported anymore +* [#122](https://github.com/PHP-DI/PHP-DI/issues/122) JSON definitions are not supported anymore +* `ContainerSingleton` has finally been removed +* Added `ContainerBuilder::buildDevContainer()` to get started with a default container very easily. +* [#99](https://github.com/PHP-DI/PHP-DI/issues/99) Fixed "`@param` with PHP internal type throws exception" + +## 3.5.1 + +* FIXED [#126](https://github.com/PHP-DI/PHP-DI/issues/126): `Container::set` without effect if a value has already been set and retrieved + +## 3.5 + +Read the [news entry](news/05-php-di-3-5.md). + +* Importing `@Inject` and `@Injectable` annotations is now optional! It means that you don't have to write `use DI\Annotation\Inject` anymore +* FIXED [#124](https://github.com/PHP-DI/PHP-DI/issues/124): `@Injects` annotation conflicts with other annotations + +## 3.4 + +Read the [news entry](news/04-php-di-3-4.md). + +* [#106](https://github.com/PHP-DI/PHP-DI/pull/106) You can now define arrays of values (in YAML, PHP, …) thanks to [@unkind](https://github.com/unkind) +* [#98](https://github.com/PHP-DI/PHP-DI/issues/98) `ContainerBuilder` is now fluent thanks to [@drdamour](https://github.com/drdamour) +* [#101](https://github.com/PHP-DI/PHP-DI/pull/101) Optional parameters are now supported: if you don't define a value to inject, their default value will be used +* XML definitions have been deprecated, there weren't even documented and were not maintained. They will be removed in 4.0. +* FIXED [#100](https://github.com/PHP-DI/PHP-DI/issues/100): bug for lazy injection in constructors + +## 3.3 + +Read the [news entry](news/03-php-di-3-3.md). + +* Inject dependencies on an existing instance with `Container::injectOn` (work from [Jeff Flitton](https://github.com/jflitton): [#89](https://github.com/PHP-DI/PHP-DI/pull/89)). +* [#86](https://github.com/PHP-DI/PHP-DI/issues/86): Optimized definition lookup (faster) +* FIXED [#87](https://github.com/PHP-DI/PHP-DI/issues/87): Rare bug in the `PhpDocParser`, fixed by [drdamour](https://github.com/drdamour) + +## 3.2 + +Read the [news entry](news/02-php-di-3-2.md). + +Small BC-break: PHP-DI 3.0 and 3.1 injected properties before calling the constructor. This was confusing and [not supported for internal classes](https://github.com/PHP-DI/PHP-DI/issues/74). +From 3.2 and on, properties are injected after calling the constructor. + +* **[Lazy injection](doc/lazy-injection.md)**: it is now possible to use lazy injection on properties and methods (setters and constructors). +* Lazy dependencies are now proxies that extend the class they proxy, so type-hinting works. +* Addition of the **`ContainerBuilder`** object, that helps to [create and configure a `Container`](doc/container-configuration.md). +* Some methods for configuring the Container have gone **deprecated** in favor of the `ContainerBuilder`. Fear not, these deprecated methods will remain until next major version (4.0). + * `Container::useReflection`, use ContainerBuilder::useReflection instead + * `Container::useAnnotations`, use ContainerBuilder::useAnnotations instead + * `Container::setDefinitionCache`, use ContainerBuilder::setDefinitionCache instead + * `Container::setDefinitionsValidation`, use ContainerBuilder::setDefinitionsValidation instead +* The container is now auto-registered (as 'DI\Container'). You can now inject the container without registering it. + +## 3.1.1 + +* Value definitions (`$container->set('foo', 80)`) are not cached anymore +* FIXED [#82](https://github.com/PHP-DI/PHP-DI/issues/82): Serialization error when using a cache + +## 3.1 + +Read the [news entry](news/01-php-di-3-1.md). + +* Zend Framework 1 integration through the [PHP-DI-ZF1 project](https://github.com/PHP-DI/PHP-DI-ZF1) +* Fixed the order of priorities when you mix different definition sources (reflection, annotations, files, …). See [Definition overriding](doc/definition-overriding.md) +* Now possible to define null values with `$container->set('foo', null)` (see [#79](https://github.com/PHP-DI/PHP-DI/issues/79)). +* Deprecated usage of `ContainerSingleton`, will be removed in next major version (4.0) + +## 3.0.6 + +* FIXED [#76](https://github.com/PHP-DI/PHP-DI/issues/76): Definition conflict when setting a closure for a class name + +## 3.0.5 + +* FIXED [#70](https://github.com/PHP-DI/PHP-DI/issues/70): Definition conflict when setting a value for a class name + +## 3.0.4 + +* FIXED [#69](https://github.com/PHP-DI/PHP-DI/issues/69): YamlDefinitionFileLoader crashes if YAML file is empty + +## 3.0.3 + +* Fixed over-restrictive dependencies in composer.json + +## 3.0.2 + +* [#64](https://github.com/PHP-DI/PHP-DI/issues/64): Non PHP-DI exceptions are not captured-rethrown anymore when injecting dependencies (cleaner stack trace) + +## 3.0.1 + +* [#62](https://github.com/PHP-DI/PHP-DI/issues/62): When using aliases, definitions are now merged + +## 3.0 + +Major compatibility breaks with 2.x. + +* The container is no longer a Singleton (but `ContainerSingleton::getInstance()` is available for fools who like it) +* Setter injection +* Constructor injection +* Scopes: singleton (share the same instance of the class) or prototype (create a new instance each time it is fetched). Defined at class level. +* Configuration is reworked from scratch. Now every configuration backend can do 100% of the job. +* Provided configuration backends: + * Reflection + * Annotations: @Inject, @Injectable + * PHP code (`Container::set()`) + * PHP array + * YAML file +* As a consequence, annotations are not mandatory anymore, all functionalities can be used with or without annotations. +* Renamed `DI\Annotations\` to `DI\Annotation\` +* `Container` no longer implements ArrayAccess, use only `$container->get($key)` now +* ZF1 integration broken and removed (work in progress for next releases) +* Code now follows PSR1 and PSR2 coding styles +* FIXED: [#58](https://github.com/PHP-DI/PHP-DI/issues/58) Getting a proxy of an alias didn't work + +## 2.1 + +* `use` statements to import classes from other namespaces are now taken into account with the `@var` annotation +* Updated and lightened the dependencies : `doctrine/common` has been replaced with more specific `doctrine/annotations` and `doctrine/cache` + +## 2.0 + +Major compatibility breaks with 1.x. + +* `Container::resolveDependencies()` has been renamed to `Container::injectAll()` +* Dependencies are now injected **before** the constructor is called, and thus are available in the constructor +* Merged `@Value` annotation with `@Inject`: no difference between value and bean injection anymore +* Container implements ArrayAccess for get() and set() (`$container['db.host'] = 'localhost';`) +* Ini configuration files removed: configuration is done in PHP +* Allow to define beans within closures for lazy-loading +* Switched to MIT License + +Warning: + +* If you use PHP 5.3 and __wakeup() methods, they will be called when PHP-DI creates new instances of those classes. + +## 1.1 + +* Caching of annotations based on Doctrine caches + +## 1.0 + +* DependencyManager renamed to Container +* Refactored basic Container usage with `get` and `set` +* Allow named injection `@Inject(name="")` +* Zend Framework integration diff --git a/vendor/php-di/php-di/composer.json b/vendor/php-di/php-di/composer.json new file mode 100644 index 0000000..0f22f9c --- /dev/null +++ b/vendor/php-di/php-di/composer.json @@ -0,0 +1,52 @@ +{ + "name": "php-di/php-di", + "type": "library", + "description": "The dependency injection container for humans", + "keywords": ["di", "dependency injection", "container"], + "homepage": "http://php-di.org/", + "license": "MIT", + "autoload": { + "psr-4": { + "DI\\": "src/DI/" + }, + "files": [ + "src/DI/functions.php" + ] + }, + "autoload-dev": { + "psr-4": { + "DI\\Test\\IntegrationTest\\": "tests/IntegrationTest/", + "DI\\Test\\UnitTest\\": "tests/UnitTest/" + } + }, + "scripts": { + "test": "phpunit" + }, + "require": { + "php": ">=5.5.0", + "container-interop/container-interop": "~1.2", + "psr/container": "~1.0", + "php-di/invoker": "^1.3.2", + "php-di/phpdoc-reader": "^2.0.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.5", + "mnapoli/phpunit-easymock": "~0.2.0", + "doctrine/cache": "~1.4", + "doctrine/annotations": "~1.2", + "phpbench/phpbench": "@dev", + "ocramius/proxy-manager": "~1.0|~2.0" + }, + "replace": { + "mnapoli/php-di": "*" + }, + "provide": { + "container-interop/container-interop-implementation": "^1.0", + "psr/container-implementation": "^1.0" + }, + "suggest": { + "doctrine/cache": "Install it if you want to use the cache (version ~1.4)", + "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~1.0 or ~2.0)" + } +} diff --git a/vendor/php-di/php-di/couscous.yml b/vendor/php-di/php-di/couscous.yml new file mode 100644 index 0000000..c355307 --- /dev/null +++ b/vendor/php-di/php-di/couscous.yml @@ -0,0 +1,134 @@ +baseUrl: http://php-di.org + +scripts: + before: + - lessc --clean-css website/less/main.less website/css/all.min.css + +exclude: + - vendor + - website + - src + - tests + - logo + +menu: + items: + introduction: + section: Introduction + items: + getting-started: + text: Getting started + url: doc/getting-started.html + understanding-di: + text: Understanding dependency injection + url: doc/understanding-di.html + best-practices: + text: "\"Best practices\" guide" + url: doc/best-practices.html + usage: + section: Usage + items: + container-configuration: + text: Configuring the container + url: doc/container-configuration.html + container: + text: Using the container + url: doc/container.html + definition: + section: Definitions + items: + definition-introduction: + text: Introduction + url: doc/definition.html + autowiring: + text: Autowiring + url: doc/autowiring.html + php-definitions: + text: PHP definitions + url: doc/php-definitions.html + annotations: + text: Annotations + url: doc/annotations.html + definition-overriding: + text: Definition extensions and overriding + url: doc/definition-overriding.html + frameworks: + section: Frameworks + items: + symfony: + text: Symfony + url: doc/frameworks/symfony2.html + silex: + text: Silex + url: doc/frameworks/silex.html + zf2: + text: Zend Framework 2 + url: doc/frameworks/zf2.html + zf1: + text: Zend Framework 1 + url: doc/frameworks/zf1.html + slim: + text: Slim + url: doc/frameworks/slim.html + silly: + text: Silly + url: doc/frameworks/silly.html + demo: + text: Demo application + absoluteUrl: https://github.com/PHP-DI/demo + advanced: + section: Advanced topics + items: + performances: + text: Performances + url: doc/performances.html + scopes: + text: Scopes + url: doc/scopes.html + lazy-injection: + text: Lazy injection + url: doc/lazy-injection.html + inject-on-instance: + text: Inject on an existing instance + url: doc/inject-on-instance.html + environments: + text: Injections depending on the environment + url: doc/environments.html + ide-integration: + text: IDE integration + url: doc/ide-integration.html + migration: + section: Migration guides + items: + v4: + text: From PHP-DI 3.x to 4.0 + url: doc/migration/4.0.html + v5: + text: From PHP-DI 4.x to 5.0 + url: doc/migration/5.0.html + internals: + section: Internals + items: + contributing: + text: Contributing + url: contributing.html + how-it-works: + text: How PHP-DI works + url: doc/how-it-works.html + versions: + section: Old documentation + items: + v3: + text: PHP-DI 3.x + absoluteUrl: https://github.com/PHP-DI/PHP-DI/tree/3.x/doc + v4: + text: PHP-DI 4.x + absoluteUrl: https://github.com/PHP-DI/PHP-DI/tree/4.x/doc + +frameworks: + zf1: Zend Framework 1 + zf2: Zend Framework 2 + symfony2: Symfony + silex: Silex + slim: Slim + silly: Silly diff --git a/vendor/php-di/php-di/phpbench.json b/vendor/php-di/php-di/phpbench.json new file mode 100644 index 0000000..466f9e5 --- /dev/null +++ b/vendor/php-di/php-di/phpbench.json @@ -0,0 +1,3 @@ +{ + "bootstrap": "vendor/autoload.php" +} \ No newline at end of file diff --git a/vendor/php-di/php-di/phpunit.xml.dist b/vendor/php-di/php-di/phpunit.xml.dist new file mode 100644 index 0000000..81c7f73 --- /dev/null +++ b/vendor/php-di/php-di/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + + ./tests/UnitTest/ + + + ./tests/IntegrationTest/ + + + + + + src + + + + diff --git a/vendor/php-di/php-di/src/DI/Annotation/Inject.php b/vendor/php-di/php-di/src/DI/Annotation/Inject.php new file mode 100644 index 0000000..9b695ee --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Annotation/Inject.php @@ -0,0 +1,90 @@ + + */ +final class Inject +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * Parameters, indexed by the parameter number (index) or name. + * + * Used if the annotation is set on a method + * @var array + */ + private $parameters = []; + + /** + * @param array $values + * @throws AnnotationException + */ + public function __construct(array $values) + { + // Process the parameters as a list AND as a parameter array (we don't know on what the annotation is) + + // @Inject(name="foo") + if (isset($values['name']) && is_string($values['name'])) { + $this->name = $values['name']; + + return; + } + + // @Inject + if (! isset($values['value'])) { + return; + } + + $values = $values['value']; + + // @Inject("foo") + if (is_string($values)) { + $this->name = $values; + } + + // @Inject({...}) on a method + if (is_array($values)) { + foreach ($values as $key => $value) { + if (! is_string($value)) { + throw new AnnotationException(sprintf( + '@Inject({"param" = "value"}) expects "value" to be a string, %s given.', + json_encode($value) + )); + } + + $this->parameters[$key] = $value; + } + } + } + + /** + * @return string Name of the entry to inject + */ + public function getName() + { + return $this->name; + } + + /** + * @return array Parameters, indexed by the parameter number (index) or name + */ + public function getParameters() + { + return $this->parameters; + } +} diff --git a/vendor/php-di/php-di/src/DI/Annotation/Injectable.php b/vendor/php-di/php-di/src/DI/Annotation/Injectable.php new file mode 100644 index 0000000..1d256be --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Annotation/Injectable.php @@ -0,0 +1,67 @@ + + * @author Matthieu Napoli + */ +final class Injectable +{ + /** + * The scope of an class: prototype, singleton. + * @var string|null + */ + private $scope; + + /** + * Should the object be lazy-loaded. + * @var bool|null + */ + private $lazy; + + /** + * @param array $values + */ + public function __construct(array $values) + { + if (isset($values['scope'])) { + if ($values['scope'] === 'prototype') { + $this->scope = Scope::PROTOTYPE; + } elseif ($values['scope'] === 'singleton') { + $this->scope = Scope::SINGLETON; + } else { + throw new UnexpectedValueException(sprintf("Value '%s' is not a valid scope", $values['scope'])); + } + } + if (isset($values['lazy'])) { + $this->lazy = (bool) $values['lazy']; + } + } + + /** + * @return string|null + */ + public function getScope() + { + return $this->scope; + } + + /** + * @return bool|null + */ + public function isLazy() + { + return $this->lazy; + } +} diff --git a/vendor/php-di/php-di/src/DI/Cache/ArrayCache.php b/vendor/php-di/php-di/src/DI/Cache/ArrayCache.php new file mode 100644 index 0000000..37074b6 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Cache/ArrayCache.php @@ -0,0 +1,72 @@ + + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author David Abdemoulaie + */ +class ArrayCache implements Cache, FlushableCache, ClearableCache +{ + /** + * @var array + */ + private $data = []; + + public function fetch($id) + { + return $this->contains($id) ? $this->data[$id] : false; + } + + public function contains($id) + { + // isset() is required for performance optimizations, to avoid unnecessary function calls to array_key_exists. + return isset($this->data[$id]) || array_key_exists($id, $this->data); + } + + public function save($id, $data, $lifeTime = 0) + { + $this->data[$id] = $data; + + return true; + } + + public function delete($id) + { + unset($this->data[$id]); + + return true; + } + + public function getStats() + { + return null; + } + + public function flushAll() + { + $this->data = []; + + return true; + } + + public function deleteAll() + { + return $this->flushAll(); + } +} diff --git a/vendor/php-di/php-di/src/DI/Container.php b/vendor/php-di/php-di/src/DI/Container.php new file mode 100644 index 0000000..4c73d83 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Container.php @@ -0,0 +1,354 @@ + + */ +class Container implements ContainerInterface, InteropContainerInterface, FactoryInterface, \DI\InvokerInterface +{ + /** + * Map of entries with Singleton scope that are already resolved. + * @var array + */ + private $singletonEntries = []; + + /** + * @var DefinitionSource + */ + private $definitionSource; + + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * Map of definitions that are already looked up. + * + * @var array + */ + private $definitionCache = []; + + /** + * Array of entries being resolved. Used to avoid circular dependencies and infinite loops. + * @var array + */ + private $entriesBeingResolved = []; + + /** + * @var \Invoker\InvokerInterface|null + */ + private $invoker; + + /** + * Container that wraps this container. If none, points to $this. + * + * @var ContainerInterface + */ + private $wrapperContainer; + + /** + * Use the ContainerBuilder to ease constructing the Container. + * + * @see ContainerBuilder + * + * @param DefinitionSource $definitionSource + * @param ProxyFactory $proxyFactory + * @param ContainerInterface $wrapperContainer If the container is wrapped by another container. + */ + public function __construct( + DefinitionSource $definitionSource, + ProxyFactory $proxyFactory, + ContainerInterface $wrapperContainer = null + ) { + $this->wrapperContainer = $wrapperContainer ?: $this; + + $this->definitionSource = $definitionSource; + $this->definitionResolver = new ResolverDispatcher($this->wrapperContainer, $proxyFactory); + + // Auto-register the container + $this->singletonEntries[self::class] = $this; + $this->singletonEntries[FactoryInterface::class] = $this; + $this->singletonEntries[InvokerInterface::class] = $this; + $this->singletonEntries[ContainerInterface::class] = $this; + } + + /** + * Returns an entry of the container by its name. + * + * @param string $name Entry name or a class name. + * + * @throws InvalidArgumentException The name parameter must be of type string. + * @throws DependencyException Error while resolving the entry. + * @throws NotFoundException No entry found for the given name. + * @return mixed + */ + public function get($name) + { + if (! is_string($name)) { + throw new InvalidArgumentException(sprintf( + 'The name parameter must be of type string, %s given', + is_object($name) ? get_class($name) : gettype($name) + )); + } + + // Try to find the entry in the singleton map + if (array_key_exists($name, $this->singletonEntries)) { + return $this->singletonEntries[$name]; + } + + $definition = $this->getDefinition($name); + if (! $definition) { + throw new NotFoundException("No entry or class found for '$name'"); + } + + $value = $this->resolveDefinition($definition); + + // If the entry is singleton, we store it to always return it without recomputing it + if ($definition->getScope() === Scope::SINGLETON) { + $this->singletonEntries[$name] = $value; + } + + return $value; + } + + private function getDefinition($name) + { + if(!array_key_exists($name, $this->definitionCache)){ + $this->definitionCache[$name] = $this->definitionSource->getDefinition($name); + } + + return $this->definitionCache[$name]; + } + + /** + * Build an entry of the container by its name. + * + * This method behave like get() except it forces the scope to "prototype", + * which means the definition of the entry will be re-evaluated each time. + * For example, if the entry is a class, then a new instance will be created each time. + * + * This method makes the container behave like a factory. + * + * @param string $name Entry name or a class name. + * @param array $parameters Optional parameters to use to build the entry. Use this to force specific parameters + * to specific values. Parameters not defined in this array will be resolved using + * the container. + * + * @throws InvalidArgumentException The name parameter must be of type string. + * @throws DependencyException Error while resolving the entry. + * @throws NotFoundException No entry found for the given name. + * @return mixed + */ + public function make($name, array $parameters = []) + { + if (! is_string($name)) { + throw new InvalidArgumentException(sprintf( + 'The name parameter must be of type string, %s given', + is_object($name) ? get_class($name) : gettype($name) + )); + } + + $definition = $this->getDefinition($name); + if (! $definition) { + // Try to find the entry in the singleton map + if (array_key_exists($name, $this->singletonEntries)) { + return $this->singletonEntries[$name]; + } + + throw new NotFoundException("No entry or class found for '$name'"); + } + + return $this->resolveDefinition($definition, $parameters); + } + + /** + * Test if the container can provide something for the given name. + * + * @param string $name Entry name or a class name. + * + * @throws InvalidArgumentException The name parameter must be of type string. + * @return bool + */ + public function has($name) + { + if (! is_string($name)) { + throw new InvalidArgumentException(sprintf( + 'The name parameter must be of type string, %s given', + is_object($name) ? get_class($name) : gettype($name) + )); + } + + if (array_key_exists($name, $this->singletonEntries)) { + return true; + } + + $definition = $this->getDefinition($name); + if ($definition === null) { + return false; + } + + return $this->definitionResolver->isResolvable($definition); + } + + /** + * Inject all dependencies on an existing instance. + * + * @param object $instance Object to perform injection upon + * @throws InvalidArgumentException + * @throws DependencyException Error while injecting dependencies + * @return object $instance Returns the same instance + */ + public function injectOn($instance) + { + $objectDefinition = $this->definitionSource->getDefinition(get_class($instance)); + if (! $objectDefinition instanceof ObjectDefinition) { + return $instance; + } + + $definition = new InstanceDefinition($instance, $objectDefinition); + + $this->definitionResolver->resolve($definition); + + return $instance; + } + + /** + * Call the given function using the given parameters. + * + * Missing parameters will be resolved from the container. + * + * @param callable $callable Function to call. + * @param array $parameters Parameters to use. Can be indexed by the parameter names + * or not indexed (same order as the parameters). + * The array can also contain DI definitions, e.g. DI\get(). + * + * @return mixed Result of the function. + */ + public function call($callable, array $parameters = []) + { + return $this->getInvoker()->call($callable, $parameters); + } + + /** + * Define an object or a value in the container. + * + * @param string $name Entry name + * @param mixed|DefinitionHelper $value Value, use definition helpers to define objects + */ + public function set($name, $value) + { + if ($value instanceof DefinitionHelper) { + $value = $value->getDefinition($name); + } elseif ($value instanceof \Closure) { + $value = new FactoryDefinition($name, $value); + } + + if ($value instanceof Definition) { + $this->setDefinition($name, $value); + } else { + $this->singletonEntries[$name] = $value; + } + } + + /** + * Resolves a definition. + * + * Checks for circular dependencies while resolving the definition. + * + * @param Definition $definition + * @param array $parameters + * + * @throws DependencyException Error while resolving the entry. + * @return mixed + */ + private function resolveDefinition(Definition $definition, array $parameters = []) + { + $entryName = $definition->getName(); + + // Check if we are already getting this entry -> circular dependency + if (isset($this->entriesBeingResolved[$entryName])) { + throw new DependencyException("Circular dependency detected while trying to resolve entry '$entryName'"); + } + $this->entriesBeingResolved[$entryName] = true; + + // Resolve the definition + try { + $value = $this->definitionResolver->resolve($definition, $parameters); + } catch (Exception $exception) { + unset($this->entriesBeingResolved[$entryName]); + throw $exception; + } + + unset($this->entriesBeingResolved[$entryName]); + + return $value; + } + + private function setDefinition($name, Definition $definition) + { + if ($this->definitionSource instanceof CachedDefinitionSource) { + throw new \LogicException('You cannot set a definition at runtime on a container that has a cache configured. Doing so would risk caching the definition for the next execution, where it might be different. You can either put your definitions in a file, remove the cache or ->set() a raw value directly (PHP object, string, int, ...) instead of a PHP-DI definition.'); + } + + if (! $this->definitionSource instanceof MutableDefinitionSource) { + // This can happen if you instantiate the container yourself + throw new \LogicException('The container has not been initialized correctly'); + } + + $this->definitionCache = []; //Completely clear definitionCache + + // Clear existing entries if it exists + if (array_key_exists($name, $this->singletonEntries)) { + unset($this->singletonEntries[$name]); + } + + $this->definitionSource->addDefinition($definition); + } + + /** + * @return \Invoker\InvokerInterface + */ + private function getInvoker() + { + if (! $this->invoker) { + $parameterResolver = new ResolverChain([ + new DefinitionParameterResolver($this->definitionResolver), + new NumericArrayResolver, + new AssociativeArrayResolver, + new DefaultValueResolver, + new TypeHintContainerResolver($this->wrapperContainer), + ]); + + $this->invoker = new Invoker($parameterResolver, $this); + } + + return $this->invoker; + } +} diff --git a/vendor/php-di/php-di/src/DI/ContainerBuilder.php b/vendor/php-di/php-di/src/DI/ContainerBuilder.php new file mode 100644 index 0000000..100055a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/ContainerBuilder.php @@ -0,0 +1,284 @@ +build(); + * + * @since 3.2 + * @author Matthieu Napoli + */ +class ContainerBuilder +{ + /** + * Name of the container class, used to create the container. + * @var string + */ + private $containerClass; + + /** + * @var bool + */ + private $useAutowiring = true; + + /** + * @var bool + */ + private $useAnnotations = false; + + /** + * @var bool + */ + private $ignorePhpDocErrors = false; + + /** + * @var Cache + */ + private $cache; + + /** + * If true, write the proxies to disk to improve performances. + * @var bool + */ + private $writeProxiesToFile = false; + + /** + * Directory where to write the proxies (if $writeProxiesToFile is enabled). + * @var string + */ + private $proxyDirectory; + + /** + * If PHP-DI is wrapped in another container, this references the wrapper. + * @var ContainerInterface + */ + private $wrapperContainer; + + /** + * @var DefinitionSource[] + */ + private $definitionSources = []; + + /** + * Whether the container has already been built. + * @var bool + */ + private $locked = false; + + /** + * Build a container configured for the dev environment. + * + * @return Container + */ + public static function buildDevContainer() + { + $builder = new self(); + + return $builder->build(); + } + + /** + * @param string $containerClass Name of the container class, used to create the container. + */ + public function __construct($containerClass = 'DI\Container') + { + $this->containerClass = $containerClass; + } + + /** + * Build and return a container. + * + * @return Container + */ + public function build() + { + $sources = array_reverse($this->definitionSources); + if ($this->useAnnotations) { + $sources[] = new AnnotationReader($this->ignorePhpDocErrors); + } elseif ($this->useAutowiring) { + $sources[] = new Autowiring(); + } + + $chain = new SourceChain($sources); + + if ($this->cache) { + $source = new CachedDefinitionSource($chain, $this->cache); + $chain->setRootDefinitionSource($source); + } else { + $source = $chain; + // Mutable definition source + $source->setMutableDefinitionSource(new DefinitionArray()); + } + + $proxyFactory = new ProxyFactory($this->writeProxiesToFile, $this->proxyDirectory); + + $this->locked = true; + + $containerClass = $this->containerClass; + + return new $containerClass($source, $proxyFactory, $this->wrapperContainer); + } + + /** + * Enable or disable the use of autowiring to guess injections. + * + * Enabled by default. + * + * @param bool $bool + * @return ContainerBuilder + */ + public function useAutowiring($bool) + { + $this->ensureNotLocked(); + + $this->useAutowiring = $bool; + + return $this; + } + + /** + * Enable or disable the use of annotations to guess injections. + * + * Disabled by default. + * + * @param bool $bool + * @return ContainerBuilder + */ + public function useAnnotations($bool) + { + $this->ensureNotLocked(); + + $this->useAnnotations = $bool; + + return $this; + } + + /** + * Enable or disable ignoring phpdoc errors (non-existent classes in `@param` or `@var`). + * + * @param bool $bool + * @return ContainerBuilder + */ + public function ignorePhpDocErrors($bool) + { + $this->ensureNotLocked(); + + $this->ignorePhpDocErrors = $bool; + + return $this; + } + + /** + * Enables the use of a cache for the definitions. + * + * @param Cache $cache Cache backend to use + * @return ContainerBuilder + */ + public function setDefinitionCache(Cache $cache) + { + $this->ensureNotLocked(); + + $this->cache = $cache; + + return $this; + } + + /** + * Configure the proxy generation. + * + * For dev environment, use writeProxiesToFile(false) (default configuration) + * For production environment, use writeProxiesToFile(true, 'tmp/proxies') + * + * @param bool $writeToFile If true, write the proxies to disk to improve performances + * @param string|null $proxyDirectory Directory where to write the proxies + * @throws InvalidArgumentException when writeToFile is set to true and the proxy directory is null + * @return ContainerBuilder + */ + public function writeProxiesToFile($writeToFile, $proxyDirectory = null) + { + $this->ensureNotLocked(); + + $this->writeProxiesToFile = $writeToFile; + + if ($writeToFile && $proxyDirectory === null) { + throw new InvalidArgumentException( + 'The proxy directory must be specified if you want to write proxies on disk' + ); + } + $this->proxyDirectory = $proxyDirectory; + + return $this; + } + + /** + * If PHP-DI's container is wrapped by another container, we can + * set this so that PHP-DI will use the wrapper rather than itself for building objects. + * + * @param ContainerInterface $otherContainer + * @return $this + */ + public function wrapContainer(ContainerInterface $otherContainer) + { + $this->ensureNotLocked(); + + $this->wrapperContainer = $otherContainer; + + return $this; + } + + /** + * Add definitions to the container. + * + * @param string|array|DefinitionSource $definitions Can be an array of definitions, the + * name of a file containing definitions + * or a DefinitionSource object. + * @return $this + */ + public function addDefinitions($definitions) + { + $this->ensureNotLocked(); + + if (is_string($definitions)) { + // File + $definitions = new DefinitionFile($definitions); + } elseif (is_array($definitions)) { + $definitions = new DefinitionArray($definitions); + } elseif (! $definitions instanceof DefinitionSource) { + throw new InvalidArgumentException(sprintf( + '%s parameter must be a string, an array or a DefinitionSource object, %s given', + 'ContainerBuilder::addDefinitions()', + is_object($definitions) ? get_class($definitions) : gettype($definitions) + )); + } + + $this->definitionSources[] = $definitions; + + return $this; + } + + private function ensureNotLocked() + { + if ($this->locked) { + throw new \LogicException('The ContainerBuilder cannot be modified after the container has been built'); + } + } +} diff --git a/vendor/php-di/php-di/src/DI/Debug.php b/vendor/php-di/php-di/src/DI/Debug.php new file mode 100644 index 0000000..4f49c01 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Debug.php @@ -0,0 +1,26 @@ + + */ +class Debug +{ + /** + * Dump the definition to a string. + * + * @return string + * + * @deprecated You should cast the definition to string instead. + * This feature was simplified: definitions can be cast to string directly. + */ + public static function dumpDefinition(Definition $definition) + { + return (string) $definition; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/AliasDefinition.php b/vendor/php-di/php-di/src/DI/Definition/AliasDefinition.php new file mode 100644 index 0000000..66fbe2f --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/AliasDefinition.php @@ -0,0 +1,78 @@ + + */ +class AliasDefinition implements CacheableDefinition, SelfResolvingDefinition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * Name of the target entry. + * @var string + */ + private $targetEntryName; + + /** + * @param string $name Entry name + * @param string $targetEntryName Name of the target entry + */ + public function __construct($name, $targetEntryName) + { + $this->name = $name; + $this->targetEntryName = $targetEntryName; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return Scope::PROTOTYPE; + } + + /** + * @return string + */ + public function getTargetEntryName() + { + return $this->targetEntryName; + } + + public function resolve(ContainerInterface $container) + { + return $container->get($this->getTargetEntryName()); + } + + public function isResolvable(ContainerInterface $container) + { + return $container->has($this->getTargetEntryName()); + } + + public function __toString() + { + return sprintf( + 'get(%s)', + $this->targetEntryName + ); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ArrayDefinition.php b/vendor/php-di/php-di/src/DI/Definition/ArrayDefinition.php new file mode 100644 index 0000000..98d6deb --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ArrayDefinition.php @@ -0,0 +1,83 @@ + + */ +class ArrayDefinition implements Definition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * @var array + */ + private $values; + + /** + * @param string $name Entry name + * @param array $values + */ + public function __construct($name, array $values) + { + $this->name = $name; + $this->values = $values; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return Scope::SINGLETON; + } + + /** + * @return array + */ + public function getValues() + { + return $this->values; + } + + public function __toString() + { + $str = '[' . PHP_EOL; + + foreach ($this->values as $key => $value) { + if (is_string($key)) { + $key = "'" . $key . "'"; + } + + $str .= ' ' . $key . ' => '; + + if ($value instanceof DefinitionHelper) { + $str .= str_replace(PHP_EOL, PHP_EOL . ' ', $value->getDefinition('')); + } else { + $str .= var_export($value, true); + } + + $str .= ',' . PHP_EOL; + } + + return $str . ']'; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ArrayDefinitionExtension.php b/vendor/php-di/php-di/src/DI/Definition/ArrayDefinitionExtension.php new file mode 100644 index 0000000..2ee30ff --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ArrayDefinitionExtension.php @@ -0,0 +1,54 @@ + + */ +class ArrayDefinitionExtension extends ArrayDefinition implements HasSubDefinition +{ + /** + * @var ArrayDefinition + */ + private $subDefinition; + + /** + * {@inheritdoc} + */ + public function getValues() + { + if (! $this->subDefinition) { + return parent::getValues(); + } + + return array_merge($this->subDefinition->getValues(), parent::getValues()); + } + + /** + * @return string + */ + public function getSubDefinitionName() + { + return $this->getName(); + } + + /** + * {@inheritdoc} + */ + public function setSubDefinition(Definition $definition) + { + if (! $definition instanceof ArrayDefinition) { + throw new DefinitionException(sprintf( + 'Definition %s tries to add array entries but the previous definition is not an array', + $this->getName() + )); + } + + $this->subDefinition = $definition; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/CacheableDefinition.php b/vendor/php-di/php-di/src/DI/Definition/CacheableDefinition.php new file mode 100644 index 0000000..154867b --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/CacheableDefinition.php @@ -0,0 +1,12 @@ + + */ +interface CacheableDefinition extends Definition +{ +} diff --git a/vendor/php-di/php-di/src/DI/Definition/DecoratorDefinition.php b/vendor/php-di/php-di/src/DI/Definition/DecoratorDefinition.php new file mode 100644 index 0000000..48b8c39 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/DecoratorDefinition.php @@ -0,0 +1,46 @@ + + */ +class DecoratorDefinition extends FactoryDefinition implements Definition, HasSubDefinition +{ + /** + * @var Definition + */ + private $decorated; + + /** + * @return string + */ + public function getSubDefinitionName() + { + return $this->getName(); + } + + /** + * @param Definition $definition + */ + public function setSubDefinition(Definition $definition) + { + $this->decorated = $definition; + } + + /** + * @return Definition + */ + public function getDecoratedDefinition() + { + return $this->decorated; + } + + public function __toString() + { + return 'Decorate(' . $this->getSubDefinitionName() . ')'; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Definition.php b/vendor/php-di/php-di/src/DI/Definition/Definition.php new file mode 100644 index 0000000..fd51ec8 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Definition.php @@ -0,0 +1,35 @@ + + */ +interface Definition extends RequestedEntry +{ + /** + * Returns the name of the entry in the container. + * + * @return string + */ + public function getName(); + + /** + * Returns the scope of the entry. + * + * @return string + */ + public function getScope(); + + /** + * Definitions can be cast to string for debugging information. + * + * This method is not enforced by the interface yet for backward + * compatibility. + */ + // public function __toString(); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Dumper/ObjectDefinitionDumper.php b/vendor/php-di/php-di/src/DI/Definition/Dumper/ObjectDefinitionDumper.php new file mode 100644 index 0000000..fc1e135 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Dumper/ObjectDefinitionDumper.php @@ -0,0 +1,144 @@ + + */ +class ObjectDefinitionDumper +{ + /** + * Returns the definition as string representation. + * + * @return string + */ + public function dump(ObjectDefinition $definition) + { + $className = $definition->getClassName(); + $classExist = class_exists($className) || interface_exists($className); + + // Class + if (! $classExist) { + $warning = '#UNKNOWN# '; + } else { + $class = new \ReflectionClass($className); + $warning = $class->isInstantiable() ? '' : '#NOT INSTANTIABLE# '; + } + $str = sprintf(' class = %s%s', $warning, $className); + + // Scope + $str .= PHP_EOL . ' scope = ' . $definition->getScope(); + + // Lazy + $str .= PHP_EOL . ' lazy = ' . var_export($definition->isLazy(), true); + + if ($classExist) { + // Constructor + $str .= $this->dumpConstructor($className, $definition); + + // Properties + $str .= $this->dumpProperties($definition); + + // Methods + $str .= $this->dumpMethods($className, $definition); + } + + return sprintf('Object (' . PHP_EOL . '%s' . PHP_EOL . ')', $str); + } + + private function dumpConstructor($className, ObjectDefinition $definition) + { + $str = ''; + + $constructorInjection = $definition->getConstructorInjection(); + + if ($constructorInjection !== null) { + $parameters = $this->dumpMethodParameters($className, $constructorInjection); + + $str .= sprintf(PHP_EOL . ' __construct(' . PHP_EOL . ' %s' . PHP_EOL . ' )', $parameters); + } + + return $str; + } + + private function dumpProperties(ObjectDefinition $definition) + { + $str = ''; + + foreach ($definition->getPropertyInjections() as $propertyInjection) { + $value = $propertyInjection->getValue(); + if ($value instanceof EntryReference) { + $valueStr = sprintf('get(%s)', $value->getName()); + } else { + $valueStr = var_export($value, true); + } + + $str .= sprintf(PHP_EOL . ' $%s = %s', $propertyInjection->getPropertyName(), $valueStr); + } + + return $str; + } + + private function dumpMethods($className, ObjectDefinition $definition) + { + $str = ''; + + foreach ($definition->getMethodInjections() as $methodInjection) { + $parameters = $this->dumpMethodParameters($className, $methodInjection); + + $str .= sprintf(PHP_EOL . ' %s(' . PHP_EOL . ' %s' . PHP_EOL . ' )', $methodInjection->getMethodName(), $parameters); + } + + return $str; + } + + private function dumpMethodParameters($className, MethodInjection $methodInjection) + { + $methodReflection = new \ReflectionMethod($className, $methodInjection->getMethodName()); + + $args = []; + + $definitionParameters = $methodInjection->getParameters(); + + foreach ($methodReflection->getParameters() as $index => $parameter) { + if (array_key_exists($index, $definitionParameters)) { + $value = $definitionParameters[$index]; + + if ($value instanceof EntryReference) { + $args[] = sprintf('$%s = get(%s)', $parameter->getName(), $value->getName()); + } else { + $args[] = sprintf('$%s = %s', $parameter->getName(), var_export($value, true)); + } + continue; + } + + // If the parameter is optional and wasn't specified, we take its default value + if ($parameter->isOptional()) { + try { + $value = $parameter->getDefaultValue(); + + $args[] = sprintf( + '$%s = (default value) %s', + $parameter->getName(), + var_export($value, true) + ); + continue; + } catch (ReflectionException $e) { + // The default value can't be read through Reflection because it is a PHP internal class + } + } + + $args[] = sprintf('$%s = #UNDEFINED#', $parameter->getName()); + } + + return implode(PHP_EOL . ' ', $args); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/EntryReference.php b/vendor/php-di/php-di/src/DI/Definition/EntryReference.php new file mode 100644 index 0000000..3ae64de --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/EntryReference.php @@ -0,0 +1,45 @@ + + */ +class EntryReference implements DefinitionHelper +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * @param string $entryName Entry name + */ + public function __construct($entryName) + { + $this->name = $entryName; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getDefinition($entryName) + { + return new AliasDefinition($entryName, $this->name); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/EnvironmentVariableDefinition.php b/vendor/php-di/php-di/src/DI/Definition/EnvironmentVariableDefinition.php new file mode 100644 index 0000000..cee0f60 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/EnvironmentVariableDefinition.php @@ -0,0 +1,129 @@ + + */ +class EnvironmentVariableDefinition implements CacheableDefinition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * The name of the environment variable. + * @var string + */ + private $variableName; + + /** + * Whether or not the environment variable definition is optional. + * + * If true and the environment variable given by $variableName has not been + * defined, $defaultValue is used. + * + * @var bool + */ + private $isOptional; + + /** + * The default value to use if the environment variable is optional and not provided. + * @var mixed + */ + private $defaultValue; + + /** + * @var string|null + */ + private $scope; + + /** + * @param string $name Entry name + * @param string $variableName The name of the environment variable + * @param bool $isOptional Whether or not the environment variable definition is optional + * @param mixed $defaultValue The default value to use if the environment variable is optional and not provided + */ + public function __construct($name, $variableName, $isOptional = false, $defaultValue = null) + { + $this->name = $name; + $this->variableName = $variableName; + $this->isOptional = $isOptional; + $this->defaultValue = $defaultValue; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * @return string The name of the environment variable + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * @return bool Whether or not the environment variable definition is optional + */ + public function isOptional() + { + return $this->isOptional; + } + + /** + * @return mixed The default value to use if the environment variable is optional and not provided + */ + public function getDefaultValue() + { + return $this->defaultValue; + } + + /** + * @param string $scope + */ + public function setScope($scope) + { + $this->scope = $scope; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return $this->scope ?: Scope::SINGLETON; + } + + public function __toString() + { + $str = ' variable = ' . $this->variableName . PHP_EOL + . ' optional = ' . ($this->isOptional ? 'yes' : 'no'); + + if ($this->isOptional) { + if ($this->defaultValue instanceof DefinitionHelper) { + $nestedDefinition = (string) $this->defaultValue->getDefinition(''); + $defaultValueStr = str_replace(PHP_EOL, PHP_EOL . ' ', $nestedDefinition); + } else { + $defaultValueStr = var_export($this->defaultValue, true); + } + + $str .= PHP_EOL . ' default = ' . $defaultValueStr; + } + + return sprintf('Environment variable (' . PHP_EOL . '%s' . PHP_EOL . ')', $str); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Exception/AnnotationException.php b/vendor/php-di/php-di/src/DI/Definition/Exception/AnnotationException.php new file mode 100644 index 0000000..51bf59f --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Exception/AnnotationException.php @@ -0,0 +1,12 @@ + + */ +class AnnotationException extends DefinitionException +{ +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Exception/DefinitionException.php b/vendor/php-di/php-di/src/DI/Definition/Exception/DefinitionException.php new file mode 100644 index 0000000..1289e4a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Exception/DefinitionException.php @@ -0,0 +1,22 @@ + + */ +class DefinitionException extends \Exception +{ + public static function create(Definition $definition, $message) + { + return new self(sprintf( + '%s' . PHP_EOL . 'Full definition:' . PHP_EOL . '%s', + $message, + (string) $definition + )); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/FactoryDefinition.php b/vendor/php-di/php-di/src/DI/Definition/FactoryDefinition.php new file mode 100644 index 0000000..eb7df7d --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/FactoryDefinition.php @@ -0,0 +1,89 @@ + + */ +class FactoryDefinition implements Definition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * @var string + */ + private $scope; + + /** + * Callable that returns the value. + * @var callable + */ + private $factory; + + /** + * Factory parameters. + * @var array + */ + private $parameters = []; + + /** + * @param string $name Entry name + * @param callable $factory Callable that returns the value associated to the entry name. + * @param string|null $scope + * @param array $parameters Parameters to be passed to the callable + */ + public function __construct($name, $factory, $scope = null, $parameters = []) + { + $this->name = $name; + $this->factory = $factory; + $this->scope = $scope; + $this->parameters = $parameters; + } + + /** + * @return string Entry name. + */ + public function getName() + { + return $this->name; + } + + /** + * Default scope is singleton: the callable is called once and the result is shared. + * + * {@inheritdoc} + */ + public function getScope() + { + return $this->scope ?: Scope::SINGLETON; + } + + /** + * @return callable Callable that returns the value associated to the entry name. + */ + public function getCallable() + { + return $this->factory; + } + + /** + * @return array Array containing the parameters to be passed to the callable, indexed by name. + */ + public function getParameters() + { + return $this->parameters; + } + + public function __toString() + { + return 'Factory'; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/HasSubDefinition.php b/vendor/php-di/php-di/src/DI/Definition/HasSubDefinition.php new file mode 100644 index 0000000..70ca7cb --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/HasSubDefinition.php @@ -0,0 +1,21 @@ + + */ +interface HasSubDefinition extends Definition +{ + /** + * @return string + */ + public function getSubDefinitionName(); + + /** + * @param Definition $definition + */ + public function setSubDefinition(Definition $definition); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/ArrayDefinitionExtensionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/ArrayDefinitionExtensionHelper.php new file mode 100644 index 0000000..db3036e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/ArrayDefinitionExtensionHelper.php @@ -0,0 +1,39 @@ + + */ +class ArrayDefinitionExtensionHelper implements DefinitionHelper +{ + /** + * @var array + */ + private $values = []; + + /** + * @param array $values Values to add to the array. + */ + public function __construct(array $values) + { + $this->values = $values; + } + + /** + * @param string $entryName Container entry name + * + * @return ArrayDefinitionExtension + */ + public function getDefinition($entryName) + { + return new ArrayDefinitionExtension($entryName, $this->values); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/DefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/DefinitionHelper.php new file mode 100644 index 0000000..de486b7 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/DefinitionHelper.php @@ -0,0 +1,17 @@ + + */ +interface DefinitionHelper +{ + /** + * @param string $entryName Container entry name + * @return \DI\Definition\Definition + */ + public function getDefinition($entryName); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/EnvironmentVariableDefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/EnvironmentVariableDefinitionHelper.php new file mode 100644 index 0000000..26fde47 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/EnvironmentVariableDefinitionHelper.php @@ -0,0 +1,57 @@ + + */ +class EnvironmentVariableDefinitionHelper implements DefinitionHelper +{ + /** + * The name of the environment variable. + * @var string + */ + private $variableName; + + /** + * Whether or not the environment variable definition is optional. + * + * If true and the environment variable given by $variableName has not been + * defined, $defaultValue is used. + * + * @var bool + */ + private $isOptional; + + /** + * The default value to use if the environment variable is optional and not provided. + * @var mixed + */ + private $defaultValue; + + /** + * @param string $variableName The name of the environment variable + * @param bool $isOptional Whether or not the environment variable definition is optional + * @param mixed $defaultValue The default value to use if the environment variable is optional and not provided + */ + public function __construct($variableName, $isOptional, $defaultValue = null) + { + $this->variableName = $variableName; + $this->isOptional = $isOptional; + $this->defaultValue = $defaultValue; + } + + /** + * @param string $entryName Container entry name + * + * @return EnvironmentVariableDefinition + */ + public function getDefinition($entryName) + { + return new EnvironmentVariableDefinition($entryName, $this->variableName, $this->isOptional, $this->defaultValue); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/FactoryDefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/FactoryDefinitionHelper.php new file mode 100644 index 0000000..9dbca3a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/FactoryDefinitionHelper.php @@ -0,0 +1,91 @@ + + */ +class FactoryDefinitionHelper implements DefinitionHelper +{ + /** + * @var callable + */ + private $factory; + + /** + * @var string|null + */ + private $scope; + + /** + * @var bool + */ + private $decorate; + + /** + * @var array + */ + private $parameters = []; + + /** + * @param callable $factory + * @param bool $decorate Is the factory decorating a previous definition? + */ + public function __construct($factory, $decorate = false) + { + $this->factory = $factory; + $this->decorate = $decorate; + } + + /** + * Defines the scope of the entry. + * + * @param string $scope + * + * @return FactoryDefinitionHelper + */ + public function scope($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * @param string $entryName Container entry name + * @return FactoryDefinition + */ + public function getDefinition($entryName) + { + if ($this->decorate) { + return new DecoratorDefinition($entryName, $this->factory, $this->scope, $this->parameters); + } + + return new FactoryDefinition($entryName, $this->factory, $this->scope, $this->parameters); + } + + /** + * Defines arguments to pass to the factory. + * + * Because factory methods do not yet support annotations or autowiring, this method + * should be used to define all parameters except the ContainerInterface and RequestedEntry. + * + * Multiple calls can be made to the method to override individual values. + * + * @param string $parameter Name or index of the parameter for which the value will be given. + * @param mixed $value Value to give to this parameter. + * + * @return FactoryDefinitionHelper + */ + public function parameter($parameter, $value) + { + $this->parameters[$parameter] = $value; + + return $this; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/ObjectDefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/ObjectDefinitionHelper.php new file mode 100644 index 0000000..8bf8b68 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/ObjectDefinitionHelper.php @@ -0,0 +1,278 @@ + + */ +class ObjectDefinitionHelper implements DefinitionHelper +{ + /** + * @var string|null + */ + private $className; + + /** + * @var bool|null + */ + private $lazy; + + /** + * @var string|null + */ + private $scope; + + /** + * Array of constructor parameters. + * @var array + */ + private $constructor = []; + + /** + * Array of properties and their value. + * @var array + */ + private $properties = []; + + /** + * Array of methods and their parameters. + * @var array + */ + private $methods = []; + + /** + * Helper for defining an object. + * + * @param string|null $className Class name of the object. + * If null, the name of the entry (in the container) will be used as class name. + */ + public function __construct($className = null) + { + $this->className = $className; + } + + /** + * Define the entry as lazy. + * + * A lazy entry is created only when it is used, a proxy is injected instead. + * + * @return ObjectDefinitionHelper + */ + public function lazy() + { + $this->lazy = true; + + return $this; + } + + /** + * Defines the scope of the entry. + * + * @param string $scope + * + * @return ObjectDefinitionHelper + */ + public function scope($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * Defines the arguments to use to call the constructor. + * + * This method takes a variable number of arguments, example: + * ->constructor($param1, $param2, $param3) + * + * @param mixed ... Parameters to use for calling the constructor of the class. + * + * @return ObjectDefinitionHelper + */ + public function constructor() + { + $this->constructor = func_get_args(); + + return $this; + } + + /** + * Defines a value for a specific argument of the constructor. + * + * This method is usually used together with annotations or autowiring, when a parameter + * is not (or cannot be) type-hinted. Using this method instead of constructor() allows to + * avoid defining all the parameters (letting them being resolved using annotations or autowiring) + * and only define one. + * + * @param string $parameter Parameter for which the value will be given. + * @param mixed $value Value to give to this parameter. + * + * @return ObjectDefinitionHelper + */ + public function constructorParameter($parameter, $value) + { + $this->constructor[$parameter] = $value; + + return $this; + } + + /** + * Defines a value to inject in a property of the object. + * + * @param string $property Entry in which to inject the value. + * @param mixed $value Value to inject in the property. + * + * @return ObjectDefinitionHelper + */ + public function property($property, $value) + { + $this->properties[$property] = $value; + + return $this; + } + + /** + * Defines a method to call and the arguments to use. + * + * This method takes a variable number of arguments after the method name, example: + * + * ->method('myMethod', $param1, $param2) + * + * Can be used multiple times to declare multiple calls. + * + * @param string $method Name of the method to call. + * @param mixed ... Parameters to use for calling the method. + * + * @return ObjectDefinitionHelper + */ + public function method($method) + { + $args = func_get_args(); + array_shift($args); + + if (! isset($this->methods[$method])) { + $this->methods[$method] = []; + } + + $this->methods[$method][] = $args; + + return $this; + } + + /** + * Defines a method to call and a value for a specific argument. + * + * This method is usually used together with annotations or autowiring, when a parameter + * is not (or cannot be) type-hinted. Using this method instead of method() allows to + * avoid defining all the parameters (letting them being resolved using annotations or + * autowiring) and only define one. + * + * If multiple calls to the method have been configured already (e.g. in a previous definition) + * then this method only overrides the parameter for the *first* call. + * + * @param string $method Name of the method to call. + * @param string $parameter Name or index of the parameter for which the value will be given. + * @param mixed $value Value to give to this parameter. + * + * @return ObjectDefinitionHelper + */ + public function methodParameter($method, $parameter, $value) + { + // Special case for the constructor + if ($method === '__construct') { + $this->constructor[$parameter] = $value; + + return $this; + } + + if (! isset($this->methods[$method])) { + $this->methods[$method] = [0 => []]; + } + + $this->methods[$method][0][$parameter] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDefinition($entryName) + { + $definition = new ObjectDefinition($entryName, $this->className); + + if ($this->lazy !== null) { + $definition->setLazy($this->lazy); + } + if ($this->scope !== null) { + $definition->setScope($this->scope); + } + + if (! empty($this->constructor)) { + $parameters = $this->fixParameters($definition, '__construct', $this->constructor); + $constructorInjection = MethodInjection::constructor($parameters); + $definition->setConstructorInjection($constructorInjection); + } + + if (! empty($this->properties)) { + foreach ($this->properties as $property => $value) { + $definition->addPropertyInjection( + new PropertyInjection($property, $value) + ); + } + } + + if (! empty($this->methods)) { + foreach ($this->methods as $method => $calls) { + foreach ($calls as $parameters) { + $parameters = $this->fixParameters($definition, $method, $parameters); + $methodInjection = new MethodInjection($method, $parameters); + $definition->addMethodInjection($methodInjection); + } + } + } + + return $definition; + } + + /** + * Fixes parameters indexed by the parameter name -> reindex by position. + * + * This is necessary so that merging definitions between sources is possible. + * + * @param ObjectDefinition $definition + * @param string $method + * @param array $parameters + * @throws DefinitionException + * @return array + */ + private function fixParameters(ObjectDefinition $definition, $method, $parameters) + { + $fixedParameters = []; + + foreach ($parameters as $index => $parameter) { + // Parameter indexed by the parameter name, we reindex it with its position + if (is_string($index)) { + $callable = [$definition->getClassName(), $method]; + try { + $reflectionParameter = new \ReflectionParameter($callable, $index); + } catch (\ReflectionException $e) { + throw DefinitionException::create($definition, sprintf("Parameter with name '%s' could not be found. %s.", $index, $e->getMessage())); + } + + $index = $reflectionParameter->getPosition(); + } + + $fixedParameters[$index] = $parameter; + } + + return $fixedParameters; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/StringDefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/StringDefinitionHelper.php new file mode 100644 index 0000000..d0293ee --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/StringDefinitionHelper.php @@ -0,0 +1,32 @@ + + */ +class StringDefinitionHelper implements DefinitionHelper +{ + /** + * @var string + */ + private $expression; + + public function __construct($expression) + { + $this->expression = $expression; + } + + /** + * @param string $entryName Container entry name + * + * @return StringDefinition + */ + public function getDefinition($entryName) + { + return new StringDefinition($entryName, $this->expression); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Helper/ValueDefinitionHelper.php b/vendor/php-di/php-di/src/DI/Definition/Helper/ValueDefinitionHelper.php new file mode 100644 index 0000000..79fe655 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Helper/ValueDefinitionHelper.php @@ -0,0 +1,35 @@ + + */ +class ValueDefinitionHelper implements DefinitionHelper +{ + /** + * @var mixed + */ + private $value; + + /** + * @param mixed $value + */ + public function __construct($value) + { + $this->value = $value; + } + + /** + * @param string $entryName Container entry name + * @return ValueDefinition + */ + public function getDefinition($entryName) + { + return new ValueDefinition($entryName, $this->value); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/InstanceDefinition.php b/vendor/php-di/php-di/src/DI/Definition/InstanceDefinition.php new file mode 100644 index 0000000..7451314 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/InstanceDefinition.php @@ -0,0 +1,69 @@ + + */ +class InstanceDefinition implements Definition +{ + /** + * Instance on which to inject dependencies. + * + * @var object + */ + private $instance; + + /** + * @var ObjectDefinition + */ + private $objectDefinition; + + /** + * @param object $instance + * @param ObjectDefinition $objectDefinition + */ + public function __construct($instance, ObjectDefinition $objectDefinition) + { + $this->instance = $instance; + $this->objectDefinition = $objectDefinition; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + // Name are superfluous for instance definitions + return ''; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return Scope::PROTOTYPE; + } + + /** + * @return object + */ + public function getInstance() + { + return $this->instance; + } + + /** + * @return ObjectDefinition + */ + public function getObjectDefinition() + { + return $this->objectDefinition; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition.php b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition.php new file mode 100644 index 0000000..ca52ac7 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition.php @@ -0,0 +1,336 @@ + + */ +class ObjectDefinition implements Definition, CacheableDefinition, HasSubDefinition +{ + /** + * Entry name (most of the time, same as $classname). + * @var string + */ + private $name; + + /** + * Class name (if null, then the class name is $name). + * @var string|null + */ + private $className; + + /** + * Constructor parameter injection. + * @var MethodInjection|null + */ + private $constructorInjection; + + /** + * Property injections. + * @var PropertyInjection[] + */ + private $propertyInjections = []; + + /** + * Method calls. + * @var MethodInjection[][] + */ + private $methodInjections = []; + + /** + * @var string|null + */ + private $scope; + + /** + * @var bool|null + */ + private $lazy; + + /** + * Store if the class exists. Storing it (in cache) avoids recomputing this. + * + * @var bool + */ + private $classExists; + + /** + * Store if the class is instantiable. Storing it (in cache) avoids recomputing this. + * + * @var bool + */ + private $isInstantiable; + + /** + * @param string $name Class name + * @param string $className + */ + public function __construct($name, $className = null) + { + $this->name = (string) $name; + $this->setClassName($className); + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * @param string|null $className + */ + public function setClassName($className) + { + $this->className = $className; + + $this->updateCache(); + } + + /** + * @return string Class name + */ + public function getClassName() + { + if ($this->className !== null) { + return $this->className; + } + + return $this->name; + } + + /** + * @return MethodInjection|null + */ + public function getConstructorInjection() + { + return $this->constructorInjection; + } + + /** + * @param MethodInjection $constructorInjection + */ + public function setConstructorInjection(MethodInjection $constructorInjection) + { + $this->constructorInjection = $constructorInjection; + } + + /** + * @return PropertyInjection[] Property injections + */ + public function getPropertyInjections() + { + return $this->propertyInjections; + } + + public function addPropertyInjection(PropertyInjection $propertyInjection) + { + $className = $propertyInjection->getClassName(); + if ($className) { + // Index with the class name to avoid collisions between parent and + // child private properties with the same name + $key = $className . '::' . $propertyInjection->getPropertyName(); + } else { + $key = $propertyInjection->getPropertyName(); + } + + $this->propertyInjections[$key] = $propertyInjection; + } + + /** + * @return MethodInjection[] Method injections + */ + public function getMethodInjections() + { + // Return array leafs + $injections = []; + array_walk_recursive($this->methodInjections, function ($injection) use (&$injections) { + $injections[] = $injection; + }); + + return $injections; + } + + /** + * @param MethodInjection $methodInjection + */ + public function addMethodInjection(MethodInjection $methodInjection) + { + $method = $methodInjection->getMethodName(); + if (! isset($this->methodInjections[$method])) { + $this->methodInjections[$method] = []; + } + $this->methodInjections[$method][] = $methodInjection; + } + + /** + * @param string $scope + */ + public function setScope($scope) + { + $this->scope = $scope; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return $this->scope ?: Scope::SINGLETON; + } + + /** + * @param bool|null $lazy + */ + public function setLazy($lazy) + { + $this->lazy = $lazy; + } + + /** + * @return bool + */ + public function isLazy() + { + if ($this->lazy !== null) { + return $this->lazy; + } else { + // Default value + return false; + } + } + + /** + * @return bool + */ + public function classExists() + { + return $this->classExists; + } + + /** + * @return bool + */ + public function isInstantiable() + { + return $this->isInstantiable; + } + + /** + * {@inheritdoc} + */ + public function getSubDefinitionName() + { + return $this->getClassName(); + } + + /** + * {@inheritdoc} + */ + public function setSubDefinition(Definition $definition) + { + if (! $definition instanceof self) { + return; + } + + // The current prevails + if ($this->className === null) { + $this->setClassName($definition->className); + } + if ($this->scope === null) { + $this->scope = $definition->scope; + } + if ($this->lazy === null) { + $this->lazy = $definition->lazy; + } + + // Merge constructor injection + $this->mergeConstructorInjection($definition); + + // Merge property injections + $this->mergePropertyInjections($definition); + + // Merge method injections + $this->mergeMethodInjections($definition); + } + + public function __toString() + { + return (new ObjectDefinitionDumper)->dump($this); + } + + private function mergeConstructorInjection(ObjectDefinition $definition) + { + if ($definition->getConstructorInjection() !== null) { + if ($this->constructorInjection !== null) { + // Merge + $this->constructorInjection->merge($definition->getConstructorInjection()); + } else { + // Set + $this->constructorInjection = $definition->getConstructorInjection(); + } + } + } + + private function mergePropertyInjections(ObjectDefinition $definition) + { + foreach ($definition->propertyInjections as $propertyName => $propertyInjection) { + if (! isset($this->propertyInjections[$propertyName])) { + // Add + $this->propertyInjections[$propertyName] = $propertyInjection; + } + } + } + + private function mergeMethodInjections(ObjectDefinition $definition) + { + foreach ($definition->methodInjections as $methodName => $calls) { + if (array_key_exists($methodName, $this->methodInjections)) { + $this->mergeMethodCalls($calls, $methodName); + } else { + // Add + $this->methodInjections[$methodName] = $calls; + } + } + } + + private function mergeMethodCalls(array $calls, $methodName) + { + foreach ($calls as $index => $methodInjection) { + // Merge + if (array_key_exists($index, $this->methodInjections[$methodName])) { + // Merge + $this->methodInjections[$methodName][$index]->merge($methodInjection); + } else { + // Add + $this->methodInjections[$methodName][$index] = $methodInjection; + } + } + } + + private function updateCache() + { + $className = $this->getClassName(); + + $this->classExists = class_exists($className) || interface_exists($className); + + if (! $this->classExists) { + $this->isInstantiable = false; + + return; + } + + $class = new ReflectionClass($className); + $this->isInstantiable = $class->isInstantiable(); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/MethodInjection.php b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/MethodInjection.php new file mode 100644 index 0000000..07220da --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/MethodInjection.php @@ -0,0 +1,87 @@ + + */ +class MethodInjection implements Definition +{ + /** + * @var string + */ + private $methodName; + + /** + * @var array + */ + private $parameters = []; + + /** + * @param string $methodName + * @param array $parameters + */ + public function __construct($methodName, array $parameters = []) + { + $this->methodName = (string) $methodName; + $this->parameters = $parameters; + } + + public static function constructor(array $parameters = []) + { + return new self('__construct', $parameters); + } + + /** + * @return string Method name + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @return array + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Replace the parameters of the definition by a new array of parameters. + * + * @param array $parameters + */ + public function replaceParameters(array $parameters) + { + $this->parameters = $parameters; + } + + public function merge(MethodInjection $definition) + { + // In case of conflicts, the current definition prevails. + $this->parameters = $this->parameters + $definition->parameters; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return Scope::PROTOTYPE; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/PropertyInjection.php b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/PropertyInjection.php new file mode 100644 index 0000000..ac5173e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ObjectDefinition/PropertyInjection.php @@ -0,0 +1,67 @@ + + */ +class PropertyInjection +{ + /** + * Property name. + * @var string + */ + private $propertyName; + + /** + * Value that should be injected in the property. + * @var mixed + */ + private $value; + + /** + * Use for injecting in properties of parent classes: the class name + * must be the name of the parent class because private properties + * can be attached to the parent classes, not the one we are resolving. + * @var string|null + */ + private $className; + + /** + * @param string $propertyName Property name + * @param mixed $value Value that should be injected in the property + * @param string|null $className + */ + public function __construct($propertyName, $value, $className = null) + { + $this->propertyName = (string) $propertyName; + $this->value = $value; + $this->className = $className; + } + + /** + * @return string Property name + */ + public function getPropertyName() + { + return $this->propertyName; + } + + /** + * @return mixed Value that should be injected in the property + */ + public function getValue() + { + return $this->value; + } + + /** + * @return string|null + */ + public function getClassName() + { + return $this->className; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/ArrayResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/ArrayResolver.php new file mode 100644 index 0000000..96674a1 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/ArrayResolver.php @@ -0,0 +1,78 @@ + + */ +class ArrayResolver implements DefinitionResolver +{ + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * @param DefinitionResolver $definitionResolver Used to resolve nested definitions. + */ + public function __construct(DefinitionResolver $definitionResolver) + { + $this->definitionResolver = $definitionResolver; + } + + /** + * Resolve an array definition to a value. + * + * An array definition can contain simple values or references to other entries. + * + * @param ArrayDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + $values = $definition->getValues(); + + // Resolve nested definitions + foreach ($values as $key => $value) { + if ($value instanceof DefinitionHelper) { + $values[$key] = $this->resolveDefinition($value, $definition, $key); + } + } + + return $values; + } + + /** + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return true; + } + + private function resolveDefinition(DefinitionHelper $value, ArrayDefinition $definition, $key) + { + try { + return $this->definitionResolver->resolve($value->getDefinition('')); + } catch (DependencyException $e) { + throw $e; + } catch (Exception $e) { + throw new DependencyException(sprintf( + 'Error while resolving %s[%s]. %s', + $definition->getName(), + $key, + $e->getMessage() + ), 0, $e); + } + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/DecoratorResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/DecoratorResolver.php new file mode 100644 index 0000000..de195d8 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/DecoratorResolver.php @@ -0,0 +1,86 @@ + + */ +class DecoratorResolver implements DefinitionResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * The resolver needs a container. This container will be passed to the factory as a parameter + * so that the factory can access other entries of the container. + * + * @param ContainerInterface $container + * @param DefinitionResolver $definitionResolver Used to resolve nested definitions. + */ + public function __construct(ContainerInterface $container, DefinitionResolver $definitionResolver) + { + $this->container = $container; + $this->definitionResolver = $definitionResolver; + } + + /** + * Resolve a decorator definition to a value. + * + * This will call the callable of the definition and pass it the decorated entry. + * + * @param DecoratorDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + $callable = $definition->getCallable(); + + if (! is_callable($callable)) { + throw new DefinitionException(sprintf( + 'The decorator "%s" is not callable', + $definition->getName() + )); + } + + $decoratedDefinition = $definition->getDecoratedDefinition(); + + if (! $decoratedDefinition instanceof Definition) { + if (! $definition->getSubDefinitionName()) { + throw new DefinitionException('Decorators cannot be nested in another definition'); + } + + throw new DefinitionException(sprintf( + 'Entry "%s" decorates nothing: no previous definition with the same name was found', + $definition->getName() + )); + } + + $decorated = $this->definitionResolver->resolve($decoratedDefinition, $parameters); + + return call_user_func($callable, $decorated, $this->container); + } + + /** + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return true; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/DefinitionResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/DefinitionResolver.php new file mode 100644 index 0000000..72dc360 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/DefinitionResolver.php @@ -0,0 +1,37 @@ + + */ +interface DefinitionResolver +{ + /** + * Resolve a definition to a value. + * + * @param Definition $definition Object that defines how the value should be obtained. + * @param array $parameters Optional parameters to use to build the entry. + * + * @throws DefinitionException If the definition cannot be resolved. + * + * @return mixed Value obtained from the definition. + */ + public function resolve(Definition $definition, array $parameters = []); + + /** + * Check if a definition can be resolved. + * + * @param Definition $definition Object that defines how the value should be obtained. + * @param array $parameters Optional parameters to use to build the entry. + * + * @return bool + */ + public function isResolvable(Definition $definition, array $parameters = []); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/EnvironmentVariableResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/EnvironmentVariableResolver.php new file mode 100644 index 0000000..491f5ff --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/EnvironmentVariableResolver.php @@ -0,0 +1,74 @@ + + */ +class EnvironmentVariableResolver implements DefinitionResolver +{ + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * @var callable + */ + private $variableReader; + + public function __construct(DefinitionResolver $definitionResolver, $variableReader = 'getenv') + { + $this->definitionResolver = $definitionResolver; + $this->variableReader = $variableReader; + } + + /** + * Resolve an environment variable definition to a value. + * + * @param EnvironmentVariableDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + $value = call_user_func($this->variableReader, $definition->getVariableName()); + + if (false !== $value) { + return $value; + } + + if (!$definition->isOptional()) { + throw new DefinitionException(sprintf( + "The environment variable '%s' has not been defined", + $definition->getVariableName() + )); + } + + $value = $definition->getDefaultValue(); + + // Nested definition + if ($value instanceof DefinitionHelper) { + return $this->definitionResolver->resolve($value->getDefinition('')); + } + + return $value; + } + + /** + * @param EnvironmentVariableDefinition $definition + * + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return true; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/FactoryResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/FactoryResolver.php new file mode 100644 index 0000000..6dc331f --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/FactoryResolver.php @@ -0,0 +1,131 @@ + + */ +class FactoryResolver implements DefinitionResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + /** + * @var Invoker|null + */ + private $invoker; + + /** + * @var DefinitionResolver + */ + private $resolver; + + /** + * The resolver needs a container. This container will be passed to the factory as a parameter + * so that the factory can access other entries of the container. + * + * @param ContainerInterface $container + */ + public function __construct(ContainerInterface $container, DefinitionResolver $resolver) + { + $this->container = $container; + $this->resolver = $resolver; + } + + /** + * Resolve a factory definition to a value. + * + * This will call the callable of the definition. + * + * @param FactoryDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + if (! $this->invoker) { + $parameterResolver = new ResolverChain([ + new AssociativeArrayResolver, + new FactoryParameterResolver($this->container), + new NumericArrayResolver, + ]); + + $this->invoker = new Invoker($parameterResolver, $this->container); + } + + $callable = $definition->getCallable(); + + try { + $providedParams = [$this->container, $definition]; + $extraParams = $this->resolveExtraParams($definition->getParameters()); + $providedParams = array_merge($providedParams, $extraParams); + + return $this->invoker->call($callable, $providedParams); + } catch (NotCallableException $e) { + // Custom error message to help debugging + if (is_string($callable) && class_exists($callable) && method_exists($callable, '__invoke')) { + throw new DefinitionException(sprintf( + 'Entry "%s" cannot be resolved: factory %s. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry manually.', + $definition->getName(), + $e->getMessage() + )); + } + + throw new DefinitionException(sprintf( + 'Entry "%s" cannot be resolved: factory %s', + $definition->getName(), + $e->getMessage() + )); + } catch (NotEnoughParametersException $e) { + throw new DefinitionException(sprintf( + 'Entry "%s" cannot be resolved: %s', + $definition->getName(), + $e->getMessage() + )); + } + } + + /** + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return true; + } + + private function resolveExtraParams(array $params) + { + $resolved = []; + foreach ($params as $key => $value) { + if ($value instanceof DefinitionHelper) { + // As per ObjectCreator::injectProperty, use '' for an anonymous sub-definition + $value = $value->getDefinition(''); + } + if (!$value instanceof Definition) { + $resolved[$key] = $value; + } else { + $resolved[$key] = $this->resolver->resolve($value); + } + } + + return $resolved; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/InstanceInjector.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/InstanceInjector.php new file mode 100644 index 0000000..522b4d1 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/InstanceInjector.php @@ -0,0 +1,46 @@ + + */ +class InstanceInjector extends ObjectCreator +{ + /** + * Injects dependencies on an existing instance. + * + * @param InstanceDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + try { + $this->injectMethodsAndProperties($definition->getInstance(), $definition->getObjectDefinition()); + } catch (NotFoundExceptionInterface $e) { + $message = sprintf( + 'Error while injecting dependencies into %s: %s', + get_class($definition->getInstance()), + $e->getMessage() + ); + throw new DependencyException($message, 0, $e); + } + } + + /** + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return true; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/ObjectCreator.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/ObjectCreator.php new file mode 100644 index 0000000..a76a6f5 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/ObjectCreator.php @@ -0,0 +1,247 @@ + + */ +class ObjectCreator implements DefinitionResolver +{ + /** + * @var ProxyFactory + */ + private $proxyFactory; + + /** + * @var ParameterResolver + */ + private $parameterResolver; + + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * @param DefinitionResolver $definitionResolver Used to resolve nested definitions. + * @param ProxyFactory $proxyFactory Used to create proxies for lazy injections. + */ + public function __construct( + DefinitionResolver $definitionResolver, + ProxyFactory $proxyFactory + ) { + $this->definitionResolver = $definitionResolver; + $this->proxyFactory = $proxyFactory; + $this->parameterResolver = new ParameterResolver($definitionResolver); + } + + /** + * Resolve a class definition to a value. + * + * This will create a new instance of the class using the injections points defined. + * + * @param ObjectDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + // Lazy? + if ($definition->isLazy()) { + return $this->createProxy($definition, $parameters); + } + + return $this->createInstance($definition, $parameters); + } + + /** + * The definition is not resolvable if the class is not instantiable (interface or abstract) + * or if the class doesn't exist. + * + * @param ObjectDefinition $definition + * + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return $definition->isInstantiable(); + } + + /** + * Returns a proxy instance. + * + * @param ObjectDefinition $definition + * @param array $parameters + * + * @return LazyLoadingInterface Proxy instance + */ + private function createProxy(ObjectDefinition $definition, array $parameters) + { + /** @noinspection PhpUnusedParameterInspection */ + $proxy = $this->proxyFactory->createProxy( + $definition->getClassName(), + function (& $wrappedObject, $proxy, $method, $params, & $initializer) use ($definition, $parameters) { + $wrappedObject = $this->createInstance($definition, $parameters); + $initializer = null; // turning off further lazy initialization + return true; + } + ); + + return $proxy; + } + + /** + * Creates an instance of the class and injects dependencies.. + * + * @param ObjectDefinition $definition + * @param array $parameters Optional parameters to use to create the instance. + * + * @throws DefinitionException + * @throws DependencyException + * @return object + */ + private function createInstance(ObjectDefinition $definition, array $parameters) + { + $this->assertClassExists($definition); + + $classname = $definition->getClassName(); + $classReflection = new ReflectionClass($classname); + + $this->assertClassIsInstantiable($definition); + + $constructorInjection = $definition->getConstructorInjection(); + + try { + $args = $this->parameterResolver->resolveParameters( + $constructorInjection, + $classReflection->getConstructor(), + $parameters + ); + + if (count($args) > 0) { + $object = $classReflection->newInstanceArgs($args); + } else { + $object = new $classname; + } + + $this->injectMethodsAndProperties($object, $definition); + } catch (NotFoundExceptionInterface $e) { + throw new DependencyException(sprintf( + 'Error while injecting dependencies into %s: %s', + $classReflection->getName(), + $e->getMessage() + ), 0, $e); + } catch (DefinitionException $e) { + throw DefinitionException::create($definition, sprintf( + 'Entry "%s" cannot be resolved: %s', + $definition->getName(), + $e->getMessage() + )); + } + + if (! $object) { + throw new DependencyException(sprintf( + 'Entry "%s" cannot be resolved: %s could not be constructed', + $definition->getName(), + $classReflection->getName() + )); + } + + return $object; + } + + protected function injectMethodsAndProperties($object, ObjectDefinition $objectDefinition) + { + // Property injections + foreach ($objectDefinition->getPropertyInjections() as $propertyInjection) { + $this->injectProperty($object, $propertyInjection); + } + + // Method injections + foreach ($objectDefinition->getMethodInjections() as $methodInjection) { + $methodReflection = new \ReflectionMethod($object, $methodInjection->getMethodName()); + $args = $this->parameterResolver->resolveParameters($methodInjection, $methodReflection); + + $methodReflection->invokeArgs($object, $args); + } + } + + /** + * Inject dependencies into properties. + * + * @param object $object Object to inject dependencies into + * @param PropertyInjection $propertyInjection Property injection definition + * + * @throws DependencyException + * @throws DefinitionException + */ + private function injectProperty($object, PropertyInjection $propertyInjection) + { + $propertyName = $propertyInjection->getPropertyName(); + + $className = $propertyInjection->getClassName(); + $className = $className ?: get_class($object); + $property = new ReflectionProperty($className, $propertyName); + + $value = $propertyInjection->getValue(); + + if ($value instanceof DefinitionHelper) { + /** @var Definition $nestedDefinition */ + $nestedDefinition = $value->getDefinition(''); + + try { + $value = $this->definitionResolver->resolve($nestedDefinition); + } catch (DependencyException $e) { + throw $e; + } catch (Exception $e) { + throw new DependencyException(sprintf( + 'Error while injecting in %s::%s. %s', + get_class($object), + $propertyName, + $e->getMessage() + ), 0, $e); + } + } + + if (! $property->isPublic()) { + $property->setAccessible(true); + } + $property->setValue($object, $value); + } + + private function assertClassExists(ObjectDefinition $definition) + { + if (! $definition->classExists()) { + throw DefinitionException::create($definition, sprintf( + 'Entry "%s" cannot be resolved: the class doesn\'t exist', + $definition->getName() + )); + } + } + + private function assertClassIsInstantiable(ObjectDefinition $definition) + { + if (! $definition->isInstantiable()) { + throw DefinitionException::create($definition, sprintf( + 'Entry "%s" cannot be resolved: the class is not instantiable', + $definition->getName() + )); + } + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/ParameterResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/ParameterResolver.php new file mode 100644 index 0000000..19ebea4 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/ParameterResolver.php @@ -0,0 +1,120 @@ + + */ +class ParameterResolver +{ + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + /** + * @param DefinitionResolver $definitionResolver Will be used to resolve nested definitions. + */ + public function __construct(DefinitionResolver $definitionResolver) + { + $this->definitionResolver = $definitionResolver; + } + + /** + * @param MethodInjection $definition + * @param ReflectionMethod $method + * @param array $parameters + * + * @throws DefinitionException A parameter has no value defined or guessable. + * @return array Parameters to use to call the function. + */ + public function resolveParameters( + MethodInjection $definition = null, + ReflectionMethod $method = null, + array $parameters = [] + ) { + $args = []; + + if (! $method) { + return $args; + } + + $definitionParameters = $definition ? $definition->getParameters() : []; + + foreach ($method->getParameters() as $index => $parameter) { + if (array_key_exists($parameter->getName(), $parameters)) { + // Look in the $parameters array + $value = &$parameters[$parameter->getName()]; + } elseif (array_key_exists($index, $definitionParameters)) { + // Look in the definition + $value = &$definitionParameters[$index]; + } else { + // If the parameter is optional and wasn't specified, we take its default value + if ($parameter->isOptional()) { + $args[] = $this->getParameterDefaultValue($parameter, $method); + continue; + } + + throw new DefinitionException(sprintf( + 'Parameter $%s of %s has no value defined or guessable', + $parameter->getName(), + $this->getFunctionName($method) + )); + } + + if ($value instanceof DefinitionHelper) { + $nestedDefinition = $value->getDefinition(''); + + // If the container cannot produce the entry, we can use the default parameter value + if ($parameter->isOptional() && ! $this->definitionResolver->isResolvable($nestedDefinition)) { + $value = $this->getParameterDefaultValue($parameter, $method); + } else { + $value = $this->definitionResolver->resolve($nestedDefinition); + } + } + + $args[] = &$value; + } + + return $args; + } + + /** + * Returns the default value of a function parameter. + * + * @param ReflectionParameter $parameter + * @param ReflectionMethod $function + * + * @throws DefinitionException Can't get default values from PHP internal classes and functions + * @return mixed + */ + private function getParameterDefaultValue( + ReflectionParameter $parameter, + ReflectionMethod $function + ) { + try { + return $parameter->getDefaultValue(); + } catch (\ReflectionException $e) { + throw new DefinitionException(sprintf( + 'The parameter "%s" of %s has no type defined or guessable. It has a default value, ' + . 'but the default value can\'t be read through Reflection because it is a PHP internal class.', + $parameter->getName(), + $this->getFunctionName($function) + )); + } + } + + private function getFunctionName(ReflectionMethod $method) + { + return $method->getName() . '()'; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/ResolverDispatcher.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/ResolverDispatcher.php new file mode 100644 index 0000000..3f0f55a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/ResolverDispatcher.php @@ -0,0 +1,133 @@ + + */ +class ResolverDispatcher implements DefinitionResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + /** + * @var ProxyFactory + */ + private $proxyFactory; + + private $selfResolvingResolver; + private $arrayResolver; + private $factoryResolver; + private $decoratorResolver; + private $objectResolver; + private $instanceResolver; + private $envVariableResolver; + + public function __construct(ContainerInterface $container, ProxyFactory $proxyFactory) + { + $this->container = $container; + $this->proxyFactory = $proxyFactory; + } + + /** + * Resolve a definition to a value. + * + * @param Definition $definition Object that defines how the value should be obtained. + * @param array $parameters Optional parameters to use to build the entry. + * + * @throws DefinitionException If the definition cannot be resolved. + * + * @return mixed Value obtained from the definition. + */ + public function resolve(Definition $definition, array $parameters = []) + { + $definitionResolver = $this->getDefinitionResolver($definition); + + return $definitionResolver->resolve($definition, $parameters); + } + + /** + * Check if a definition can be resolved. + * + * @param Definition $definition Object that defines how the value should be obtained. + * @param array $parameters Optional parameters to use to build the entry. + * + * @return bool + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + $definitionResolver = $this->getDefinitionResolver($definition); + + return $definitionResolver->isResolvable($definition, $parameters); + } + + /** + * Returns a resolver capable of handling the given definition. + * + * @param Definition $definition + * + * @throws \RuntimeException No definition resolver was found for this type of definition. + * @return DefinitionResolver + */ + private function getDefinitionResolver(Definition $definition) + { + switch (true) { + case $definition instanceof \DI\Definition\SelfResolvingDefinition: + if (! $this->selfResolvingResolver) { + $this->selfResolvingResolver = new SelfResolver($this->container); + } + + return $this->selfResolvingResolver; + case $definition instanceof \DI\Definition\ObjectDefinition: + if (! $this->objectResolver) { + $this->objectResolver = new ObjectCreator($this, $this->proxyFactory); + } + + return $this->objectResolver; + case $definition instanceof \DI\Definition\DecoratorDefinition: + if (! $this->decoratorResolver) { + $this->decoratorResolver = new DecoratorResolver($this->container, $this); + } + + return $this->decoratorResolver; + case $definition instanceof \DI\Definition\FactoryDefinition: + if (! $this->factoryResolver) { + $this->factoryResolver = new FactoryResolver($this->container, $this); + } + + return $this->factoryResolver; + case $definition instanceof \DI\Definition\ArrayDefinition: + if (! $this->arrayResolver) { + $this->arrayResolver = new ArrayResolver($this); + } + + return $this->arrayResolver; + case $definition instanceof \DI\Definition\EnvironmentVariableDefinition: + if (! $this->envVariableResolver) { + $this->envVariableResolver = new EnvironmentVariableResolver($this); + } + + return $this->envVariableResolver; + case $definition instanceof \DI\Definition\InstanceDefinition: + if (! $this->instanceResolver) { + $this->instanceResolver = new InstanceInjector($this, $this->proxyFactory); + } + + return $this->instanceResolver; + default: + throw new \RuntimeException('No definition resolver was configured for definition of type ' . get_class($definition)); + } + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Resolver/SelfResolver.php b/vendor/php-di/php-di/src/DI/Definition/Resolver/SelfResolver.php new file mode 100644 index 0000000..53aa634 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Resolver/SelfResolver.php @@ -0,0 +1,46 @@ + + */ +class SelfResolver implements DefinitionResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * @param SelfResolvingDefinition $definition + * + * {@inheritdoc} + */ + public function resolve(Definition $definition, array $parameters = []) + { + return $definition->resolve($this->container); + } + + /** + * @param SelfResolvingDefinition $definition + * + * {@inheritdoc} + */ + public function isResolvable(Definition $definition, array $parameters = []) + { + return $definition->isResolvable($this->container); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/SelfResolvingDefinition.php b/vendor/php-di/php-di/src/DI/Definition/SelfResolvingDefinition.php new file mode 100644 index 0000000..92eb968 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/SelfResolvingDefinition.php @@ -0,0 +1,27 @@ + + */ +interface SelfResolvingDefinition +{ + /** + * Resolve the definition and return the resulting value. + * + * @return mixed + */ + public function resolve(ContainerInterface $container); + + /** + * Check if a definition can be resolved. + * + * @return bool + */ + public function isResolvable(ContainerInterface $container); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/AnnotationReader.php b/vendor/php-di/php-di/src/DI/Definition/Source/AnnotationReader.php new file mode 100644 index 0000000..ea2d420 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/AnnotationReader.php @@ -0,0 +1,273 @@ + + */ +class AnnotationReader implements DefinitionSource +{ + /** + * @var Reader + */ + private $annotationReader; + + /** + * @var PhpDocReader + */ + private $phpDocReader; + + /** + * @var bool + */ + private $ignorePhpDocErrors; + + public function __construct($ignorePhpDocErrors = false) + { + $this->ignorePhpDocErrors = (bool) $ignorePhpDocErrors; + } + + /** + * {@inheritdoc} + * @throws AnnotationException + * @throws InvalidArgumentException The class doesn't exist + */ + public function getDefinition($name) + { + if (!class_exists($name) && !interface_exists($name)) { + return null; + } + + $class = new ReflectionClass($name); + $definition = new ObjectDefinition($name); + + $this->readInjectableAnnotation($class, $definition); + + // Browse the class properties looking for annotated properties + $this->readProperties($class, $definition); + + // Browse the object's methods looking for annotated methods + $this->readMethods($class, $definition); + + return $definition; + } + + /** + * Browse the class properties looking for annotated properties. + */ + private function readProperties(ReflectionClass $class, ObjectDefinition $definition) + { + foreach ($class->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + $this->readProperty($property, $definition); + } + + // Read also the *private* properties of the parent classes + /** @noinspection PhpAssignmentInConditionInspection */ + while ($class = $class->getParentClass()) { + foreach ($class->getProperties(ReflectionProperty::IS_PRIVATE) as $property) { + if ($property->isStatic()) { + continue; + } + $this->readProperty($property, $definition, $class->getName()); + } + } + } + + private function readProperty(ReflectionProperty $property, ObjectDefinition $definition, $classname = null) + { + // Look for @Inject annotation + /** @var $annotation Inject */ + $annotation = $this->getAnnotationReader()->getPropertyAnnotation($property, 'DI\Annotation\Inject'); + if ($annotation === null) { + return null; + } + + // @Inject("name") or look for @var content + $entryName = $annotation->getName() ?: $this->getPhpDocReader()->getPropertyClass($property); + + if ($entryName === null) { + throw new AnnotationException(sprintf( + '@Inject found on property %s::%s but unable to guess what to inject, use a @var annotation', + $property->getDeclaringClass()->getName(), + $property->getName() + )); + } + + $definition->addPropertyInjection( + new PropertyInjection($property->getName(), new EntryReference($entryName), $classname) + ); + } + + /** + * Browse the object's methods looking for annotated methods. + */ + private function readMethods(ReflectionClass $class, ObjectDefinition $objectDefinition) + { + // This will look in all the methods, including those of the parent classes + foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { + if ($method->isStatic()) { + continue; + } + + $methodInjection = $this->getMethodInjection($method); + + if (! $methodInjection) { + continue; + } + + if ($method->isConstructor()) { + $objectDefinition->setConstructorInjection($methodInjection); + } else { + $objectDefinition->addMethodInjection($methodInjection); + } + } + } + + private function getMethodInjection(ReflectionMethod $method) + { + // Look for @Inject annotation + /** @var $annotation Inject|null */ + try { + $annotation = $this->getAnnotationReader()->getMethodAnnotation($method, 'DI\Annotation\Inject'); + } catch (AnnotationException $e) { + throw new AnnotationException(sprintf( + '@Inject annotation on %s::%s is malformed. %s', + $method->getDeclaringClass()->getName(), + $method->getName(), + $e->getMessage() + ), 0, $e); + } + $annotationParameters = $annotation ? $annotation->getParameters() : []; + + // @Inject on constructor is implicit + if (! ($annotation || $method->isConstructor())) { + return null; + } + + $parameters = []; + foreach ($method->getParameters() as $index => $parameter) { + $entryName = $this->getMethodParameter($index, $parameter, $annotationParameters); + + if ($entryName !== null) { + $parameters[$index] = new EntryReference($entryName); + } + } + + if ($method->isConstructor()) { + return MethodInjection::constructor($parameters); + } else { + return new MethodInjection($method->getName(), $parameters); + } + } + + /** + * @param int $parameterIndex + * @param ReflectionParameter $parameter + * @param array $annotationParameters + * + * @return string|null Entry name or null if not found. + */ + private function getMethodParameter($parameterIndex, ReflectionParameter $parameter, array $annotationParameters) + { + // @Inject has definition for this parameter (by index, or by name) + if (isset($annotationParameters[$parameterIndex])) { + return $annotationParameters[$parameterIndex]; + } + if (isset($annotationParameters[$parameter->getName()])) { + return $annotationParameters[$parameter->getName()]; + } + + // Skip optional parameters if not explicitly defined + if ($parameter->isOptional()) { + return null; + } + + // Try to use the type-hinting + $parameterClass = $parameter->getClass(); + if ($parameterClass) { + return $parameterClass->getName(); + } + + // Last resort, look for @param tag + return $this->getPhpDocReader()->getParameterClass($parameter); + } + + /** + * @return Reader The annotation reader + */ + public function getAnnotationReader() + { + if ($this->annotationReader === null) { + AnnotationRegistry::registerAutoloadNamespace('DI\Annotation', __DIR__ . '/../../../'); + $this->annotationReader = new SimpleAnnotationReader(); + $this->annotationReader->addNamespace('DI\Annotation'); + } + + return $this->annotationReader; + } + + /** + * @return PhpDocReader + */ + private function getPhpDocReader() + { + if ($this->phpDocReader === null) { + $this->phpDocReader = new PhpDocReader($this->ignorePhpDocErrors); + } + + return $this->phpDocReader; + } + + private function readInjectableAnnotation(ReflectionClass $class, ObjectDefinition $definition) + { + try { + /** @var $annotation Injectable|null */ + $annotation = $this->getAnnotationReader() + ->getClassAnnotation($class, 'DI\Annotation\Injectable'); + } catch (UnexpectedValueException $e) { + throw new DefinitionException(sprintf( + 'Error while reading @Injectable on %s: %s', + $class->getName(), + $e->getMessage() + ), 0, $e); + } + + if (! $annotation) { + return; + } + + if ($annotation->getScope()) { + $definition->setScope($annotation->getScope()); + } + if ($annotation->isLazy() !== null) { + $definition->setLazy($annotation->isLazy()); + } + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/Autowiring.php b/vendor/php-di/php-di/src/DI/Definition/Source/Autowiring.php new file mode 100644 index 0000000..abd194a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/Autowiring.php @@ -0,0 +1,61 @@ + + */ +class Autowiring implements DefinitionSource +{ + /** + * {@inheritdoc} + */ + public function getDefinition($name) + { + if (!class_exists($name) && !interface_exists($name)) { + return null; + } + + $definition = new ObjectDefinition($name); + + // Constructor + $class = new \ReflectionClass($name); + $constructor = $class->getConstructor(); + if ($constructor && $constructor->isPublic()) { + $definition->setConstructorInjection( + MethodInjection::constructor($this->getParametersDefinition($constructor)) + ); + } + + return $definition; + } + + /** + * Read the type-hinting from the parameters of the function. + */ + private function getParametersDefinition(\ReflectionFunctionAbstract $constructor) + { + $parameters = []; + + foreach ($constructor->getParameters() as $index => $parameter) { + // Skip optional parameters + if ($parameter->isOptional()) { + continue; + } + + $parameterClass = $parameter->getClass(); + + if ($parameterClass) { + $parameters[$index] = new EntryReference($parameterClass->getName()); + } + } + + return $parameters; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/CachedDefinitionSource.php b/vendor/php-di/php-di/src/DI/Definition/Source/CachedDefinitionSource.php new file mode 100644 index 0000000..697055a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/CachedDefinitionSource.php @@ -0,0 +1,97 @@ + + */ +class CachedDefinitionSource implements DefinitionSource +{ + /** + * Prefix for cache key, to avoid conflicts with other systems using the same cache. + * @var string + */ + const CACHE_PREFIX = 'DI\\Definition\\'; + + /** + * @var DefinitionSource + */ + private $source; + + /** + * @var Cache + */ + private $cache; + + public function __construct(DefinitionSource $source, Cache $cache) + { + $this->source = $source; + $this->cache = $cache; + } + + /** + * {@inheritdoc} + */ + public function getDefinition($name) + { + // Look in cache + $definition = $this->fetchFromCache($name); + + if ($definition === false) { + $definition = $this->source->getDefinition($name); + + // Save to cache + if ($definition === null || ($definition instanceof CacheableDefinition)) { + $this->saveToCache($name, $definition); + } + } + + return $definition; + } + + /** + * @return Cache + */ + public function getCache() + { + return $this->cache; + } + + /** + * Fetches a definition from the cache. + * + * @param string $name Entry name + * @return Definition|null|bool The cached definition, null or false if the value is not already cached + */ + private function fetchFromCache($name) + { + $cacheKey = self::CACHE_PREFIX . $name; + + $data = $this->cache->fetch($cacheKey); + + if ($data !== false) { + return $data; + } + + return false; + } + + /** + * Saves a definition to the cache. + * + * @param string $name Entry name + * @param Definition|null $definition + */ + private function saveToCache($name, Definition $definition = null) + { + $cacheKey = self::CACHE_PREFIX . $name; + + $this->cache->save($cacheKey, $definition); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionArray.php b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionArray.php new file mode 100644 index 0000000..24e910f --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionArray.php @@ -0,0 +1,150 @@ + + */ +class DefinitionArray implements DefinitionSource, MutableDefinitionSource +{ + const WILDCARD = '*'; + /** + * Matches anything except "\". + */ + const WILDCARD_PATTERN = '([^\\\\]+)'; + + /** + * DI definitions in a PHP array. + * @var array + */ + private $definitions = []; + + /** + * Cache of wildcard definitions. + * @var array + */ + private $wildcardDefinitions; + + /** + * @param array $definitions + */ + public function __construct(array $definitions = []) + { + $this->definitions = $definitions; + } + + /** + * @param array $definitions DI definitions in a PHP array indexed by the definition name. + */ + public function addDefinitions(array $definitions) + { + // The newly added data prevails + // "for keys that exist in both arrays, the elements from the left-hand array will be used" + $this->definitions = $definitions + $this->definitions; + + // Clear cache + $this->wildcardDefinitions = null; + } + + /** + * {@inheritdoc} + */ + public function addDefinition(Definition $definition) + { + $this->definitions[$definition->getName()] = $definition; + + // Clear cache + $this->wildcardDefinitions = null; + } + + /** + * {@inheritdoc} + */ + public function getDefinition($name) + { + // Look for the definition by name + if (array_key_exists($name, $this->definitions)) { + return $this->castDefinition($this->definitions[$name], $name); + } + + // Build the cache of wildcard definitions + if ($this->wildcardDefinitions === null) { + $this->wildcardDefinitions = []; + foreach ($this->definitions as $key => $definition) { + if (strpos($key, self::WILDCARD) !== false) { + $this->wildcardDefinitions[$key] = $definition; + } + } + } + + // Look in wildcards definitions + foreach ($this->wildcardDefinitions as $key => $definition) { + // Turn the pattern into a regex + $key = preg_quote($key); + $key = '#' . str_replace('\\' . self::WILDCARD, self::WILDCARD_PATTERN, $key) . '#'; + if (preg_match($key, $name, $matches) === 1) { + $definition = $this->castDefinition($definition, $name); + + // For a class definition, we replace * in the class name with the matches + // *Interface -> *Impl => FooInterface -> FooImpl + if ($definition instanceof ObjectDefinition) { + array_shift($matches); + $definition->setClassName( + $this->replaceWildcards($definition->getClassName(), $matches) + ); + } + + return $definition; + } + } + + return null; + } + + /** + * @param mixed $definition + * @param string $name + * @return Definition + */ + private function castDefinition($definition, $name) + { + if ($definition instanceof DefinitionHelper) { + $definition = $definition->getDefinition($name); + } elseif (is_array($definition)) { + $definition = new ArrayDefinition($name, $definition); + } elseif ($definition instanceof \Closure) { + $definition = new FactoryDefinition($name, $definition); + } elseif (! $definition instanceof Definition) { + $definition = new ValueDefinition($name, $definition); + } + + return $definition; + } + + /** + * Replaces all the wildcards in the string with the given replacements. + * @param string $string + * @param string[] $replacements + * @return string + */ + private function replaceWildcards($string, array $replacements) + { + foreach ($replacements as $replacement) { + $pos = strpos($string, self::WILDCARD); + if ($pos !== false) { + $string = substr_replace($string, $replacement, $pos, 1); + } + } + + return $string; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionFile.php b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionFile.php new file mode 100644 index 0000000..d1233fc --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionFile.php @@ -0,0 +1,66 @@ + + */ +class DefinitionFile extends DefinitionArray +{ + /** + * @var bool + */ + private $initialized = false; + + /** + * File containing definitions, or null if the definitions are given as a PHP array. + * @var string|null + */ + private $file; + + /** + * @param string $file File in which the definitions are returned as an array. + */ + public function __construct($file) + { + // Lazy-loading to improve performances + $this->file = $file; + + parent::__construct([]); + } + + /** + * {@inheritdoc} + */ + public function getDefinition($name) + { + $this->initialize(); + + return parent::getDefinition($name); + } + + /** + * Lazy-loading of the definitions. + * @throws DefinitionException + */ + private function initialize() + { + if ($this->initialized === true) { + return; + } + + $definitions = require $this->file; + + if (! is_array($definitions)) { + throw new DefinitionException("File {$this->file} should return an array of definitions"); + } + + $this->addDefinitions($definitions); + + $this->initialized = true; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionSource.php b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionSource.php new file mode 100644 index 0000000..827096c --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/DefinitionSource.php @@ -0,0 +1,24 @@ + + */ +interface DefinitionSource +{ + /** + * Returns the DI definition for the entry name. + * + * @param string $name + * + * @throws DefinitionException An invalid definition was found. + * @return Definition|null + */ + public function getDefinition($name); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/MutableDefinitionSource.php b/vendor/php-di/php-di/src/DI/Definition/Source/MutableDefinitionSource.php new file mode 100644 index 0000000..287cc32 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/MutableDefinitionSource.php @@ -0,0 +1,15 @@ + + */ +interface MutableDefinitionSource extends DefinitionSource +{ + public function addDefinition(Definition $definition); +} diff --git a/vendor/php-di/php-di/src/DI/Definition/Source/SourceChain.php b/vendor/php-di/php-di/src/DI/Definition/Source/SourceChain.php new file mode 100644 index 0000000..15d179e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/Source/SourceChain.php @@ -0,0 +1,102 @@ + + */ +class SourceChain implements DefinitionSource, MutableDefinitionSource +{ + /** + * @var DefinitionSource[] + */ + private $sources; + + /** + * @var DefinitionSource + */ + private $rootSource; + + /** + * @var MutableDefinitionSource|null + */ + private $mutableSource; + + /** + * @param DefinitionSource[] $sources + */ + public function __construct(array $sources) + { + // We want a numerically indexed array to ease the traversal later + $this->sources = array_values($sources); + $this->rootSource = $this; + } + + /** + * {@inheritdoc} + * @param int $startIndex Use this parameter to start looking from a specific + * point in the source chain. + */ + public function getDefinition($name, $startIndex = 0) + { + $count = count($this->sources); + for ($i = $startIndex; $i < $count; $i++) { + $source = $this->sources[$i]; + + $definition = $source->getDefinition($name); + + if ($definition) { + if ($definition instanceof HasSubDefinition) { + $this->resolveSubDefinition($definition, $i); + } + + return $definition; + } + } + + return null; + } + + public function addDefinition(Definition $definition) + { + if (! $this->mutableSource) { + throw new \LogicException("The container's definition source has not been initialized correctly"); + } + + $this->mutableSource->addDefinition($definition); + } + + public function setRootDefinitionSource(DefinitionSource $rootSource) + { + $this->rootSource = $rootSource; + } + + private function resolveSubDefinition(HasSubDefinition $definition, $currentIndex) + { + $subDefinitionName = $definition->getSubDefinitionName(); + + if ($subDefinitionName === $definition->getName()) { + // Extending itself: look in the next sources only (else infinite recursion) + $subDefinition = $this->getDefinition($subDefinitionName, $currentIndex + 1); + } else { + // Extending another definition: look from the root + $subDefinition = $this->rootSource->getDefinition($subDefinitionName); + } + + if ($subDefinition) { + $definition->setSubDefinition($subDefinition); + } + } + + public function setMutableDefinitionSource(MutableDefinitionSource $mutableSource) + { + $this->mutableSource = $mutableSource; + + array_unshift($this->sources, $mutableSource); + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/StringDefinition.php b/vendor/php-di/php-di/src/DI/Definition/StringDefinition.php new file mode 100644 index 0000000..bae3ecf --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/StringDefinition.php @@ -0,0 +1,95 @@ + + */ +class StringDefinition implements Definition, SelfResolvingDefinition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * @var string + */ + private $expression; + + /** + * @param string $name Entry name + * @param string $expression + */ + public function __construct($name, $expression) + { + $this->name = $name; + $this->expression = $expression; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return Scope::SINGLETON; + } + + /** + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + public function resolve(ContainerInterface $container) + { + $expression = $this->expression; + + $result = preg_replace_callback('#\{([^\{\}]+)\}#', function (array $matches) use ($container) { + try { + return $container->get($matches[1]); + } catch (NotFoundExceptionInterface $e) { + throw new DependencyException(sprintf( + "Error while parsing string expression for entry '%s': %s", + $this->getName(), + $e->getMessage() + ), 0, $e); + } + }, $expression); + + if ($result === null) { + throw new \RuntimeException(sprintf('An unknown error occurred while parsing the string definition: \'%s\'', $expression)); + } + + return $result; + } + + public function isResolvable(ContainerInterface $container) + { + return true; + } + + public function __toString() + { + return $this->expression; + } +} diff --git a/vendor/php-di/php-di/src/DI/Definition/ValueDefinition.php b/vendor/php-di/php-di/src/DI/Definition/ValueDefinition.php new file mode 100644 index 0000000..79f72a7 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Definition/ValueDefinition.php @@ -0,0 +1,76 @@ + + */ +class ValueDefinition implements Definition, SelfResolvingDefinition +{ + /** + * Entry name. + * @var string + */ + private $name; + + /** + * @var mixed + */ + private $value; + + /** + * @param string $name Entry name + * @param mixed $value + */ + public function __construct($name, $value) + { + $this->name = $name; + $this->value = $value; + } + + /** + * @return string Entry name + */ + public function getName() + { + return $this->name; + } + + /** + * A value definition is like a constant, there is nothing to compute, the value is the same for everyone. + * + * {@inheritdoc} + */ + public function getScope() + { + return Scope::SINGLETON; + } + + /** + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + public function resolve(ContainerInterface $container) + { + return $this->getValue(); + } + + public function isResolvable(ContainerInterface $container) + { + return true; + } + + public function __toString() + { + return sprintf('Value (%s)', var_export($this->value, true)); + } +} diff --git a/vendor/php-di/php-di/src/DI/DependencyException.php b/vendor/php-di/php-di/src/DI/DependencyException.php new file mode 100644 index 0000000..1dce92e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/DependencyException.php @@ -0,0 +1,12 @@ + + */ +interface RequestedEntry +{ + /** + * Returns the name of the entry that was requested by the container. + * + * @return string + */ + public function getName(); +} diff --git a/vendor/php-di/php-di/src/DI/FactoryInterface.php b/vendor/php-di/php-di/src/DI/FactoryInterface.php new file mode 100644 index 0000000..f14a3ca --- /dev/null +++ b/vendor/php-di/php-di/src/DI/FactoryInterface.php @@ -0,0 +1,27 @@ + + */ +interface FactoryInterface +{ + /** + * Resolves an entry by its name. If given a class name, it will return a new instance of that class. + * + * @param string $name Entry name or a class name. + * @param array $parameters Optional parameters to use to build the entry. Use this to force specific + * parameters to specific values. Parameters not defined in this array will + * be automatically resolved. + * + * @throws \InvalidArgumentException The name parameter must be of type string. + * @throws DependencyException Error while resolving the entry. + * @throws NotFoundException No entry or class found for the given name. + * @return mixed + */ + public function make($name, array $parameters = []); +} diff --git a/vendor/php-di/php-di/src/DI/Invoker/DefinitionParameterResolver.php b/vendor/php-di/php-di/src/DI/Invoker/DefinitionParameterResolver.php new file mode 100644 index 0000000..f9718f2 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Invoker/DefinitionParameterResolver.php @@ -0,0 +1,66 @@ + + */ +class DefinitionParameterResolver implements ParameterResolver +{ + /** + * @var DefinitionResolver + */ + private $definitionResolver; + + public function __construct(DefinitionResolver $definitionResolver) + { + $this->definitionResolver = $definitionResolver; + } + + /** + * {@inheritdoc} + */ + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $providedParameters = array_diff_key($providedParameters, $resolvedParameters); + } + + foreach ($providedParameters as $key => $value) { + if (! $value instanceof DefinitionHelper) { + continue; + } + + $definition = $value->getDefinition(''); + $value = $this->definitionResolver->resolve($definition); + + if (is_int($key)) { + // Indexed by position + $resolvedParameters[$key] = $value; + } else { + // Indexed by parameter name + // TODO optimize? + $reflectionParameters = $reflection->getParameters(); + foreach ($reflectionParameters as $reflectionParameter) { + if ($key === $reflectionParameter->name) { + $resolvedParameters[$reflectionParameter->getPosition()] = $value; + } + } + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/php-di/src/DI/Invoker/FactoryParameterResolver.php b/vendor/php-di/php-di/src/DI/Invoker/FactoryParameterResolver.php new file mode 100644 index 0000000..6dc9433 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Invoker/FactoryParameterResolver.php @@ -0,0 +1,62 @@ + + * @author Matthieu Napoli + */ +class FactoryParameterResolver implements ParameterResolver +{ + /** + * @var ContainerInterface + */ + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getParameters( + ReflectionFunctionAbstract $reflection, + array $providedParameters, + array $resolvedParameters + ) { + $parameters = $reflection->getParameters(); + + // Skip parameters already resolved + if (! empty($resolvedParameters)) { + $parameters = array_diff_key($parameters, $resolvedParameters); + } + + foreach ($parameters as $index => $parameter) { + $parameterClass = $parameter->getClass(); + + if (!$parameterClass) { + continue; + } + + if ($parameterClass->name === 'Interop\Container\ContainerInterface' + || $parameterClass->name === 'Psr\Container\ContainerInterface') { + $resolvedParameters[$index] = $this->container; + } elseif ($parameterClass->name === 'DI\Factory\RequestedEntry') { + // By convention the second parameter is the definition + $resolvedParameters[$index] = $providedParameters[1]; + } elseif ($this->container->has($parameterClass->name)) { + $resolvedParameters[$index] = $this->container->get($parameterClass->name); + } + } + + return $resolvedParameters; + } +} diff --git a/vendor/php-di/php-di/src/DI/InvokerInterface.php b/vendor/php-di/php-di/src/DI/InvokerInterface.php new file mode 100644 index 0000000..d51286e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/InvokerInterface.php @@ -0,0 +1,12 @@ + + */ +interface InvokerInterface extends \Invoker\InvokerInterface +{ +} diff --git a/vendor/php-di/php-di/src/DI/NotFoundException.php b/vendor/php-di/php-di/src/DI/NotFoundException.php new file mode 100644 index 0000000..b725943 --- /dev/null +++ b/vendor/php-di/php-di/src/DI/NotFoundException.php @@ -0,0 +1,12 @@ + + */ +class ProxyFactory +{ + /** + * If true, write the proxies to disk to improve performances. + * @var bool + */ + private $writeProxiesToFile; + + /** + * Directory where to write the proxies (if $writeProxiesToFile is enabled). + * @var string + */ + private $proxyDirectory; + + /** + * @var LazyLoadingValueHolderFactory|null + */ + private $proxyManager; + + public function __construct($writeProxiesToFile, $proxyDirectory = null) + { + $this->writeProxiesToFile = $writeProxiesToFile; + $this->proxyDirectory = $proxyDirectory; + } + + /** + * Creates a new lazy proxy instance of the given class with + * the given initializer. + * + * @param string $className name of the class to be proxied + * @param \Closure $initializer initializer to be passed to the proxy + * + * @return \ProxyManager\Proxy\LazyLoadingInterface + */ + public function createProxy($className, \Closure $initializer) + { + $this->createProxyManager(); + + return $this->proxyManager->createProxy($className, $initializer); + } + + private function createProxyManager() + { + if ($this->proxyManager !== null) { + return; + } + + if (! class_exists(Configuration::class)) { + throw new \RuntimeException('The ocramius/proxy-manager library is not installed. Lazy injection requires that library to be installed with Composer in order to work. Run "composer require ocramius/proxy-manager:~1.0".'); + } + + $config = new Configuration(); + + if ($this->writeProxiesToFile) { + $config->setProxiesTargetDir($this->proxyDirectory); + $config->setGeneratorStrategy(new FileWriterGeneratorStrategy(new FileLocator($this->proxyDirectory))); + spl_autoload_register($config->getProxyAutoloader()); + } else { + $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); + } + + $this->proxyManager = new LazyLoadingValueHolderFactory($config); + } +} diff --git a/vendor/php-di/php-di/src/DI/Scope.php b/vendor/php-di/php-di/src/DI/Scope.php new file mode 100644 index 0000000..a7b424e --- /dev/null +++ b/vendor/php-di/php-di/src/DI/Scope.php @@ -0,0 +1,47 @@ + + */ +class Scope +{ + /** + * A singleton entry will be computed once and shared. + * + * For a class, only a single instance of the class will be created. + */ + const SINGLETON = 'singleton'; + + /** + * A prototype entry will be recomputed each time it is asked. + * + * For a class, this will create a new instance each time. + */ + const PROTOTYPE = 'prototype'; + + /** + * Method kept for backward compatibility, use the constant instead. + * + * @return string + */ + public static function SINGLETON() + { + return self::SINGLETON; + } + + /** + * Method kept for backward compatibility, use the constant instead. + * + * @return string + */ + public static function PROTOTYPE() + { + return self::PROTOTYPE; + } +} diff --git a/vendor/php-di/php-di/src/DI/functions.php b/vendor/php-di/php-di/src/DI/functions.php new file mode 100644 index 0000000..bfebc4a --- /dev/null +++ b/vendor/php-di/php-di/src/DI/functions.php @@ -0,0 +1,174 @@ + decorate(function ($foo, $container) { + * return new CachedFoo($foo, $container->get('cache')); + * }) + * + * @param callable $callable The callable takes the decorated object as first parameter and + * the container as second. + * + * @return FactoryDefinitionHelper + */ + function decorate($callable) + { + return new FactoryDefinitionHelper($callable, true); + } +} + +if (! function_exists('DI\get')) { + /** + * Helper for referencing another container entry in an object definition. + * + * @param string $entryName + * + * @return EntryReference + */ + function get($entryName) + { + return new EntryReference($entryName); + } +} + +if (! function_exists('DI\link')) { + /** + * Helper for referencing another container entry in an object definition. + * + * @deprecated \DI\link() has been replaced by \DI\get() + * + * @param string $entryName + * + * @return EntryReference + */ + function link($entryName) + { + return new EntryReference($entryName); + } +} + +if (! function_exists('DI\env')) { + /** + * Helper for referencing environment variables. + * + * @param string $variableName The name of the environment variable. + * @param mixed $defaultValue The default value to be used if the environment variable is not defined. + * + * @return EnvironmentVariableDefinitionHelper + */ + function env($variableName, $defaultValue = null) + { + // Only mark as optional if the default value was *explicitly* provided. + $isOptional = 2 === func_num_args(); + + return new EnvironmentVariableDefinitionHelper($variableName, $isOptional, $defaultValue); + } +} + +if (! function_exists('DI\add')) { + /** + * Helper for extending another definition. + * + * Example: + * + * 'log.backends' => DI\add(DI\get('My\Custom\LogBackend')) + * + * or: + * + * 'log.backends' => DI\add([ + * DI\get('My\Custom\LogBackend') + * ]) + * + * @param mixed|array $values A value or an array of values to add to the array. + * + * @return ArrayDefinitionExtensionHelper + * + * @since 5.0 + */ + function add($values) + { + if (! is_array($values)) { + $values = [$values]; + } + + return new ArrayDefinitionExtensionHelper($values); + } +} + +if (! function_exists('DI\string')) { + /** + * Helper for concatenating strings. + * + * Example: + * + * 'log.filename' => DI\string('{app.path}/app.log') + * + * @param string $expression A string expression. Use the `{}` placeholders to reference other container entries. + * + * @return StringDefinitionHelper + * + * @since 5.0 + */ + function string($expression) + { + return new StringDefinitionHelper((string) $expression); + } +} diff --git a/vendor/php-di/phpdoc-reader/.gitattributes b/vendor/php-di/phpdoc-reader/.gitattributes new file mode 100644 index 0000000..912292c --- /dev/null +++ b/vendor/php-di/phpdoc-reader/.gitattributes @@ -0,0 +1,7 @@ +# .gitattributes +tests/ export-ignore +phpunit.xml.dist export-ignore +.travis.yml export-ignore + +# Auto detect text files and perform LF normalization +* text=auto diff --git a/vendor/php-di/phpdoc-reader/.gitignore b/vendor/php-di/phpdoc-reader/.gitignore new file mode 100644 index 0000000..f7be360 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +.idea/* +vendor/* +composer.phar +composer.lock diff --git a/vendor/php-di/phpdoc-reader/LICENSE b/vendor/php-di/phpdoc-reader/LICENSE new file mode 100644 index 0000000..f859a31 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2015 Matthieu Napoli + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/php-di/phpdoc-reader/README.md b/vendor/php-di/phpdoc-reader/README.md new file mode 100644 index 0000000..cbcf3a8 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/README.md @@ -0,0 +1,58 @@ +# PhpDocReader + +[![Build Status](https://img.shields.io/travis/PHP-DI/PhpDocReader.svg)](https://travis-ci.org/mnapoli/PhpDocReader) +![](https://img.shields.io/packagist/dt/PHP-DI/phpdoc-reader.svg) + +This project is used by: + +- [PHP-DI](http://php-di.org/) +- [phockito-unit-php-di](https://github.com/balihoo/phockito-unit-php-di) + +Fork the README to add your project here. + +## Features + +PhpDocReader parses `@var` and `@param` values in PHP docblocks: + +```php + +use My\Cache\Backend; + +class Cache +{ + /** + * @var Backend + */ + protected $backend; + + /** + * @param Backend $backend + */ + public function __construct($backend) + { + } +} +``` + +It supports namespaced class names with the same resolution rules as PHP: + +- fully qualified name (starting with `\`) +- imported class name (eg. `use My\Cache\Backend;`) +- relative class name (from the current namespace, like `SubNamespace\MyClass`) +- aliased class name (eg. `use My\Cache\Backend as FooBar;`) + +Primitive types (`@var string`) are ignored (returns null), only valid class names are returned. + +## Usage + +```php +$reader = new PhpDocReader(); + +// Read a property type (@var phpdoc) +$property = new ReflectionProperty($className, $propertyName); +$propertyClass = $reader->getPropertyClass($property); + +// Read a parameter type (@param phpdoc) +$parameter = new ReflectionParameter(array($className, $methodName), $parameterName); +$parameterClass = $reader->getParameterClass($parameter); +``` diff --git a/vendor/php-di/phpdoc-reader/composer.json b/vendor/php-di/phpdoc-reader/composer.json new file mode 100644 index 0000000..6771307 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/composer.json @@ -0,0 +1,23 @@ +{ + "name": "php-di/phpdoc-reader", + "type": "library", + "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", + "keywords": ["phpdoc", "reflection"], + "license": "MIT", + "autoload": { + "psr-4": { + "PhpDocReader\\": "src/PhpDocReader" + } + }, + "autoload-dev": { + "psr-4": { + "UnitTest\\PhpDocReader\\": "tests/" + } + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.6" + } +} diff --git a/vendor/php-di/phpdoc-reader/src/PhpDocReader/AnnotationException.php b/vendor/php-di/phpdoc-reader/src/PhpDocReader/AnnotationException.php new file mode 100644 index 0000000..577d73f --- /dev/null +++ b/vendor/php-di/phpdoc-reader/src/PhpDocReader/AnnotationException.php @@ -0,0 +1,10 @@ + + */ +class AnnotationException extends \Exception +{ +} diff --git a/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpDocReader.php b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpDocReader.php new file mode 100644 index 0000000..8cf2bf3 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpDocReader.php @@ -0,0 +1,311 @@ + + */ +class PhpDocReader +{ + /** + * @var UseStatementParser + */ + private $parser; + + private $ignoredTypes = array( + 'bool', + 'boolean', + 'string', + 'int', + 'integer', + 'float', + 'double', + 'array', + 'object', + 'callable', + 'resource', + 'mixed', + ); + + /** + * Enable or disable throwing errors when PhpDoc Errors occur (when parsing annotations) + * + * @var bool + */ + private $ignorePhpDocErrors; + + /** + * + * @param bool $ignorePhpDocErrors + */ + public function __construct($ignorePhpDocErrors = false) + { + $this->parser = new UseStatementParser(); + $this->ignorePhpDocErrors = $ignorePhpDocErrors; + } + + /** + * Parse the docblock of the property to get the class of the var annotation. + * + * @param ReflectionProperty $property + * + * @throws AnnotationException + * @return string|null Type of the property (content of var annotation) + * + * @deprecated Use getPropertyClass instead. + */ + public function getPropertyType(ReflectionProperty $property) + { + return $this->getPropertyClass($property); + } + + /** + * Parse the docblock of the property to get the class of the var annotation. + * + * @param ReflectionProperty $property + * + * @throws AnnotationException + * @return string|null Type of the property (content of var annotation) + */ + public function getPropertyClass(ReflectionProperty $property) + { + // Get the content of the @var annotation + if (preg_match('/@var\s+([^\s]+)/', $property->getDocComment(), $matches)) { + list(, $type) = $matches; + } else { + return null; + } + + // Ignore primitive types + if (in_array($type, $this->ignoredTypes)) { + return null; + } + + // Ignore types containing special characters ([], <> ...) + if (! preg_match('/^[a-zA-Z0-9\\\\_]+$/', $type)) { + return null; + } + + $class = $property->getDeclaringClass(); + + // If the class name is not fully qualified (i.e. doesn't start with a \) + if ($type[0] !== '\\') { + // Try to resolve the FQN using the class context + $resolvedType = $this->tryResolveFqn($type, $class, $property); + + if (!$resolvedType && !$this->ignorePhpDocErrors) { + throw new AnnotationException(sprintf( + 'The @var annotation on %s::%s contains a non existent class "%s". ' + . 'Did you maybe forget to add a "use" statement for this annotation?', + $class->name, + $property->getName(), + $type + )); + } + + $type = $resolvedType; + } + + if (!$this->classExists($type) && !$this->ignorePhpDocErrors) { + throw new AnnotationException(sprintf( + 'The @var annotation on %s::%s contains a non existent class "%s"', + $class->name, + $property->getName(), + $type + )); + } + + // Remove the leading \ (FQN shouldn't contain it) + $type = ltrim($type, '\\'); + + return $type; + } + + /** + * Parse the docblock of the property to get the class of the param annotation. + * + * @param ReflectionParameter $parameter + * + * @throws AnnotationException + * @return string|null Type of the property (content of var annotation) + * + * @deprecated Use getParameterClass instead. + */ + public function getParameterType(ReflectionParameter $parameter) + { + return $this->getParameterClass($parameter); + } + + /** + * Parse the docblock of the property to get the class of the param annotation. + * + * @param ReflectionParameter $parameter + * + * @throws AnnotationException + * @return string|null Type of the property (content of var annotation) + */ + public function getParameterClass(ReflectionParameter $parameter) + { + // Use reflection + $parameterClass = $parameter->getClass(); + if ($parameterClass !== null) { + return $parameterClass->name; + } + + $parameterName = $parameter->name; + // Get the content of the @param annotation + $method = $parameter->getDeclaringFunction(); + if (preg_match('/@param\s+([^\s]+)\s+\$' . $parameterName . '/', $method->getDocComment(), $matches)) { + list(, $type) = $matches; + } else { + return null; + } + + // Ignore primitive types + if (in_array($type, $this->ignoredTypes)) { + return null; + } + + // Ignore types containing special characters ([], <> ...) + if (! preg_match('/^[a-zA-Z0-9\\\\_]+$/', $type)) { + return null; + } + + $class = $parameter->getDeclaringClass(); + + // If the class name is not fully qualified (i.e. doesn't start with a \) + if ($type[0] !== '\\') { + // Try to resolve the FQN using the class context + $resolvedType = $this->tryResolveFqn($type, $class, $parameter); + + if (!$resolvedType && !$this->ignorePhpDocErrors) { + throw new AnnotationException(sprintf( + 'The @param annotation for parameter "%s" of %s::%s contains a non existent class "%s". ' + . 'Did you maybe forget to add a "use" statement for this annotation?', + $parameterName, + $class->name, + $method->name, + $type + )); + } + + $type = $resolvedType; + } + + if (!$this->classExists($type) && !$this->ignorePhpDocErrors) { + throw new AnnotationException(sprintf( + 'The @param annotation for parameter "%s" of %s::%s contains a non existent class "%s"', + $parameterName, + $class->name, + $method->name, + $type + )); + } + + // Remove the leading \ (FQN shouldn't contain it) + $type = ltrim($type, '\\'); + + return $type; + } + + /** + * Attempts to resolve the FQN of the provided $type based on the $class and $member context. + * + * @param string $type + * @param ReflectionClass $class + * @param Reflector $member + * + * @return string|null Fully qualified name of the type, or null if it could not be resolved + */ + private function tryResolveFqn($type, ReflectionClass $class, Reflector $member) + { + $alias = ($pos = strpos($type, '\\')) === false ? $type : substr($type, 0, $pos); + $loweredAlias = strtolower($alias); + + // Retrieve "use" statements + $uses = $this->parser->parseUseStatements($class); + + if (isset($uses[$loweredAlias])) { + // Imported classes + if ($pos !== false) { + return $uses[$loweredAlias] . substr($type, $pos); + } else { + return $uses[$loweredAlias]; + } + } elseif ($this->classExists($class->getNamespaceName() . '\\' . $type)) { + return $class->getNamespaceName() . '\\' . $type; + } elseif (isset($uses['__NAMESPACE__']) && $this->classExists($uses['__NAMESPACE__'] . '\\' . $type)) { + // Class namespace + return $uses['__NAMESPACE__'] . '\\' . $type; + } elseif ($this->classExists($type)) { + // No namespace + return $type; + } + + if (version_compare(phpversion(), '5.4.0', '<')) { + return null; + } else { + // If all fail, try resolving through related traits + return $this->tryResolveFqnInTraits($type, $class, $member); + } + } + + /** + * Attempts to resolve the FQN of the provided $type based on the $class and $member context, specifically searching + * through the traits that are used by the provided $class. + * + * @param string $type + * @param ReflectionClass $class + * @param Reflector $member + * + * @return string|null Fully qualified name of the type, or null if it could not be resolved + */ + private function tryResolveFqnInTraits($type, ReflectionClass $class, Reflector $member) + { + /** @var ReflectionClass[] $traits */ + $traits = array(); + + // Get traits for the class and its parents + while ($class) { + $traits = array_merge($traits, $class->getTraits()); + $class = $class->getParentClass(); + } + + foreach ($traits as $trait) { + // Eliminate traits that don't have the property/method/parameter + if ($member instanceof ReflectionProperty && !$trait->hasProperty($member->name)) { + continue; + } elseif ($member instanceof ReflectionMethod && !$trait->hasMethod($member->name)) { + continue; + } elseif ($member instanceof ReflectionParameter && !$trait->hasMethod($member->getDeclaringFunction()->name)) { + continue; + } + + // Run the resolver again with the ReflectionClass instance for the trait + $resolvedType = $this->tryResolveFqn($type, $trait, $member); + + if ($resolvedType) { + return $resolvedType; + } + } + return null; + } + + /** + * @param string $class + * @return bool + */ + private function classExists($class) + { + return class_exists($class) || interface_exists($class); + } +} diff --git a/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/TokenParser.php b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/TokenParser.php new file mode 100644 index 0000000..d3965d7 --- /dev/null +++ b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/TokenParser.php @@ -0,0 +1,159 @@ + + * @author Christian Kaps + */ +class TokenParser +{ + /** + * The token list. + * + * @var array + */ + private $tokens; + + /** + * The number of tokens. + * + * @var int + */ + private $numTokens; + + /** + * The current array pointer. + * + * @var int + */ + private $pointer = 0; + + /** + * @param string $contents + */ + public function __construct($contents) + { + $this->tokens = token_get_all($contents); + + // The PHP parser sets internal compiler globals for certain things. Annoyingly, the last docblock comment it + // saw gets stored in doc_comment. When it comes to compile the next thing to be include()d this stored + // doc_comment becomes owned by the first thing the compiler sees in the file that it considers might have a + // docblock. If the first thing in the file is a class without a doc block this would cause calls to + // getDocBlock() on said class to return our long lost doc_comment. Argh. + // To workaround, cause the parser to parse an empty docblock. Sure getDocBlock() will return this, but at least + // it's harmless to us. + token_get_all("numTokens = count($this->tokens); + } + + /** + * Gets all use statements. + * + * @param string $namespaceName The namespace name of the reflected class. + * + * @return array A list with all found use statements. + */ + public function parseUseStatements($namespaceName) + { + $statements = array(); + while (($token = $this->next())) { + if ($token[0] === T_USE) { + $statements = array_merge($statements, $this->parseUseStatement()); + continue; + } + if ($token[0] !== T_NAMESPACE || $this->parseNamespace() != $namespaceName) { + continue; + } + + // Get fresh array for new namespace. This is to prevent the parser to collect the use statements + // for a previous namespace with the same name. This is the case if a namespace is defined twice + // or if a namespace with the same name is commented out. + $statements = array(); + } + + return $statements; + } + + /** + * Gets the next non whitespace and non comment token. + * + * @param boolean $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped. + * If FALSE then only whitespace and normal comments are skipped. + * + * @return array|null The token if exists, null otherwise. + */ + private function next($docCommentIsComment = true) + { + for ($i = $this->pointer; $i < $this->numTokens; $i++) { + $this->pointer++; + if ($this->tokens[$i][0] === T_WHITESPACE || + $this->tokens[$i][0] === T_COMMENT || + ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT)) { + + continue; + } + + return $this->tokens[$i]; + } + + return null; + } + + /** + * Parses a single use statement. + * + * @return array A list with all found class names for a use statement. + */ + private function parseUseStatement() + { + $class = ''; + $alias = ''; + $statements = array(); + $explicitAlias = false; + while (($token = $this->next())) { + $isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR; + if (!$explicitAlias && $isNameToken) { + $class .= $token[1]; + $alias = $token[1]; + } elseif ($explicitAlias && $isNameToken) { + $alias .= $token[1]; + } elseif ($token[0] === T_AS) { + $explicitAlias = true; + $alias = ''; + } elseif ($token === ',') { + $statements[strtolower($alias)] = $class; + $class = ''; + $alias = ''; + $explicitAlias = false; + } elseif ($token === ';') { + $statements[strtolower($alias)] = $class; + break; + } else { + break; + } + } + + return $statements; + } + + /** + * Gets the namespace. + * + * @return string The found namespace. + */ + private function parseNamespace() + { + $name = ''; + while (($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR)) { + $name .= $token[1]; + } + + return $name; + } +} diff --git a/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/UseStatementParser.php b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/UseStatementParser.php new file mode 100644 index 0000000..1b0d63d --- /dev/null +++ b/vendor/php-di/phpdoc-reader/src/PhpDocReader/PhpParser/UseStatementParser.php @@ -0,0 +1,68 @@ + + * @author Christian Kaps + */ +class UseStatementParser +{ + /** + * @return array A list with use statements in the form (Alias => FQN). + */ + public function parseUseStatements(\ReflectionClass $class) + { + if (false === $filename = $class->getFilename()) { + return array(); + } + + $content = $this->getFileContent($filename, $class->getStartLine()); + + if (null === $content) { + return array(); + } + + $namespace = preg_quote($class->getNamespaceName()); + $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); + $tokenizer = new TokenParser('parseUseStatements($class->getNamespaceName()); + + return $statements; + } + + /** + * Gets the content of the file right up to the given line number. + * + * @param string $filename The name of the file to load. + * @param integer $lineNumber The number of lines to read from file. + * + * @return string The content of the file. + */ + private function getFileContent($filename, $lineNumber) + { + if ( ! is_file($filename)) { + return null; + } + + $content = ''; + $lineCnt = 0; + $file = new SplFileObject($filename); + while (!$file->eof()) { + if ($lineCnt++ == $lineNumber) { + break; + } + + $content .= $file->fgets(); + } + + return $content; + } +} diff --git a/vendor/phpdocumentor/reflection-common/.travis.yml b/vendor/phpdocumentor/reflection-common/.travis.yml new file mode 100644 index 0000000..958ecf8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/.travis.yml @@ -0,0 +1,35 @@ +language: php +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - hhvm + - nightly + +matrix: + allow_failures: + - php: + - hhvm + - nightly + +cache: + directories: + - $HOME/.composer/cache + +script: + - vendor/bin/phpunit --coverage-clover=coverage.clover -v + - composer update --no-interaction --prefer-source + - vendor/bin/phpunit -v + +before_script: + - composer install --no-interaction + +after_script: + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi + +notifications: + irc: "irc.freenode.org#phpdocumentor" + email: + - me@mikevanriel.com + - ashnazg@php.net diff --git a/vendor/phpdocumentor/reflection-common/LICENSE b/vendor/phpdocumentor/reflection-common/LICENSE new file mode 100644 index 0000000..ed6926c --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 phpDocumentor + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/phpdocumentor/reflection-common/README.md b/vendor/phpdocumentor/reflection-common/README.md new file mode 100644 index 0000000..68a80c8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/README.md @@ -0,0 +1,2 @@ +# ReflectionCommon +[![Build Status](https://travis-ci.org/phpDocumentor/ReflectionCommon.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionCommon) diff --git a/vendor/phpdocumentor/reflection-common/composer.json b/vendor/phpdocumentor/reflection-common/composer.json new file mode 100644 index 0000000..90eee0f --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/composer.json @@ -0,0 +1,29 @@ +{ + "name": "phpdocumentor/reflection-common", + "keywords": ["phpdoc", "phpDocumentor", "reflection", "static analysis", "FQSEN"], + "homepage": "http://www.phpdoc.org", + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "license": "MIT", + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "require": { + "php": ">=5.5" + }, + "autoload" : { + "psr-4" : { + "phpDocumentor\\Reflection\\": ["src"] + } + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Element.php b/vendor/phpdocumentor/reflection-common/src/Element.php new file mode 100644 index 0000000..712e30e --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Element.php @@ -0,0 +1,32 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +/** + * Interface for files processed by the ProjectFactory + */ +interface File +{ + /** + * Returns the content of the file as a string. + * + * @return string + */ + public function getContents(); + + /** + * Returns md5 hash of the file. + * + * @return string + */ + public function md5(); + + /** + * Returns an relative path to the file. + * + * @return string + */ + public function path(); +} diff --git a/vendor/phpdocumentor/reflection-common/src/Fqsen.php b/vendor/phpdocumentor/reflection-common/src/Fqsen.php new file mode 100644 index 0000000..ce88d03 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Fqsen.php @@ -0,0 +1,82 @@ +fqsen = $fqsen; + + if (isset($matches[2])) { + $this->name = $matches[2]; + } else { + $matches = explode('\\', $fqsen); + $this->name = trim(end($matches), '()'); + } + } + + /** + * converts this class to string. + * + * @return string + */ + public function __toString() + { + return $this->fqsen; + } + + /** + * Returns the name of the element without path. + * + * @return string + */ + public function getName() + { + return $this->name; + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Location.php b/vendor/phpdocumentor/reflection-common/src/Location.php new file mode 100644 index 0000000..5760321 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Location.php @@ -0,0 +1,57 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +/** + * The location where an element occurs within a file. + */ +final class Location +{ + /** @var int */ + private $lineNumber = 0; + + /** @var int */ + private $columnNumber = 0; + + /** + * Initializes the location for an element using its line number in the file and optionally the column number. + * + * @param int $lineNumber + * @param int $columnNumber + */ + public function __construct($lineNumber, $columnNumber = 0) + { + $this->lineNumber = $lineNumber; + $this->columnNumber = $columnNumber; + } + + /** + * Returns the line number that is covered by this location. + * + * @return integer + */ + public function getLineNumber() + { + return $this->lineNumber; + } + + /** + * Returns the column number (character position on a line) for this location object. + * + * @return integer + */ + public function getColumnNumber() + { + return $this->columnNumber; + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Project.php b/vendor/phpdocumentor/reflection-common/src/Project.php new file mode 100644 index 0000000..3ed1e39 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Project.php @@ -0,0 +1,25 @@ +create($docComment); +``` + +The `create` method will yield an object of type `\phpDocumentor\Reflection\DocBlock` +whose methods can be queried: + +```php +// Contains the summary for this DocBlock +$summary = $docblock->getSummary(); + +// Contains \phpDocumentor\Reflection\DocBlock\Description object +$description = $docblock->getDescription(); + +// You can either cast it to string +$description = (string) $docblock->getDescription(); + +// Or use the render method to get a string representation of the Description. +$description = $docblock->getDescription()->render(); +``` + +> For more examples it would be best to review the scripts in the [`/examples` folder](/examples). diff --git a/vendor/phpdocumentor/reflection-docblock/composer.json b/vendor/phpdocumentor/reflection-docblock/composer.json new file mode 100644 index 0000000..e3dc38a --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phpdocumentor/reflection-docblock", + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "autoload": { + "psr-4": {"phpDocumentor\\Reflection\\": ["src/"]} + }, + "autoload-dev": { + "psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]} + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4", + "doctrine/instantiator": "~1.0.5" + }, + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon b/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon new file mode 100644 index 0000000..7c2ba6e --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon @@ -0,0 +1,31 @@ +includes: + - temp/ecs/config/clean-code.neon + - temp/ecs/config/psr2-checkers.neon + - temp/ecs/config/spaces.neon + - temp/ecs/config/common.neon + +checkers: + PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: + spacing: one + +parameters: + exclude_checkers: + # from temp/ecs/config/common.neon + - PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer + - PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer + - PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer + # from temp/ecs/config/spaces.neon + - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer + + skip: + SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: + # WIP code + - src/DocBlock/StandardTagFactory.php + PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff: + # WIP code + - src/DocBlock/StandardTagFactory.php + PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: + - src/DocBlock/Tags/Return_.php + - src/DocBlock/Tags/Var_.php + PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: + - */tests/** diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php new file mode 100644 index 0000000..46605b7 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php @@ -0,0 +1,236 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\DocBlock\Tag; +use Webmozart\Assert\Assert; + +final class DocBlock +{ + /** @var string The opening line for this docblock. */ + private $summary = ''; + + /** @var DocBlock\Description The actual description for this docblock. */ + private $description = null; + + /** @var Tag[] An array containing all the tags in this docblock; except inline. */ + private $tags = []; + + /** @var Types\Context Information about the context of this DocBlock. */ + private $context = null; + + /** @var Location Information about the location of this DocBlock. */ + private $location = null; + + /** @var bool Is this DocBlock (the start of) a template? */ + private $isTemplateStart = false; + + /** @var bool Does this DocBlock signify the end of a DocBlock template? */ + private $isTemplateEnd = false; + + /** + * @param string $summary + * @param DocBlock\Description $description + * @param DocBlock\Tag[] $tags + * @param Types\Context $context The context in which the DocBlock occurs. + * @param Location $location The location within the file that this DocBlock occurs in. + * @param bool $isTemplateStart + * @param bool $isTemplateEnd + */ + public function __construct( + $summary = '', + DocBlock\Description $description = null, + array $tags = [], + Types\Context $context = null, + Location $location = null, + $isTemplateStart = false, + $isTemplateEnd = false + ) { + Assert::string($summary); + Assert::boolean($isTemplateStart); + Assert::boolean($isTemplateEnd); + Assert::allIsInstanceOf($tags, Tag::class); + + $this->summary = $summary; + $this->description = $description ?: new DocBlock\Description(''); + foreach ($tags as $tag) { + $this->addTag($tag); + } + + $this->context = $context; + $this->location = $location; + + $this->isTemplateEnd = $isTemplateEnd; + $this->isTemplateStart = $isTemplateStart; + } + + /** + * @return string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * @return DocBlock\Description + */ + public function getDescription() + { + return $this->description; + } + + /** + * Returns the current context. + * + * @return Types\Context + */ + public function getContext() + { + return $this->context; + } + + /** + * Returns the current location. + * + * @return Location + */ + public function getLocation() + { + return $this->location; + } + + /** + * Returns whether this DocBlock is the start of a Template section. + * + * A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker + * (`#@+`) that is appended directly after the opening `/**` of a DocBlock. + * + * An example of such an opening is: + * + * ``` + * /**#@+ + * * My DocBlock + * * / + * ``` + * + * The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all + * elements that follow until another DocBlock is found that contains the closing marker (`#@-`). + * + * @see self::isTemplateEnd() for the check whether a closing marker was provided. + * + * @return boolean + */ + public function isTemplateStart() + { + return $this->isTemplateStart; + } + + /** + * Returns whether this DocBlock is the end of a Template section. + * + * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. + * + * @return boolean + */ + public function isTemplateEnd() + { + return $this->isTemplateEnd; + } + + /** + * Returns the tags for this DocBlock. + * + * @return Tag[] + */ + public function getTags() + { + return $this->tags; + } + + /** + * Returns an array of tags matching the given name. If no tags are found + * an empty array is returned. + * + * @param string $name String to search by. + * + * @return Tag[] + */ + public function getTagsByName($name) + { + Assert::string($name); + + $result = []; + + /** @var Tag $tag */ + foreach ($this->getTags() as $tag) { + if ($tag->getName() !== $name) { + continue; + } + + $result[] = $tag; + } + + return $result; + } + + /** + * Checks if a tag of a certain type is present in this DocBlock. + * + * @param string $name Tag name to check for. + * + * @return bool + */ + public function hasTag($name) + { + Assert::string($name); + + /** @var Tag $tag */ + foreach ($this->getTags() as $tag) { + if ($tag->getName() === $name) { + return true; + } + } + + return false; + } + + /** + * Remove a tag from this DocBlock. + * + * @param Tag $tag The tag to remove. + * + * @return void + */ + public function removeTag(Tag $tagToRemove) + { + foreach ($this->tags as $key => $tag) { + if ($tag === $tagToRemove) { + unset($this->tags[$key]); + break; + } + } + } + + /** + * Adds a tag to this DocBlock. + * + * @param Tag $tag The tag to add. + * + * @return void + */ + private function addTag(Tag $tag) + { + $this->tags[] = $tag; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php new file mode 100644 index 0000000..25a79e0 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php @@ -0,0 +1,114 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; +use Webmozart\Assert\Assert; + +/** + * Object representing to description for a DocBlock. + * + * A Description object can consist of plain text but can also include tags. A Description Formatter can then combine + * a body template with sprintf-style placeholders together with formatted tags in order to reconstitute a complete + * description text using the format that you would prefer. + * + * Because parsing a Description text can be a verbose process this is handled by the {@see DescriptionFactory}. It is + * thus recommended to use that to create a Description object, like this: + * + * $description = $descriptionFactory->create('This is a {@see Description}', $context); + * + * The description factory will interpret the given body and create a body template and list of tags from them, and pass + * that onto the constructor if this class. + * + * > The $context variable is a class of type {@see \phpDocumentor\Reflection\Types\Context} and contains the namespace + * > and the namespace aliases that apply to this DocBlock. These are used by the Factory to resolve and expand partial + * > type names and FQSENs. + * + * If you do not want to use the DescriptionFactory you can pass a body template and tag listing like this: + * + * $description = new Description( + * 'This is a %1$s', + * [ new See(new Fqsen('\phpDocumentor\Reflection\DocBlock\Description')) ] + * ); + * + * It is generally recommended to use the Factory as that will also apply escaping rules, while the Description object + * is mainly responsible for rendering. + * + * @see DescriptionFactory to create a new Description. + * @see Description\Formatter for the formatting of the body and tags. + */ +class Description +{ + /** @var string */ + private $bodyTemplate; + + /** @var Tag[] */ + private $tags; + + /** + * Initializes a Description with its body (template) and a listing of the tags used in the body template. + * + * @param string $bodyTemplate + * @param Tag[] $tags + */ + public function __construct($bodyTemplate, array $tags = []) + { + Assert::string($bodyTemplate); + + $this->bodyTemplate = $bodyTemplate; + $this->tags = $tags; + } + + /** + * Returns the tags for this DocBlock. + * + * @return Tag[] + */ + public function getTags() + { + return $this->tags; + } + + /** + * Renders this description as a string where the provided formatter will format the tags in the expected string + * format. + * + * @param Formatter|null $formatter + * + * @return string + */ + public function render(Formatter $formatter = null) + { + if ($formatter === null) { + $formatter = new PassthroughFormatter(); + } + + $tags = []; + foreach ($this->tags as $tag) { + $tags[] = '{' . $formatter->format($tag) . '}'; + } + + return vsprintf($this->bodyTemplate, $tags); + } + + /** + * Returns a plain string representation of this description. + * + * @return string + */ + public function __toString() + { + return $this->render(); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php new file mode 100644 index 0000000..48f9c21 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php @@ -0,0 +1,191 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\Types\Context as TypeContext; + +/** + * Creates a new Description object given a body of text. + * + * Descriptions in phpDocumentor are somewhat complex entities as they can contain one or more tags inside their + * body that can be replaced with a readable output. The replacing is done by passing a Formatter object to the + * Description object's `render` method. + * + * In addition to the above does a Description support two types of escape sequences: + * + * 1. `{@}` to escape the `@` character to prevent it from being interpreted as part of a tag, i.e. `{{@}link}` + * 2. `{}` to escape the `}` character, this can be used if you want to use the `}` character in the description + * of an inline tag. + * + * If a body consists of multiple lines then this factory will also remove any superfluous whitespace at the beginning + * of each line while maintaining any indentation that is used. This will prevent formatting parsers from tripping + * over unexpected spaces as can be observed with tag descriptions. + */ +class DescriptionFactory +{ + /** @var TagFactory */ + private $tagFactory; + + /** + * Initializes this factory with the means to construct (inline) tags. + * + * @param TagFactory $tagFactory + */ + public function __construct(TagFactory $tagFactory) + { + $this->tagFactory = $tagFactory; + } + + /** + * Returns the parsed text of this description. + * + * @param string $contents + * @param TypeContext $context + * + * @return Description + */ + public function create($contents, TypeContext $context = null) + { + list($text, $tags) = $this->parse($this->lex($contents), $context); + + return new Description($text, $tags); + } + + /** + * Strips the contents from superfluous whitespace and splits the description into a series of tokens. + * + * @param string $contents + * + * @return string[] A series of tokens of which the description text is composed. + */ + private function lex($contents) + { + $contents = $this->removeSuperfluousStartingWhitespace($contents); + + // performance optimalization; if there is no inline tag, don't bother splitting it up. + if (strpos($contents, '{@') === false) { + return [$contents]; + } + + return preg_split( + '/\{ + # "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally. + (?!@\}) + # We want to capture the whole tag line, but without the inline tag delimiters. + (\@ + # Match everything up to the next delimiter. + [^{}]* + # Nested inline tag content should not be captured, or it will appear in the result separately. + (?: + # Match nested inline tags. + (?: + # Because we did not catch the tag delimiters earlier, we must be explicit with them here. + # Notice that this also matches "{}", as a way to later introduce it as an escape sequence. + \{(?1)?\} + | + # Make sure we match hanging "{". + \{ + ) + # Match content after the nested inline tag. + [^{}]* + )* # If there are more inline tags, match them as well. We use "*" since there may not be any + # nested inline tags. + ) + \}/Sux', + $contents, + null, + PREG_SPLIT_DELIM_CAPTURE + ); + } + + /** + * Parses the stream of tokens in to a new set of tokens containing Tags. + * + * @param string[] $tokens + * @param TypeContext $context + * + * @return string[]|Tag[] + */ + private function parse($tokens, TypeContext $context) + { + $count = count($tokens); + $tagCount = 0; + $tags = []; + + for ($i = 1; $i < $count; $i += 2) { + $tags[] = $this->tagFactory->create($tokens[$i], $context); + $tokens[$i] = '%' . ++$tagCount . '$s'; + } + + //In order to allow "literal" inline tags, the otherwise invalid + //sequence "{@}" is changed to "@", and "{}" is changed to "}". + //"%" is escaped to "%%" because of vsprintf. + //See unit tests for examples. + for ($i = 0; $i < $count; $i += 2) { + $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]); + } + + return [implode('', $tokens), $tags]; + } + + /** + * Removes the superfluous from a multi-line description. + * + * When a description has more than one line then it can happen that the second and subsequent lines have an + * additional indentation. This is commonly in use with tags like this: + * + * {@}since 1.1.0 This is an example + * description where we have an + * indentation in the second and + * subsequent lines. + * + * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent + * lines and this may cause rendering issues when, for example, using a Markdown converter. + * + * @param string $contents + * + * @return string + */ + private function removeSuperfluousStartingWhitespace($contents) + { + $lines = explode("\n", $contents); + + // if there is only one line then we don't have lines with superfluous whitespace and + // can use the contents as-is + if (count($lines) <= 1) { + return $contents; + } + + // determine how many whitespace characters need to be stripped + $startingSpaceCount = 9999999; + for ($i = 1; $i < count($lines); $i++) { + // lines with a no length do not count as they are not indented at all + if (strlen(trim($lines[$i])) === 0) { + continue; + } + + // determine the number of prefixing spaces by checking the difference in line length before and after + // an ltrim + $startingSpaceCount = min($startingSpaceCount, strlen($lines[$i]) - strlen(ltrim($lines[$i]))); + } + + // strip the number of spaces from each line + if ($startingSpaceCount > 0) { + for ($i = 1; $i < count($lines); $i++) { + $lines[$i] = substr($lines[$i], $startingSpaceCount); + } + } + + return implode("\n", $lines); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php new file mode 100644 index 0000000..571ed74 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php @@ -0,0 +1,170 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Example; + +/** + * Class used to find an example file's location based on a given ExampleDescriptor. + */ +class ExampleFinder +{ + /** @var string */ + private $sourceDirectory = ''; + + /** @var string[] */ + private $exampleDirectories = []; + + /** + * Attempts to find the example contents for the given descriptor. + * + * @param Example $example + * + * @return string + */ + public function find(Example $example) + { + $filename = $example->getFilePath(); + + $file = $this->getExampleFileContents($filename); + if (!$file) { + return "** File not found : {$filename} **"; + } + + return implode('', array_slice($file, $example->getStartingLine() - 1, $example->getLineCount())); + } + + /** + * Registers the project's root directory where an 'examples' folder can be expected. + * + * @param string $directory + * + * @return void + */ + public function setSourceDirectory($directory = '') + { + $this->sourceDirectory = $directory; + } + + /** + * Returns the project's root directory where an 'examples' folder can be expected. + * + * @return string + */ + public function getSourceDirectory() + { + return $this->sourceDirectory; + } + + /** + * Registers a series of directories that may contain examples. + * + * @param string[] $directories + */ + public function setExampleDirectories(array $directories) + { + $this->exampleDirectories = $directories; + } + + /** + * Returns a series of directories that may contain examples. + * + * @return string[] + */ + public function getExampleDirectories() + { + return $this->exampleDirectories; + } + + /** + * Attempts to find the requested example file and returns its contents or null if no file was found. + * + * This method will try several methods in search of the given example file, the first one it encounters is + * returned: + * + * 1. Iterates through all examples folders for the given filename + * 2. Checks the source folder for the given filename + * 3. Checks the 'examples' folder in the current working directory for examples + * 4. Checks the path relative to the current working directory for the given filename + * + * @param string $filename + * + * @return string|null + */ + private function getExampleFileContents($filename) + { + $normalizedPath = null; + + foreach ($this->exampleDirectories as $directory) { + $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); + if (is_readable($exampleFileFromConfig)) { + $normalizedPath = $exampleFileFromConfig; + break; + } + } + + if (!$normalizedPath) { + if (is_readable($this->getExamplePathFromSource($filename))) { + $normalizedPath = $this->getExamplePathFromSource($filename); + } elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) { + $normalizedPath = $this->getExamplePathFromExampleDirectory($filename); + } elseif (is_readable($filename)) { + $normalizedPath = $filename; + } + } + + return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null; + } + + /** + * Get example filepath based on the example directory inside your project. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromExampleDirectory($file) + { + return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; + } + + /** + * Returns a path to the example file in the given directory.. + * + * @param string $directory + * @param string $file + * + * @return string + */ + private function constructExamplePath($directory, $file) + { + return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; + } + + /** + * Get example filepath based on sourcecode. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromSource($file) + { + return sprintf( + '%s%s%s', + trim($this->getSourceDirectory(), '\\/'), + DIRECTORY_SEPARATOR, + trim($file, '"') + ); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php new file mode 100644 index 0000000..0f355f5 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php @@ -0,0 +1,155 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock; +use Webmozart\Assert\Assert; + +/** + * Converts a DocBlock back from an object to a complete DocComment including Asterisks. + */ +class Serializer +{ + /** @var string The string to indent the comment with. */ + protected $indentString = ' '; + + /** @var int The number of times the indent string is repeated. */ + protected $indent = 0; + + /** @var bool Whether to indent the first line with the given indent amount and string. */ + protected $isFirstLineIndented = true; + + /** @var int|null The max length of a line. */ + protected $lineLength = null; + + /** @var DocBlock\Tags\Formatter A custom tag formatter. */ + protected $tagFormatter = null; + + /** + * Create a Serializer instance. + * + * @param int $indent The number of times the indent string is repeated. + * @param string $indentString The string to indent the comment with. + * @param bool $indentFirstLine Whether to indent the first line. + * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. + * @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. + */ + public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null, $tagFormatter = null) + { + Assert::integer($indent); + Assert::string($indentString); + Assert::boolean($indentFirstLine); + Assert::nullOrInteger($lineLength); + Assert::nullOrIsInstanceOf($tagFormatter, 'phpDocumentor\Reflection\DocBlock\Tags\Formatter'); + + $this->indent = $indent; + $this->indentString = $indentString; + $this->isFirstLineIndented = $indentFirstLine; + $this->lineLength = $lineLength; + $this->tagFormatter = $tagFormatter ?: new DocBlock\Tags\Formatter\PassthroughFormatter(); + } + + /** + * Generate a DocBlock comment. + * + * @param DocBlock $docblock The DocBlock to serialize. + * + * @return string The serialized doc block. + */ + public function getDocComment(DocBlock $docblock) + { + $indent = str_repeat($this->indentString, $this->indent); + $firstIndent = $this->isFirstLineIndented ? $indent : ''; + // 3 === strlen(' * ') + $wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; + + $text = $this->removeTrailingSpaces( + $indent, + $this->addAsterisksForEachLine( + $indent, + $this->getSummaryAndDescriptionTextBlock($docblock, $wrapLength) + ) + ); + + $comment = "{$firstIndent}/**\n"; + if ($text) { + $comment .= "{$indent} * {$text}\n"; + $comment .= "{$indent} *\n"; + } + + $comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment); + $comment .= $indent . ' */'; + + return $comment; + } + + /** + * @param $indent + * @param $text + * @return mixed + */ + private function removeTrailingSpaces($indent, $text) + { + return str_replace("\n{$indent} * \n", "\n{$indent} *\n", $text); + } + + /** + * @param $indent + * @param $text + * @return mixed + */ + private function addAsterisksForEachLine($indent, $text) + { + return str_replace("\n", "\n{$indent} * ", $text); + } + + /** + * @param DocBlock $docblock + * @param $wrapLength + * @return string + */ + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength) + { + $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() + : ''); + if ($wrapLength !== null) { + $text = wordwrap($text, $wrapLength); + return $text; + } + + return $text; + } + + /** + * @param DocBlock $docblock + * @param $wrapLength + * @param $indent + * @param $comment + * @return string + */ + private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment) + { + foreach ($docblock->getTags() as $tag) { + $tagText = $this->tagFormatter->format($tag); + if ($wrapLength !== null) { + $tagText = wordwrap($tagText, $wrapLength); + } + + $tagText = str_replace("\n", "\n{$indent} * ", $tagText); + + $comment .= "{$indent} * {$tagText}\n"; + } + + return $comment; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php new file mode 100644 index 0000000..5a8143c --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php @@ -0,0 +1,319 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; +use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Creates a Tag object given the contents of a tag. + * + * This Factory is capable of determining the appropriate class for a tag and instantiate it using its `create` + * factory method. The `create` factory method of a Tag can have a variable number of arguments; this way you can + * pass the dependencies that you need to construct a tag object. + * + * > Important: each parameter in addition to the body variable for the `create` method must default to null, otherwise + * > it violates the constraint with the interface; it is recommended to use the {@see Assert::notNull()} method to + * > verify that a dependency is actually passed. + * + * This Factory also features a Service Locator component that is used to pass the right dependencies to the + * `create` method of a tag; each dependency should be registered as a service or as a parameter. + * + * When you want to use a Tag of your own with custom handling you need to call the `registerTagHandler` method, pass + * the name of the tag and a Fully Qualified Class Name pointing to a class that implements the Tag interface. + */ +final class StandardTagFactory implements TagFactory +{ + /** PCRE regular expression matching a tag name. */ + const REGEX_TAGNAME = '[\w\-\_\\\\]+'; + + /** + * @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value. + */ + private $tagHandlerMappings = [ + 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', + 'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers', + 'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated', + // 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example', + 'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link', + 'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method', + 'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param', + 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', + 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', + 'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', + 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', + 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', + 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', + 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', + 'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses', + 'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_', + 'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version' + ]; + + /** + * @var \ReflectionParameter[][] a lazy-loading cache containing parameters for each tagHandler that has been used. + */ + private $tagHandlerParameterCache = []; + + /** + * @var FqsenResolver + */ + private $fqsenResolver; + + /** + * @var mixed[] an array representing a simple Service Locator where we can store parameters and + * services that can be inserted into the Factory Methods of Tag Handlers. + */ + private $serviceLocator = []; + + /** + * Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers. + * + * If no tag handlers are provided than the default list in the {@see self::$tagHandlerMappings} property + * is used. + * + * @param FqsenResolver $fqsenResolver + * @param string[] $tagHandlers + * + * @see self::registerTagHandler() to add a new tag handler to the existing default list. + */ + public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = null) + { + $this->fqsenResolver = $fqsenResolver; + if ($tagHandlers !== null) { + $this->tagHandlerMappings = $tagHandlers; + } + + $this->addService($fqsenResolver, FqsenResolver::class); + } + + /** + * {@inheritDoc} + */ + public function create($tagLine, TypeContext $context = null) + { + if (! $context) { + $context = new TypeContext(''); + } + + list($tagName, $tagBody) = $this->extractTagParts($tagLine); + + if ($tagBody !== '' && $tagBody[0] === '[') { + throw new \InvalidArgumentException( + 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' + ); + } + + return $this->createTag($tagBody, $tagName, $context); + } + + /** + * {@inheritDoc} + */ + public function addParameter($name, $value) + { + $this->serviceLocator[$name] = $value; + } + + /** + * {@inheritDoc} + */ + public function addService($service, $alias = null) + { + $this->serviceLocator[$alias ?: get_class($service)] = $service; + } + + /** + * {@inheritDoc} + */ + public function registerTagHandler($tagName, $handler) + { + Assert::stringNotEmpty($tagName); + Assert::stringNotEmpty($handler); + Assert::classExists($handler); + Assert::implementsInterface($handler, StaticMethod::class); + + if (strpos($tagName, '\\') && $tagName[0] !== '\\') { + throw new \InvalidArgumentException( + 'A namespaced tag must have a leading backslash as it must be fully qualified' + ); + } + + $this->tagHandlerMappings[$tagName] = $handler; + } + + /** + * Extracts all components for a tag. + * + * @param string $tagLine + * + * @return string[] + */ + private function extractTagParts($tagLine) + { + $matches = []; + if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { + throw new \InvalidArgumentException( + 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' + ); + } + + if (count($matches) < 3) { + $matches[] = ''; + } + + return array_slice($matches, 1); + } + + /** + * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the + * body was invalid. + * + * @param string $body + * @param string $name + * @param TypeContext $context + * + * @return Tag|null + */ + private function createTag($body, $name, TypeContext $context) + { + $handlerClassName = $this->findHandlerClassName($name, $context); + $arguments = $this->getArgumentsForParametersFromWiring( + $this->fetchParametersForHandlerFactoryMethod($handlerClassName), + $this->getServiceLocatorWithDynamicParameters($context, $name, $body) + ); + + return call_user_func_array([$handlerClassName, 'create'], $arguments); + } + + /** + * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). + * + * @param string $tagName + * @param TypeContext $context + * + * @return string + */ + private function findHandlerClassName($tagName, TypeContext $context) + { + $handlerClassName = Generic::class; + if (isset($this->tagHandlerMappings[$tagName])) { + $handlerClassName = $this->tagHandlerMappings[$tagName]; + } elseif ($this->isAnnotation($tagName)) { + // TODO: Annotation support is planned for a later stage and as such is disabled for now + // $tagName = (string)$this->fqsenResolver->resolve($tagName, $context); + // if (isset($this->annotationMappings[$tagName])) { + // $handlerClassName = $this->annotationMappings[$tagName]; + // } + } + + return $handlerClassName; + } + + /** + * Retrieves the arguments that need to be passed to the Factory Method with the given Parameters. + * + * @param \ReflectionParameter[] $parameters + * @param mixed[] $locator + * + * @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters + * is provided with this method. + */ + private function getArgumentsForParametersFromWiring($parameters, $locator) + { + $arguments = []; + foreach ($parameters as $index => $parameter) { + $typeHint = $parameter->getClass() ? $parameter->getClass()->getName() : null; + if (isset($locator[$typeHint])) { + $arguments[] = $locator[$typeHint]; + continue; + } + + $parameterName = $parameter->getName(); + if (isset($locator[$parameterName])) { + $arguments[] = $locator[$parameterName]; + continue; + } + + $arguments[] = null; + } + + return $arguments; + } + + /** + * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given + * tag handler class name. + * + * @param string $handlerClassName + * + * @return \ReflectionParameter[] + */ + private function fetchParametersForHandlerFactoryMethod($handlerClassName) + { + if (! isset($this->tagHandlerParameterCache[$handlerClassName])) { + $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); + $this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters(); + } + + return $this->tagHandlerParameterCache[$handlerClassName]; + } + + /** + * Returns a copy of this class' Service Locator with added dynamic parameters, such as the tag's name, body and + * Context. + * + * @param TypeContext $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs. + * @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class. + * @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class. + * + * @return mixed[] + */ + private function getServiceLocatorWithDynamicParameters(TypeContext $context, $tagName, $tagBody) + { + $locator = array_merge( + $this->serviceLocator, + [ + 'name' => $tagName, + 'body' => $tagBody, + TypeContext::class => $context + ] + ); + + return $locator; + } + + /** + * Returns whether the given tag belongs to an annotation. + * + * @param string $tagContent + * + * @todo this method should be populated once we implement Annotation notation support. + * + * @return bool + */ + private function isAnnotation($tagContent) + { + // 1. Contains a namespace separator + // 2. Contains parenthesis + // 3. Is present in a list of known annotations (make the algorithm smart by first checking is the last part + // of the annotation class name matches the found tag name + + return false; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php new file mode 100644 index 0000000..e765367 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php @@ -0,0 +1,26 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +interface Tag +{ + public function getName(); + + public static function create($body); + + public function render(Formatter $formatter = null); + + public function __toString(); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php new file mode 100644 index 0000000..3c1d113 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php @@ -0,0 +1,93 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\Types\Context as TypeContext; + +interface TagFactory +{ + /** + * Adds a parameter to the service locator that can be injected in a tag's factory method. + * + * When calling a tag's "create" method we always check the signature for dependencies to inject. One way is to + * typehint a parameter in the signature so that we can use that interface or class name to inject a dependency + * (see {@see addService()} for more information on that). + * + * Another way is to check the name of the argument against the names in the Service Locator. With this method + * you can add a variable that will be inserted when a tag's create method is not typehinted and has a matching + * name. + * + * Be aware that there are two reserved names: + * + * - name, representing the name of the tag. + * - body, representing the complete body of the tag. + * + * These parameters are injected at the last moment and will override any existing parameter with those names. + * + * @param string $name + * @param mixed $value + * + * @return void + */ + public function addParameter($name, $value); + + /** + * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. + * + * When calling a tag's "create" method we always check the signature for dependencies to inject. If a parameter + * has a typehint then the ServiceLocator is queried to see if a Service is registered for that typehint. + * + * Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the + * interface is passed as alias then every time that interface is requested the provided service will be returned. + * + * @param object $service + * @param string $alias + * + * @return void + */ + public function addService($service); + + /** + * Factory method responsible for instantiating the correct sub type. + * + * @param string $tagLine The text for this tag, including description. + * @param TypeContext $context + * + * @throws \InvalidArgumentException if an invalid tag line was presented. + * + * @return Tag A new tag object. + */ + public function create($tagLine, TypeContext $context = null); + + /** + * Registers a handler for tags. + * + * If you want to use your own tags then you can use this method to instruct the TagFactory to register the name + * of a tag with the FQCN of a 'Tag Handler'. The Tag handler should implement the {@see Tag} interface (and thus + * the create method). + * + * @param string $tagName Name of tag to register a handler for. When registering a namespaced tag, the full + * name, along with a prefixing slash MUST be provided. + * @param string $handler FQCN of handler. + * + * @throws \InvalidArgumentException if the tag name is not a string + * @throws \InvalidArgumentException if the tag name is namespaced (contains backslashes) but does not start with + * a backslash + * @throws \InvalidArgumentException if the handler is not a string + * @throws \InvalidArgumentException if the handler is not an existing class + * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface + * + * @return void + */ + public function registerTagHandler($tagName, $handler); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php new file mode 100644 index 0000000..29d7f1d --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php @@ -0,0 +1,100 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}author tag in a Docblock. + */ +final class Author extends BaseTag implements Factory\StaticMethod +{ + /** @var string register that this is the author tag. */ + protected $name = 'author'; + + /** @var string The name of the author */ + private $authorName = ''; + + /** @var string The email of the author */ + private $authorEmail = ''; + + /** + * Initializes this tag with the author name and e-mail. + * + * @param string $authorName + * @param string $authorEmail + */ + public function __construct($authorName, $authorEmail) + { + Assert::string($authorName); + Assert::string($authorEmail); + if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) { + throw new \InvalidArgumentException('The author tag does not have a valid e-mail address'); + } + + $this->authorName = $authorName; + $this->authorEmail = $authorEmail; + } + + /** + * Gets the author's name. + * + * @return string The author's name. + */ + public function getAuthorName() + { + return $this->authorName; + } + + /** + * Returns the author's email. + * + * @return string The author's email. + */ + public function getEmail() + { + return $this->authorEmail; + } + + /** + * Returns this tag in string form. + * + * @return string + */ + public function __toString() + { + return $this->authorName . (strlen($this->authorEmail) ? ' <' . $this->authorEmail . '>' : ''); + } + + /** + * Attempts to create a new Author object based on †he tag body. + * + * @param string $body + * + * @return static + */ + public static function create($body) + { + Assert::string($body); + + $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); + if (!$splitTagContent) { + return null; + } + + $authorName = trim($matches[1]); + $email = isset($matches[2]) ? trim($matches[2]) : ''; + + return new static($authorName, $email); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php new file mode 100644 index 0000000..14bb717 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php @@ -0,0 +1,52 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Description; + +/** + * Parses a tag definition for a DocBlock. + */ +abstract class BaseTag implements DocBlock\Tag +{ + /** @var string Name of the tag */ + protected $name = ''; + + /** @var Description|null Description of the tag. */ + protected $description; + + /** + * Gets the name of this tag. + * + * @return string The name of this tag. + */ + public function getName() + { + return $this->name; + } + + public function getDescription() + { + return $this->description; + } + + public function render(Formatter $formatter = null) + { + if ($formatter === null) { + $formatter = new Formatter\PassthroughFormatter(); + } + + return $formatter->format($this); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php new file mode 100644 index 0000000..8d65403 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php @@ -0,0 +1,83 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a @covers tag in a Docblock. + */ +final class Covers extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'covers'; + + /** @var Fqsen */ + private $refers = null; + + /** + * Initializes this tag. + * + * @param Fqsen $refers + * @param Description $description + */ + public function __construct(Fqsen $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + DescriptionFactory $descriptionFactory = null, + FqsenResolver $resolver = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::notEmpty($body); + + $parts = preg_split('/\s+/Su', $body, 2); + + return new static( + $resolver->resolve($parts[0], $context), + $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + ); + } + + /** + * Returns the structural element this tag refers to. + * + * @return Fqsen + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php new file mode 100644 index 0000000..822c305 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php @@ -0,0 +1,97 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}deprecated tag in a Docblock. + */ +final class Deprecated extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'deprecated'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return new static( + null, + null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null + ); + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php new file mode 100644 index 0000000..ecb199b --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php @@ -0,0 +1,176 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\Tag; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}example tag in a Docblock. + */ +final class Example extends BaseTag +{ + /** + * @var string Path to a file to use as an example. May also be an absolute URI. + */ + private $filePath; + + /** + * @var bool Whether the file path component represents an URI. This determines how the file portion + * appears at {@link getContent()}. + */ + private $isURI = false; + + /** + * @var int + */ + private $startingLine; + + /** + * @var int + */ + private $lineCount; + + public function __construct($filePath, $isURI, $startingLine, $lineCount, $description) + { + Assert::notEmpty($filePath); + Assert::integer($startingLine); + Assert::greaterThanEq($startingLine, 0); + + $this->filePath = $filePath; + $this->startingLine = $startingLine; + $this->lineCount = $lineCount; + $this->name = 'example'; + if ($description !== null) { + $this->description = trim($description); + } + + $this->isURI = $isURI; + } + + /** + * {@inheritdoc} + */ + public function getContent() + { + if (null === $this->description) { + $filePath = '"' . $this->filePath . '"'; + if ($this->isURI) { + $filePath = $this->isUriRelative($this->filePath) + ? str_replace('%2F', '/', rawurlencode($this->filePath)) + :$this->filePath; + } + + return trim($filePath . ' ' . parent::getDescription()); + } + + return $this->description; + } + + /** + * {@inheritdoc} + */ + public static function create($body) + { + // File component: File path in quotes or File URI / Source information + if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { + return null; + } + + $filePath = null; + $fileUri = null; + if ('' !== $matches[1]) { + $filePath = $matches[1]; + } else { + $fileUri = $matches[2]; + } + + $startingLine = 1; + $lineCount = null; + $description = null; + + if (array_key_exists(3, $matches)) { + $description = $matches[3]; + + // Starting line / Number of lines / Description + if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) { + $startingLine = (int)$contentMatches[1]; + if (isset($contentMatches[2]) && $contentMatches[2] !== '') { + $lineCount = (int)$contentMatches[2]; + } + + if (array_key_exists(3, $contentMatches)) { + $description = $contentMatches[3]; + } + } + } + + return new static( + $filePath !== null?$filePath:$fileUri, + $fileUri !== null, + $startingLine, + $lineCount, + $description + ); + } + + /** + * Returns the file path. + * + * @return string Path to a file to use as an example. + * May also be an absolute URI. + */ + public function getFilePath() + { + return $this->filePath; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->filePath . ($this->description ? ' ' . $this->description : ''); + } + + /** + * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). + * + * @param string $uri + * + * @return bool + */ + private function isUriRelative($uri) + { + return false === strpos($uri, ':'); + } + + /** + * @return int + */ + public function getStartingLine() + { + return $this->startingLine; + } + + /** + * @return int + */ + public function getLineCount() + { + return $this->lineCount; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php new file mode 100644 index 0000000..98aea45 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; + +interface StaticMethod +{ + public static function create($body); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php new file mode 100644 index 0000000..b9ca0b8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; + +interface Strategy +{ + public function create($body); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php new file mode 100644 index 0000000..64b2c60 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php @@ -0,0 +1,27 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Tag; + +interface Formatter +{ + /** + * Formats a tag into a string representation according to a specific format, such as Markdown. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php new file mode 100644 index 0000000..ceb40cc --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -0,0 +1,47 @@ + + * @copyright 2017 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +class AlignFormatter implements Formatter +{ + /** @var int The maximum tag name length. */ + protected $maxLen = 0; + + /** + * Constructor. + * + * @param Tag[] $tags All tags that should later be aligned with the formatter. + */ + public function __construct(array $tags) + { + foreach ($tags as $tag) { + $this->maxLen = max($this->maxLen, strlen($tag->getName())); + } + } + + /** + * Formats the given tag to return a simple plain text version. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag) + { + return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php new file mode 100644 index 0000000..4e2c576 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +class PassthroughFormatter implements Formatter +{ + /** + * Formats the given tag to return a simple plain text version. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag) + { + return trim('@' . $tag->getName() . ' ' . (string)$tag); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php new file mode 100644 index 0000000..88b4ebf --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php @@ -0,0 +1,91 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Parses a tag definition for a DocBlock. + */ +class Generic extends BaseTag implements Factory\StaticMethod +{ + /** + * Parses a tag and populates the member variables. + * + * @param string $name Name of the tag. + * @param Description $description The contents of the given tag. + */ + public function __construct($name, Description $description = null) + { + $this->validateTagName($name); + + $this->name = $name; + $this->description = $description; + } + + /** + * Creates a new tag that represents any unknown tag type. + * + * @param string $body + * @param string $name + * @param DescriptionFactory $descriptionFactory + * @param TypeContext $context + * + * @return static + */ + public static function create( + $body, + $name = '', + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::stringNotEmpty($name); + Assert::notNull($descriptionFactory); + + $description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null; + + return new static($name, $description); + } + + /** + * Returns the tag as a serialized string + * + * @return string + */ + public function __toString() + { + return ($this->description ? $this->description->render() : ''); + } + + /** + * Validates if the tag name matches the expected format, otherwise throws an exception. + * + * @param string $name + * + * @return void + */ + private function validateTagName($name) + { + if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { + throw new \InvalidArgumentException( + 'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, ' + . 'hyphens and backslashes.' + ); + } + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php new file mode 100644 index 0000000..9c0e367 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php @@ -0,0 +1,77 @@ + + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a @link tag in a Docblock. + */ +final class Link extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'link'; + + /** @var string */ + private $link = ''; + + /** + * Initializes a link to a URL. + * + * @param string $link + * @param Description $description + */ + public function __construct($link, Description $description = null) + { + Assert::string($link); + + $this->link = $link; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::string($body); + Assert::notNull($descriptionFactory); + + $parts = preg_split('/\s+/Su', $body, 2); + $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; + + return new static($parts[0], $description); + } + + /** + * Gets the link + * + * @return string + */ + public function getLink() + { + return $this->link; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->link . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php new file mode 100644 index 0000000..7522529 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php @@ -0,0 +1,242 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use phpDocumentor\Reflection\Types\Void_; +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}method in a Docblock. + */ +final class Method extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'method'; + + /** @var string */ + private $methodName = ''; + + /** @var string[] */ + private $arguments = []; + + /** @var bool */ + private $isStatic = false; + + /** @var Type */ + private $returnType; + + public function __construct( + $methodName, + array $arguments = [], + Type $returnType = null, + $static = false, + Description $description = null + ) { + Assert::stringNotEmpty($methodName); + Assert::boolean($static); + + if ($returnType === null) { + $returnType = new Void_(); + } + + $this->methodName = $methodName; + $this->arguments = $this->filterArguments($arguments); + $this->returnType = $returnType; + $this->isStatic = $static; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([ $typeResolver, $descriptionFactory ]); + + // 1. none or more whitespace + // 2. optionally the keyword "static" followed by whitespace + // 3. optionally a word with underscores followed by whitespace : as + // type for the return value + // 4. then optionally a word with underscores followed by () and + // whitespace : as method name as used by phpDocumentor + // 5. then a word with underscores, followed by ( and any character + // until a ) and whitespace : as method name with signature + // 6. any remaining text : as description + if (!preg_match( + '/^ + # Static keyword + # Declares a static method ONLY if type is also present + (?: + (static) + \s+ + )? + # Return type + (?: + ( + (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) + | + (?: + (?:[\w\|_\\\\]+) + # array notation + (?:\[\])* + )* + ) + \s+ + )? + # Legacy method name (not captured) + (?: + [\w_]+\(\)\s+ + )? + # Method name + ([\w\|_\\\\]+) + # Arguments + (?: + \(([^\)]*)\) + )? + \s* + # Description + (.*) + $/sux', + $body, + $matches + )) { + return null; + } + + list(, $static, $returnType, $methodName, $arguments, $description) = $matches; + + $static = $static === 'static'; + + if ($returnType === '') { + $returnType = 'void'; + } + + $returnType = $typeResolver->resolve($returnType, $context); + $description = $descriptionFactory->create($description, $context); + + if (is_string($arguments) && strlen($arguments) > 0) { + $arguments = explode(',', $arguments); + foreach ($arguments as &$argument) { + $argument = explode(' ', self::stripRestArg(trim($argument)), 2); + if ($argument[0][0] === '$') { + $argumentName = substr($argument[0], 1); + $argumentType = new Void_(); + } else { + $argumentType = $typeResolver->resolve($argument[0], $context); + $argumentName = ''; + if (isset($argument[1])) { + $argument[1] = self::stripRestArg($argument[1]); + $argumentName = substr($argument[1], 1); + } + } + + $argument = [ 'name' => $argumentName, 'type' => $argumentType]; + } + } else { + $arguments = []; + } + + return new static($methodName, $arguments, $returnType, $static, $description); + } + + /** + * Retrieves the method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @return string[] + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Checks whether the method tag describes a static method or not. + * + * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. + */ + public function isStatic() + { + return $this->isStatic; + } + + /** + * @return Type + */ + public function getReturnType() + { + return $this->returnType; + } + + public function __toString() + { + $arguments = []; + foreach ($this->arguments as $argument) { + $arguments[] = $argument['type'] . ' $' . $argument['name']; + } + + return trim(($this->isStatic() ? 'static ' : '') + . (string)$this->returnType . ' ' + . $this->methodName + . '(' . implode(', ', $arguments) . ')' + . ($this->description ? ' ' . $this->description->render() : '')); + } + + private function filterArguments($arguments) + { + foreach ($arguments as &$argument) { + if (is_string($argument)) { + $argument = [ 'name' => $argument ]; + } + + if (! isset($argument['type'])) { + $argument['type'] = new Void_(); + } + + $keys = array_keys($argument); + sort($keys); + if ($keys !== [ 'name', 'type' ]) { + throw new \InvalidArgumentException( + 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) + ); + } + } + + return $arguments; + } + + private static function stripRestArg($argument) + { + if (strpos($argument, '...') === 0) { + $argument = trim(substr($argument, 3)); + } + + return $argument; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php new file mode 100644 index 0000000..7d699d8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php @@ -0,0 +1,141 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for the {@}param tag in a Docblock. + */ +final class Param extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'param'; + + /** @var Type */ + private $type; + + /** @var string */ + private $variableName = ''; + + /** @var bool determines whether this is a variadic argument */ + private $isVariadic = false; + + /** + * @param string $variableName + * @param Type $type + * @param bool $isVariadic + * @param Description $description + */ + public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null) + { + Assert::string($variableName); + Assert::boolean($isVariadic); + + $this->variableName = $variableName; + $this->type = $type; + $this->isVariadic = $isVariadic; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + $isVariadic = false; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$' || substr($parts[0], 0, 4) === '...$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 3) === '...') { + $isVariadic = true; + $variableName = substr($variableName, 3); + } + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $isVariadic, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns whether this tag is variadic. + * + * @return boolean + */ + public function isVariadic() + { + return $this->isVariadic; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . ($this->isVariadic() ? '...' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php new file mode 100644 index 0000000..f0ef7c0 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property tag in a Docblock. + */ +class Property extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php new file mode 100644 index 0000000..e41c0c1 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property-read tag in a Docblock. + */ +class PropertyRead extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property-read'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php new file mode 100644 index 0000000..cfdb0ed --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property-write tag in a Docblock. + */ +class PropertyWrite extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property-write'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php new file mode 100644 index 0000000..dc7b8b6 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php @@ -0,0 +1,42 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +use phpDocumentor\Reflection\Fqsen as RealFqsen; + +/** + * Fqsen reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +final class Fqsen implements Reference +{ + /** + * @var RealFqsen + */ + private $fqsen; + + /** + * Fqsen constructor. + */ + public function __construct(RealFqsen $fqsen) + { + $this->fqsen = $fqsen; + } + + /** + * @return string string representation of the referenced fqsen + */ + public function __toString() + { + return (string)$this->fqsen; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php new file mode 100644 index 0000000..a3ffd24 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php @@ -0,0 +1,21 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +/** + * Interface for references in {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +interface Reference +{ + public function __toString(); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php new file mode 100644 index 0000000..2671d5e --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php @@ -0,0 +1,40 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +use Webmozart\Assert\Assert; + +/** + * Url reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +final class Url implements Reference +{ + /** + * @var string + */ + private $uri; + + /** + * Url constructor. + */ + public function __construct($uri) + { + Assert::stringNotEmpty($uri); + $this->uri = $uri; + } + + public function __toString() + { + return $this->uri; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php new file mode 100644 index 0000000..ca5bda7 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php @@ -0,0 +1,72 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}return tag in a Docblock. + */ +final class Return_ extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'return'; + + /** @var Type */ + private $type; + + public function __construct(Type $type, Description $description = null) + { + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + $type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context); + $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + + return new static($type, $description); + } + + /** + * Returns the type section of the variable. + * + * @return Type + */ + public function getType() + { + return $this->type; + } + + public function __toString() + { + return $this->type . ' ' . $this->description; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php new file mode 100644 index 0000000..9e9e723 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php @@ -0,0 +1,88 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}see tag in a Docblock. + */ +class See extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'see'; + + /** @var Reference */ + protected $refers = null; + + /** + * Initializes this tag. + * + * @param Reference $refers + * @param Description $description + */ + public function __construct(Reference $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + FqsenResolver $resolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$resolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; + + // https://tools.ietf.org/html/rfc2396#section-3 + if (preg_match('/\w:\/\/\w/i', $parts[0])) { + return new static(new Url($parts[0]), $description); + } + + return new static(new FqsenRef($resolver->resolve($parts[0], $context)), $description); + } + + /** + * Returns the ref of this tag. + * + * @return Reference + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php new file mode 100644 index 0000000..835fb0d --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php @@ -0,0 +1,94 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}since tag in a Docblock. + */ +final class Since extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'since'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (! preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return null; + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php new file mode 100644 index 0000000..247b1b3 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php @@ -0,0 +1,97 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}source tag in a Docblock. + */ +final class Source extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'source'; + + /** @var int The starting line, relative to the structural element's location. */ + private $startingLine = 1; + + /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ + private $lineCount = null; + + public function __construct($startingLine, $lineCount = null, Description $description = null) + { + Assert::integerish($startingLine); + Assert::nullOrIntegerish($lineCount); + + $this->startingLine = (int)$startingLine; + $this->lineCount = $lineCount !== null ? (int)$lineCount : null; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::stringNotEmpty($body); + Assert::notNull($descriptionFactory); + + $startingLine = 1; + $lineCount = null; + $description = null; + + // Starting line / Number of lines / Description + if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) { + $startingLine = (int)$matches[1]; + if (isset($matches[2]) && $matches[2] !== '') { + $lineCount = (int)$matches[2]; + } + + $description = $matches[3]; + } + + return new static($startingLine, $lineCount, $descriptionFactory->create($description, $context)); + } + + /** + * Gets the starting line. + * + * @return int The starting line, relative to the structural element's + * location. + */ + public function getStartingLine() + { + return $this->startingLine; + } + + /** + * Returns the number of lines. + * + * @return int|null The number of lines, relative to the starting line. NULL + * means "to the end". + */ + public function getLineCount() + { + return $this->lineCount; + } + + public function __toString() + { + return $this->startingLine + . ($this->lineCount !== null ? ' ' . $this->lineCount : '') + . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php new file mode 100644 index 0000000..349e773 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php @@ -0,0 +1,72 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}throws tag in a Docblock. + */ +final class Throws extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'throws'; + + /** @var Type */ + private $type; + + public function __construct(Type $type, Description $description = null) + { + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + $type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context); + $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + + return new static($type, $description); + } + + /** + * Returns the type section of the variable. + * + * @return Type + */ + public function getType() + { + return $this->type; + } + + public function __toString() + { + return $this->type . ' ' . $this->description; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php new file mode 100644 index 0000000..00dc3e3 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php @@ -0,0 +1,83 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}uses tag in a Docblock. + */ +final class Uses extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'uses'; + + /** @var Fqsen */ + protected $refers = null; + + /** + * Initializes this tag. + * + * @param Fqsen $refers + * @param Description $description + */ + public function __construct(Fqsen $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + FqsenResolver $resolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$resolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + return new static( + $resolver->resolve($parts[0], $context), + $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + ); + } + + /** + * Returns the structural element this tag refers to. + * + * @return Fqsen + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ' ' . $this->description->render(); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php new file mode 100644 index 0000000..8907c95 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}var tag in a Docblock. + */ +class Var_ extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'var'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . (empty($this->variableName) ? null : ('$' . $this->variableName)) + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php new file mode 100644 index 0000000..7bb0420 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php @@ -0,0 +1,94 @@ + + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}version tag in a Docblock. + */ +final class Version extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'version'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return null; + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php new file mode 100644 index 0000000..1bdb8f4 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php @@ -0,0 +1,277 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\TagFactory; +use Webmozart\Assert\Assert; + +final class DocBlockFactory implements DocBlockFactoryInterface +{ + /** @var DocBlock\DescriptionFactory */ + private $descriptionFactory; + + /** @var DocBlock\TagFactory */ + private $tagFactory; + + /** + * Initializes this factory with the required subcontractors. + * + * @param DescriptionFactory $descriptionFactory + * @param TagFactory $tagFactory + */ + public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) + { + $this->descriptionFactory = $descriptionFactory; + $this->tagFactory = $tagFactory; + } + + /** + * Factory method for easy instantiation. + * + * @param string[] $additionalTags + * + * @return DocBlockFactory + */ + public static function createInstance(array $additionalTags = []) + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + + $tagFactory->addService($descriptionFactory); + $tagFactory->addService(new TypeResolver($fqsenResolver)); + + $docBlockFactory = new self($descriptionFactory, $tagFactory); + foreach ($additionalTags as $tagName => $tagHandler) { + $docBlockFactory->registerTagHandler($tagName, $tagHandler); + } + + return $docBlockFactory; + } + + /** + * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the + * getDocComment method (such as a ReflectionClass object). + * @param Types\Context $context + * @param Location $location + * + * @return DocBlock + */ + public function create($docblock, Types\Context $context = null, Location $location = null) + { + if (is_object($docblock)) { + if (!method_exists($docblock, 'getDocComment')) { + $exceptionMessage = 'Invalid object passed; the given object must support the getDocComment method'; + throw new \InvalidArgumentException($exceptionMessage); + } + + $docblock = $docblock->getDocComment(); + } + + Assert::stringNotEmpty($docblock); + + if ($context === null) { + $context = new Types\Context(''); + } + + $parts = $this->splitDocBlock($this->stripDocComment($docblock)); + list($templateMarker, $summary, $description, $tags) = $parts; + + return new DocBlock( + $summary, + $description ? $this->descriptionFactory->create($description, $context) : null, + array_filter($this->parseTagBlock($tags, $context), function ($tag) { + return $tag instanceof Tag; + }), + $context, + $location, + $templateMarker === '#@+', + $templateMarker === '#@-' + ); + } + + public function registerTagHandler($tagName, $handler) + { + $this->tagFactory->registerTagHandler($tagName, $handler); + } + + /** + * Strips the asterisks from the DocBlock comment. + * + * @param string $comment String containing the comment text. + * + * @return string + */ + private function stripDocComment($comment) + { + $comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment)); + + // reg ex above is not able to remove */ from a single line docblock + if (substr($comment, -2) === '*/') { + $comment = trim(substr($comment, 0, -2)); + } + + return str_replace(["\r\n", "\r"], "\n", $comment); + } + + /** + * Splits the DocBlock into a template marker, summary, description and block of tags. + * + * @param string $comment Comment to split into the sub-parts. + * + * @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. + * @author Mike van Riel for extending the regex with template marker support. + * + * @return string[] containing the template marker (if any), summary, description and a string containing the tags. + */ + private function splitDocBlock($comment) + { + // Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This + // method does not split tags so we return this verbatim as the fourth result (tags). This saves us the + // performance impact of running a regular expression + if (strpos($comment, '@') === 0) { + return ['', '', '', $comment]; + } + + // clears all extra horizontal whitespace from the line endings to prevent parsing issues + $comment = preg_replace('/\h*$/Sum', '', $comment); + + /* + * Splits the docblock into a template marker, summary, description and tags section. + * + * - The template marker is empty, #@+ or #@- if the DocBlock starts with either of those (a newline may + * occur after it and will be stripped). + * - The short description is started from the first character until a dot is encountered followed by a + * newline OR two consecutive newlines (horizontal whitespace is taken into account to consider spacing + * errors). This is optional. + * - The long description, any character until a new line is encountered followed by an @ and word + * characters (a tag). This is optional. + * - Tags; the remaining characters + * + * Big thanks to RichardJ for contributing this Regular Expression + */ + preg_match( + '/ + \A + # 1. Extract the template marker + (?:(\#\@\+|\#\@\-)\n?)? + + # 2. Extract the summary + (?: + (?! @\pL ) # The summary may not start with an @ + ( + [^\n.]+ + (?: + (?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines + [\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line + [^\n.]+ # Include anything else + )* + \.? + )? + ) + + # 3. Extract the description + (?: + \s* # Some form of whitespace _must_ precede a description because a summary must be there + (?! @\pL ) # The description may not start with an @ + ( + [^\n]+ + (?: \n+ + (?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line + [^\n]+ # Include anything else + )* + ) + )? + + # 4. Extract the tags (anything that follows) + (\s+ [\s\S]*)? # everything that follows + /ux', + $comment, + $matches + ); + array_shift($matches); + + while (count($matches) < 4) { + $matches[] = ''; + } + + return $matches; + } + + /** + * Creates the tag objects. + * + * @param string $tags Tag block to parse. + * @param Types\Context $context Context of the parsed Tag + * + * @return DocBlock\Tag[] + */ + private function parseTagBlock($tags, Types\Context $context) + { + $tags = $this->filterTagBlock($tags); + if (!$tags) { + return []; + } + + $result = $this->splitTagBlockIntoTagLines($tags); + foreach ($result as $key => $tagLine) { + $result[$key] = $this->tagFactory->create(trim($tagLine), $context); + } + + return $result; + } + + /** + * @param string $tags + * + * @return string[] + */ + private function splitTagBlockIntoTagLines($tags) + { + $result = []; + foreach (explode("\n", $tags) as $tag_line) { + if (isset($tag_line[0]) && ($tag_line[0] === '@')) { + $result[] = $tag_line; + } else { + $result[count($result) - 1] .= "\n" . $tag_line; + } + } + + return $result; + } + + /** + * @param $tags + * @return string + */ + private function filterTagBlock($tags) + { + $tags = trim($tags); + if (!$tags) { + return null; + } + + if ('@' !== $tags[0]) { + // @codeCoverageIgnoreStart + // Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that + // we didn't foresee. + throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags); + // @codeCoverageIgnoreEnd + } + + return $tags; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php new file mode 100644 index 0000000..b353342 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php @@ -0,0 +1,23 @@ + please note that if you want to pass partial class names that additional steps are necessary, see the + > chapter `Resolving partial classes and FQSENs` for more information. + +Where the FqsenResolver can resolve: + +- Constant expressions (i.e. `@see \MyNamespace\MY_CONSTANT`) +- Function expressions (i.e. `@see \MyNamespace\myFunction()`) +- Class expressions (i.e. `@see \MyNamespace\MyClass`) +- Interface expressions (i.e. `@see \MyNamespace\MyInterface`) +- Trait expressions (i.e. `@see \MyNamespace\MyTrait`) +- Class constant expressions (i.e. `@see \MyNamespace\MyClass::MY_CONSTANT`) +- Property expressions (i.e. `@see \MyNamespace\MyClass::$myProperty`) +- Method expressions (i.e. `@see \MyNamespace\MyClass::myMethod()`) + +## Resolving a type + +In order to resolve a type you will have to instantiate the class `\phpDocumentor\Reflection\TypeResolver` +and call its `resolve` method like this: + +```php +$typeResolver = new \phpDocumentor\Reflection\TypeResolver(); +$type = $typeResolver->resolve('string|integer'); +``` + +In this example you will receive a Value Object of class `\phpDocumentor\Reflection\Types\Compound` that has two +elements, one of type `\phpDocumentor\Reflection\Types\String_` and one of type +`\phpDocumentor\Reflection\Types\Integer`. + +The real power of this resolver is in its capability to expand partial class names into fully qualified class names; but +in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will inform the resolver +in which namespace the given expression occurs and which namespace aliases (or imports) apply. + +## Resolving an FQSEN + +A Fully Qualified Structural Element Name is a reference to another element in your code bases and can be resolved using +the `\phpDocumentor\Reflection\FqsenResolver` class' `resolve` method, like this: + +```php +$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver(); +$fqsen = $fqsenResolver->resolve('\phpDocumentor\Reflection\FqsenResolver::resolve()'); +``` + +In this example we resolve a Fully Qualified Structural Element Name (meaning that it includes the full namespace, class +name and element name) and receive a Value Object of type `\phpDocumentor\Reflection\Fqsen`. + +The real power of this resolver is in its capability to expand partial element names into Fully Qualified Structural +Element Names; but in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will +inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply. + +## Resolving partial Classes and Structural Element Names + +Perhaps the best feature of this library is that it knows how to resolve partial class names into fully qualified class +names. + +For example, you have this file: + +```php +namespace My\Example; + +use phpDocumentor\Reflection\Types; + +class Classy +{ + /** + * @var Types\Context + * @see Classy::otherFunction() + */ + public function __construct($context) {} + + public function otherFunction(){} +} +``` + +Suppose that you would want to resolve (and expand) the type in the `@var` tag and the element name in the `@see` tag. +For the resolvers to know how to expand partial names you have to provide a bit of _Context_ for them by instantiating +a new class named `\phpDocumentor\Reflection\Types\Context` with the name of the namespace and the aliases that are in +play. + +### Creating a Context + +You can do this by manually creating a Context like this: + +```php +$context = new \phpDocumentor\Reflection\Types\Context( + '\My\Example', + [ 'Types' => '\phpDocumentor\Reflection\Types'] +); +``` + +Or by using the `\phpDocumentor\Reflection\Types\ContextFactory` to instantiate a new context based on a Reflector +object or by providing the namespace that you'd like to extract and the source code of the file in which the given +type expression occurs. + +```php +$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory(); +$context = $contextFactory->createFromReflector(new ReflectionMethod('\My\Example\Classy', '__construct')); +``` + +or + +```php +$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory(); +$context = $contextFactory->createForNamespace('\My\Example', file_get_contents('My/Example/Classy.php')); +``` + +### Using the Context + +After you have obtained a Context it is just a matter of passing it along with the `resolve` method of either Resolver +class as second argument and the Resolvers will take this into account when resolving partial names. + +To obtain the resolved class name for the `@var` tag in the example above you can do: + +```php +$typeResolver = new \phpDocumentor\Reflection\TypeResolver(); +$type = $typeResolver->resolve('Types\Context', $context); +``` + +When you do this you will receive an object of class `\phpDocumentor\Reflection\Types\Object_` for which you can call +the `getFqsen` method to receive a Value Object that represents the complete FQSEN. So that would be +`phpDocumentor\Reflection\Types\Context`. + +> Why is the FQSEN wrapped in another object `Object_`? +> +> The resolve method of the TypeResolver only returns object with the interface `Type` and the FQSEN is a common +> type that does not represent a Type. Also: in some cases a type can represent an "Untyped Object", meaning that it +> is an object (signified by the `object` keyword) but does not refer to a specific element using an FQSEN. + +Another example is on how to resolve the FQSEN of a method as can be seen with the `@see` tag in the example above. To +resolve that you can do the following: + +```php +$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver(); +$type = $fqsenResolver->resolve('Classy::otherFunction()', $context); +``` + +Because Classy is a Class in the current namespace its FQSEN will have the `My\Example` namespace and by calling the +`resolve` method of the FQSEN Resolver you will receive an `Fqsen` object that refers to +`\My\Example\Classy::otherFunction()`. diff --git a/vendor/phpdocumentor/type-resolver/composer.json b/vendor/phpdocumentor/type-resolver/composer.json new file mode 100644 index 0000000..82ead15 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpdocumentor/type-resolver", + "type": "library", + "license": "MIT", + "authors": [ + {"name": "Mike van Riel", "email": "me@mikevanriel.com"} + ], + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "autoload": { + "psr-4": {"phpDocumentor\\Reflection\\": ["src/"]} + }, + "autoload-dev": { + "psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]} + }, + "require-dev": { + "phpunit/phpunit": "^5.2||^4.8.24", + "mockery/mockery": "^0.9.4" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php b/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php new file mode 100644 index 0000000..9aa6ba3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php @@ -0,0 +1,77 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\Types\Context; + +class FqsenResolver +{ + /** @var string Definition of the NAMESPACE operator in PHP */ + const OPERATOR_NAMESPACE = '\\'; + + public function resolve($fqsen, Context $context = null) + { + if ($context === null) { + $context = new Context(''); + } + + if ($this->isFqsen($fqsen)) { + return new Fqsen($fqsen); + } + + return $this->resolvePartialStructuralElementName($fqsen, $context); + } + + /** + * Tests whether the given type is a Fully Qualified Structural Element Name. + * + * @param string $type + * + * @return bool + */ + private function isFqsen($type) + { + return strpos($type, self::OPERATOR_NAMESPACE) === 0; + } + + /** + * Resolves a partial Structural Element Name (i.e. `Reflection\DocBlock`) to its FQSEN representation + * (i.e. `\phpDocumentor\Reflection\DocBlock`) based on the Namespace and aliases mentioned in the Context. + * + * @param string $type + * @param Context $context + * + * @return Fqsen + * @throws \InvalidArgumentException when type is not a valid FQSEN. + */ + private function resolvePartialStructuralElementName($type, Context $context) + { + $typeParts = explode(self::OPERATOR_NAMESPACE, $type, 2); + + $namespaceAliases = $context->getNamespaceAliases(); + + // if the first segment is not an alias; prepend namespace name and return + if (!isset($namespaceAliases[$typeParts[0]])) { + $namespace = $context->getNamespace(); + if ('' !== $namespace) { + $namespace .= self::OPERATOR_NAMESPACE; + } + + return new Fqsen(self::OPERATOR_NAMESPACE . $namespace . $type); + } + + $typeParts[0] = $namespaceAliases[$typeParts[0]]; + + return new Fqsen(self::OPERATOR_NAMESPACE . implode(self::OPERATOR_NAMESPACE, $typeParts)); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Type.php b/vendor/phpdocumentor/type-resolver/src/Type.php new file mode 100644 index 0000000..33ca559 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Type.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +interface Type +{ + public function __toString(); +} diff --git a/vendor/phpdocumentor/type-resolver/src/TypeResolver.php b/vendor/phpdocumentor/type-resolver/src/TypeResolver.php new file mode 100644 index 0000000..08b2a5f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/TypeResolver.php @@ -0,0 +1,298 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\Types\Array_; +use phpDocumentor\Reflection\Types\Compound; +use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\Iterable_; +use phpDocumentor\Reflection\Types\Nullable; +use phpDocumentor\Reflection\Types\Object_; + +final class TypeResolver +{ + /** @var string Definition of the ARRAY operator for types */ + const OPERATOR_ARRAY = '[]'; + + /** @var string Definition of the NAMESPACE operator in PHP */ + const OPERATOR_NAMESPACE = '\\'; + + /** @var string[] List of recognized keywords and unto which Value Object they map */ + private $keywords = array( + 'string' => Types\String_::class, + 'int' => Types\Integer::class, + 'integer' => Types\Integer::class, + 'bool' => Types\Boolean::class, + 'boolean' => Types\Boolean::class, + 'float' => Types\Float_::class, + 'double' => Types\Float_::class, + 'object' => Object_::class, + 'mixed' => Types\Mixed_::class, + 'array' => Array_::class, + 'resource' => Types\Resource_::class, + 'void' => Types\Void_::class, + 'null' => Types\Null_::class, + 'scalar' => Types\Scalar::class, + 'callback' => Types\Callable_::class, + 'callable' => Types\Callable_::class, + 'false' => Types\Boolean::class, + 'true' => Types\Boolean::class, + 'self' => Types\Self_::class, + '$this' => Types\This::class, + 'static' => Types\Static_::class, + 'parent' => Types\Parent_::class, + 'iterable' => Iterable_::class, + ); + + /** @var FqsenResolver */ + private $fqsenResolver; + + /** + * Initializes this TypeResolver with the means to create and resolve Fqsen objects. + * + * @param FqsenResolver $fqsenResolver + */ + public function __construct(FqsenResolver $fqsenResolver = null) + { + $this->fqsenResolver = $fqsenResolver ?: new FqsenResolver(); + } + + /** + * Analyzes the given type and returns the FQCN variant. + * + * When a type is provided this method checks whether it is not a keyword or + * Fully Qualified Class Name. If so it will use the given namespace and + * aliases to expand the type to a FQCN representation. + * + * This method only works as expected if the namespace and aliases are set; + * no dynamic reflection is being performed here. + * + * @param string $type The relative or absolute type. + * @param Context $context + * + * @uses Context::getNamespace() to determine with what to prefix the type name. + * @uses Context::getNamespaceAliases() to check whether the first part of the relative type name should not be + * replaced with another namespace. + * + * @return Type|null + */ + public function resolve($type, Context $context = null) + { + if (!is_string($type)) { + throw new \InvalidArgumentException( + 'Attempted to resolve type but it appeared not to be a string, received: ' . var_export($type, true) + ); + } + + $type = trim($type); + if (!$type) { + throw new \InvalidArgumentException('Attempted to resolve "' . $type . '" but it appears to be empty'); + } + + if ($context === null) { + $context = new Context(''); + } + + switch (true) { + case $this->isNullableType($type): + return $this->resolveNullableType($type, $context); + case $this->isKeyword($type): + return $this->resolveKeyword($type); + case ($this->isCompoundType($type)): + return $this->resolveCompoundType($type, $context); + case $this->isTypedArray($type): + return $this->resolveTypedArray($type, $context); + case $this->isFqsen($type): + return $this->resolveTypedObject($type); + case $this->isPartialStructuralElementName($type): + return $this->resolveTypedObject($type, $context); + // @codeCoverageIgnoreStart + default: + // I haven't got the foggiest how the logic would come here but added this as a defense. + throw new \RuntimeException( + 'Unable to resolve type "' . $type . '", there is no known method to resolve it' + ); + } + // @codeCoverageIgnoreEnd + } + + /** + * Adds a keyword to the list of Keywords and associates it with a specific Value Object. + * + * @param string $keyword + * @param string $typeClassName + * + * @return void + */ + public function addKeyword($keyword, $typeClassName) + { + if (!class_exists($typeClassName)) { + throw new \InvalidArgumentException( + 'The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class' + . ' but we could not find the class ' . $typeClassName + ); + } + + if (!in_array(Type::class, class_implements($typeClassName))) { + throw new \InvalidArgumentException( + 'The class "' . $typeClassName . '" must implement the interface "phpDocumentor\Reflection\Type"' + ); + } + + $this->keywords[$keyword] = $typeClassName; + } + + /** + * Detects whether the given type represents an array. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isTypedArray($type) + { + return substr($type, -2) === self::OPERATOR_ARRAY; + } + + /** + * Detects whether the given type represents a PHPDoc keyword. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isKeyword($type) + { + return in_array(strtolower($type), array_keys($this->keywords), true); + } + + /** + * Detects whether the given type represents a relative structural element name. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isPartialStructuralElementName($type) + { + return ($type[0] !== self::OPERATOR_NAMESPACE) && !$this->isKeyword($type); + } + + /** + * Tests whether the given type is a Fully Qualified Structural Element Name. + * + * @param string $type + * + * @return bool + */ + private function isFqsen($type) + { + return strpos($type, self::OPERATOR_NAMESPACE) === 0; + } + + /** + * Tests whether the given type is a compound type (i.e. `string|int`). + * + * @param string $type + * + * @return bool + */ + private function isCompoundType($type) + { + return strpos($type, '|') !== false; + } + + /** + * Test whether the given type is a nullable type (i.e. `?string`) + * + * @param string $type + * + * @return bool + */ + private function isNullableType($type) + { + return $type[0] === '?'; + } + + /** + * Resolves the given typed array string (i.e. `string[]`) into an Array object with the right types set. + * + * @param string $type + * @param Context $context + * + * @return Array_ + */ + private function resolveTypedArray($type, Context $context) + { + return new Array_($this->resolve(substr($type, 0, -2), $context)); + } + + /** + * Resolves the given keyword (such as `string`) into a Type object representing that keyword. + * + * @param string $type + * + * @return Type + */ + private function resolveKeyword($type) + { + $className = $this->keywords[strtolower($type)]; + + return new $className(); + } + + /** + * Resolves the given FQSEN string into an FQSEN object. + * + * @param string $type + * @param Context|null $context + * + * @return Object_ + */ + private function resolveTypedObject($type, Context $context = null) + { + return new Object_($this->fqsenResolver->resolve($type, $context)); + } + + /** + * Resolves a compound type (i.e. `string|int`) into the appropriate Type objects or FQSEN. + * + * @param string $type + * @param Context $context + * + * @return Compound + */ + private function resolveCompoundType($type, Context $context) + { + $types = []; + + foreach (explode('|', $type) as $part) { + $types[] = $this->resolve($part, $context); + } + + return new Compound($types); + } + + /** + * Resolve nullable types (i.e. `?string`) into a Nullable type wrapper + * + * @param string $type + * @param Context $context + * + * @return Nullable + */ + private function resolveNullableType($type, Context $context) + { + return new Nullable($this->resolve(ltrim($type, '?'), $context)); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Array_.php b/vendor/phpdocumentor/type-resolver/src/Types/Array_.php new file mode 100644 index 0000000..49b7c6e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Array_.php @@ -0,0 +1,86 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Represents an array type as described in the PSR-5, the PHPDoc Standard. + * + * An array can be represented in two forms: + * + * 1. Untyped (`array`), where the key and value type is unknown and hence classified as 'Mixed_'. + * 2. Types (`string[]`), where the value type is provided by preceding an opening and closing square bracket with a + * type name. + */ +final class Array_ implements Type +{ + /** @var Type */ + private $valueType; + + /** @var Type */ + private $keyType; + + /** + * Initializes this representation of an array with the given Type or Fqsen. + * + * @param Type $valueType + * @param Type $keyType + */ + public function __construct(Type $valueType = null, Type $keyType = null) + { + if ($keyType === null) { + $keyType = new Compound([ new String_(), new Integer() ]); + } + if ($valueType === null) { + $valueType = new Mixed_(); + } + + $this->valueType = $valueType; + $this->keyType = $keyType; + } + + /** + * Returns the type for the keys of this array. + * + * @return Type + */ + public function getKeyType() + { + return $this->keyType; + } + + /** + * Returns the value for the keys of this array. + * + * @return Type + */ + public function getValueType() + { + return $this->valueType; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + if ($this->valueType instanceof Mixed_) { + return 'array'; + } + + return $this->valueType . '[]'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php b/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php new file mode 100644 index 0000000..f82b19e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Boolean type. + */ +final class Boolean implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'bool'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php b/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php new file mode 100644 index 0000000..68ebfbd --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Callable type. + */ +final class Callable_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'callable'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Compound.php b/vendor/phpdocumentor/type-resolver/src/Types/Compound.php new file mode 100644 index 0000000..be986c3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Compound.php @@ -0,0 +1,93 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use ArrayIterator; +use IteratorAggregate; +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Compound Type. + * + * A Compound Type is not so much a special keyword or object reference but is a series of Types that are separated + * using an OR operator (`|`). This combination of types signifies that whatever is associated with this compound type + * may contain a value with any of the given types. + */ +final class Compound implements Type, IteratorAggregate +{ + /** @var Type[] */ + private $types; + + /** + * Initializes a compound type (i.e. `string|int`) and tests if the provided types all implement the Type interface. + * + * @param Type[] $types + * @throws \InvalidArgumentException when types are not all instance of Type + */ + public function __construct(array $types) + { + foreach ($types as $type) { + if (!$type instanceof Type) { + throw new \InvalidArgumentException('A compound type can only have other types as elements'); + } + } + + $this->types = $types; + } + + /** + * Returns the type at the given index. + * + * @param integer $index + * + * @return Type|null + */ + public function get($index) + { + if (!$this->has($index)) { + return null; + } + + return $this->types[$index]; + } + + /** + * Tests if this compound type has a type with the given index. + * + * @param integer $index + * + * @return bool + */ + public function has($index) + { + return isset($this->types[$index]); + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return implode('|', $this->types); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new ArrayIterator($this->types); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Context.php b/vendor/phpdocumentor/type-resolver/src/Types/Context.php new file mode 100644 index 0000000..4e9ce5a --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Context.php @@ -0,0 +1,84 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +/** + * Provides information about the Context in which the DocBlock occurs that receives this context. + * + * A DocBlock does not know of its own accord in which namespace it occurs and which namespace aliases are applicable + * for the block of code in which it is in. This information is however necessary to resolve Class names in tags since + * you can provide a short form or make use of namespace aliases. + * + * The phpDocumentor Reflection component knows how to create this class but if you use the DocBlock parser from your + * own application it is possible to generate a Context class using the ContextFactory; this will analyze the file in + * which an associated class resides for its namespace and imports. + * + * @see ContextFactory::createFromClassReflector() + * @see ContextFactory::createForNamespace() + */ +final class Context +{ + /** @var string The current namespace. */ + private $namespace; + + /** @var array List of namespace aliases => Fully Qualified Namespace. */ + private $namespaceAliases; + + /** + * Initializes the new context and normalizes all passed namespaces to be in Qualified Namespace Name (QNN) + * format (without a preceding `\`). + * + * @param string $namespace The namespace where this DocBlock resides in. + * @param array $namespaceAliases List of namespace aliases => Fully Qualified Namespace. + */ + public function __construct($namespace, array $namespaceAliases = []) + { + $this->namespace = ('global' !== $namespace && 'default' !== $namespace) + ? trim((string)$namespace, '\\') + : ''; + + foreach ($namespaceAliases as $alias => $fqnn) { + if ($fqnn[0] === '\\') { + $fqnn = substr($fqnn, 1); + } + if ($fqnn[strlen($fqnn) - 1] === '\\') { + $fqnn = substr($fqnn, 0, -1); + } + + $namespaceAliases[$alias] = $fqnn; + } + + $this->namespaceAliases = $namespaceAliases; + } + + /** + * Returns the Qualified Namespace Name (thus without `\` in front) where the associated element is in. + * + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Returns a list of Qualified Namespace Names (thus without `\` in front) that are imported, the keys represent + * the alias for the imported Namespace. + * + * @return string[] + */ + public function getNamespaceAliases() + { + return $this->namespaceAliases; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php b/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php new file mode 100644 index 0000000..30936a3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php @@ -0,0 +1,210 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +/** + * Convenience class to create a Context for DocBlocks when not using the Reflection Component of phpDocumentor. + * + * For a DocBlock to be able to resolve types that use partial namespace names or rely on namespace imports we need to + * provide a bit of context so that the DocBlock can read that and based on it decide how to resolve the types to + * Fully Qualified names. + * + * @see Context for more information. + */ +final class ContextFactory +{ + /** The literal used at the end of a use statement. */ + const T_LITERAL_END_OF_USE = ';'; + + /** The literal used between sets of use statements */ + const T_LITERAL_USE_SEPARATOR = ','; + + /** + * Build a Context given a Class Reflection. + * + * @param \Reflector $reflector + * + * @see Context for more information on Contexts. + * + * @return Context + */ + public function createFromReflector(\Reflector $reflector) + { + if (method_exists($reflector, 'getDeclaringClass')) { + $reflector = $reflector->getDeclaringClass(); + } + + $fileName = $reflector->getFileName(); + $namespace = $reflector->getNamespaceName(); + + if (file_exists($fileName)) { + return $this->createForNamespace($namespace, file_get_contents($fileName)); + } + + return new Context($namespace, []); + } + + /** + * Build a Context for a namespace in the provided file contents. + * + * @param string $namespace It does not matter if a `\` precedes the namespace name, this method first normalizes. + * @param string $fileContents the file's contents to retrieve the aliases from with the given namespace. + * + * @see Context for more information on Contexts. + * + * @return Context + */ + public function createForNamespace($namespace, $fileContents) + { + $namespace = trim($namespace, '\\'); + $useStatements = []; + $currentNamespace = ''; + $tokens = new \ArrayIterator(token_get_all($fileContents)); + + while ($tokens->valid()) { + switch ($tokens->current()[0]) { + case T_NAMESPACE: + $currentNamespace = $this->parseNamespace($tokens); + break; + case T_CLASS: + // Fast-forward the iterator through the class so that any + // T_USE tokens found within are skipped - these are not + // valid namespace use statements so should be ignored. + $braceLevel = 0; + $firstBraceFound = false; + while ($tokens->valid() && ($braceLevel > 0 || !$firstBraceFound)) { + if ($tokens->current() === '{' + || $tokens->current()[0] === T_CURLY_OPEN + || $tokens->current()[0] === T_DOLLAR_OPEN_CURLY_BRACES) { + if (!$firstBraceFound) { + $firstBraceFound = true; + } + $braceLevel++; + } + + if ($tokens->current() === '}') { + $braceLevel--; + } + $tokens->next(); + } + break; + case T_USE: + if ($currentNamespace === $namespace) { + $useStatements = array_merge($useStatements, $this->parseUseStatement($tokens)); + } + break; + } + $tokens->next(); + } + + return new Context($namespace, $useStatements); + } + + /** + * Deduce the name from tokens when we are at the T_NAMESPACE token. + * + * @param \ArrayIterator $tokens + * + * @return string + */ + private function parseNamespace(\ArrayIterator $tokens) + { + // skip to the first string or namespace separator + $this->skipToNextStringOrNamespaceSeparator($tokens); + + $name = ''; + while ($tokens->valid() && ($tokens->current()[0] === T_STRING || $tokens->current()[0] === T_NS_SEPARATOR) + ) { + $name .= $tokens->current()[1]; + $tokens->next(); + } + + return $name; + } + + /** + * Deduce the names of all imports when we are at the T_USE token. + * + * @param \ArrayIterator $tokens + * + * @return string[] + */ + private function parseUseStatement(\ArrayIterator $tokens) + { + $uses = []; + $continue = true; + + while ($continue) { + $this->skipToNextStringOrNamespaceSeparator($tokens); + + list($alias, $fqnn) = $this->extractUseStatement($tokens); + $uses[$alias] = $fqnn; + if ($tokens->current()[0] === self::T_LITERAL_END_OF_USE) { + $continue = false; + } + } + + return $uses; + } + + /** + * Fast-forwards the iterator as longs as we don't encounter a T_STRING or T_NS_SEPARATOR token. + * + * @param \ArrayIterator $tokens + * + * @return void + */ + private function skipToNextStringOrNamespaceSeparator(\ArrayIterator $tokens) + { + while ($tokens->valid() && ($tokens->current()[0] !== T_STRING) && ($tokens->current()[0] !== T_NS_SEPARATOR)) { + $tokens->next(); + } + } + + /** + * Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of + * a USE statement yet. + * + * @param \ArrayIterator $tokens + * + * @return string + */ + private function extractUseStatement(\ArrayIterator $tokens) + { + $result = ['']; + while ($tokens->valid() + && ($tokens->current()[0] !== self::T_LITERAL_USE_SEPARATOR) + && ($tokens->current()[0] !== self::T_LITERAL_END_OF_USE) + ) { + if ($tokens->current()[0] === T_AS) { + $result[] = ''; + } + if ($tokens->current()[0] === T_STRING || $tokens->current()[0] === T_NS_SEPARATOR) { + $result[count($result) - 1] .= $tokens->current()[1]; + } + $tokens->next(); + } + + if (count($result) == 1) { + $backslashPos = strrpos($result[0], '\\'); + + if (false !== $backslashPos) { + $result[] = substr($result[0], $backslashPos + 1); + } else { + $result[] = $result[0]; + } + } + + return array_reverse($result); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Float_.php b/vendor/phpdocumentor/type-resolver/src/Types/Float_.php new file mode 100644 index 0000000..e58d896 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Float_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Float. + */ +final class Float_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'float'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Integer.php b/vendor/phpdocumentor/type-resolver/src/Types/Integer.php new file mode 100644 index 0000000..be4555e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Integer.php @@ -0,0 +1,28 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +final class Integer implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'int'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php b/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php new file mode 100644 index 0000000..0cbf48f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing iterable type + */ +final class Iterable_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'iterable'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php b/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php new file mode 100644 index 0000000..c1c165f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing an unknown, or mixed, type. + */ +final class Mixed_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'mixed'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Null_.php b/vendor/phpdocumentor/type-resolver/src/Types/Null_.php new file mode 100644 index 0000000..203b422 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Null_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a null value or type. + */ +final class Null_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'null'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php b/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php new file mode 100644 index 0000000..3c6d1b1 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php @@ -0,0 +1,56 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a nullable type. The real type is wrapped. + */ +final class Nullable implements Type +{ + /** + * @var Type + */ + private $realType; + + /** + * Initialises this nullable type using the real type embedded + * + * @param Type $realType + */ + public function __construct(Type $realType) + { + $this->realType = $realType; + } + + /** + * Provide access to the actual type directly, if needed. + * + * @return Type + */ + public function getActualType() + { + return $this->realType; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return '?' . $this->realType->__toString(); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Object_.php b/vendor/phpdocumentor/type-resolver/src/Types/Object_.php new file mode 100644 index 0000000..389f7c7 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Object_.php @@ -0,0 +1,71 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing an object. + * + * An object can be either typed or untyped. When an object is typed it means that it has an identifier, the FQSEN, + * pointing to an element in PHP. Object types that are untyped do not refer to a specific class but represent objects + * in general. + */ +final class Object_ implements Type +{ + /** @var Fqsen|null */ + private $fqsen; + + /** + * Initializes this object with an optional FQSEN, if not provided this object is considered 'untyped'. + * + * @param Fqsen $fqsen + * @throws \InvalidArgumentException when provided $fqsen is not a valid type. + */ + public function __construct(Fqsen $fqsen = null) + { + if (strpos((string)$fqsen, '::') !== false || strpos((string)$fqsen, '()') !== false) { + throw new \InvalidArgumentException( + 'Object types can only refer to a class, interface or trait but a method, function, constant or ' + . 'property was received: ' . (string)$fqsen + ); + } + + $this->fqsen = $fqsen; + } + + /** + * Returns the FQSEN associated with this object. + * + * @return Fqsen|null + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + if ($this->fqsen) { + return (string)$this->fqsen; + } + + return 'object'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php b/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php new file mode 100644 index 0000000..aabdbfb --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php @@ -0,0 +1,33 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'parent' type. + * + * Parent, as a Type, represents the parent class of class in which the associated element was defined. + */ +final class Parent_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'parent'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php b/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php new file mode 100644 index 0000000..a1b613d --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'resource' Type. + */ +final class Resource_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'resource'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php b/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php new file mode 100644 index 0000000..1e2a660 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'scalar' pseudo-type, which is either a string, integer, float or boolean. + */ +final class Scalar implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'scalar'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Self_.php b/vendor/phpdocumentor/type-resolver/src/Types/Self_.php new file mode 100644 index 0000000..1ba3fc5 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Self_.php @@ -0,0 +1,33 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'self' type. + * + * Self, as a Type, represents the class in which the associated element was defined. + */ +final class Self_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'self'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Static_.php b/vendor/phpdocumentor/type-resolver/src/Types/Static_.php new file mode 100644 index 0000000..9eb6729 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Static_.php @@ -0,0 +1,38 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'static' type. + * + * Self, as a Type, represents the class in which the associated element was called. This differs from self as self does + * not take inheritance into account but static means that the return type is always that of the class of the called + * element. + * + * See the documentation on late static binding in the PHP Documentation for more information on the difference between + * static and self. + */ +final class Static_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'static'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/String_.php b/vendor/phpdocumentor/type-resolver/src/Types/String_.php new file mode 100644 index 0000000..8db5968 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/String_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the type 'string'. + */ +final class String_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'string'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/This.php b/vendor/phpdocumentor/type-resolver/src/Types/This.php new file mode 100644 index 0000000..c098a93 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/This.php @@ -0,0 +1,34 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the '$this' pseudo-type. + * + * $this, as a Type, represents the instance of the class associated with the element as it was called. $this is + * commonly used when documenting fluent interfaces since it represents that the same object is returned. + */ +final class This implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return '$this'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Void_.php b/vendor/phpdocumentor/type-resolver/src/Types/Void_.php new file mode 100644 index 0000000..3d1be27 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Void_.php @@ -0,0 +1,34 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the pseudo-type 'void'. + * + * Void is generally only used when working with return types as it signifies that the method intentionally does not + * return any value. + */ +final class Void_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'void'; + } +} diff --git a/vendor/phpspec/prophecy/CHANGES.md b/vendor/phpspec/prophecy/CHANGES.md new file mode 100644 index 0000000..37a4807 --- /dev/null +++ b/vendor/phpspec/prophecy/CHANGES.md @@ -0,0 +1,218 @@ +1.8.1 / 2019/06/13 +================== + +* [fixed] Don't try to patch final constructors (@NiR) + +1.8.0 / 2018/08/05 +================== + +* Support for void return types without explicit will (@crellbar) +* Clearer error message for unexpected method calls (@meridius) +* Clearer error message for aggregate exceptions (@meridius) +* More verbose `shouldBeCalledOnce` expectation (@olvlvl) +* Ability to double Throwable, or methods that extend it (@ciaranmcnulty) +* [fixed] Doubling methods where class has additional arguments to interface (@webimpress) +* [fixed] Doubling methods where arguments are nullable but default is not null (@webimpress) +* [fixed] Doubling magic methods on parent class (@dsnopek) +* [fixed] Check method predictions only once (@dontub) +* [fixed] Argument::containingString throwing error when called with non-string (@dcabrejas) + +1.7.6 / 2018/04/18 +================== + +* Allow sebastian/comparator ^3.0 (@sebastianbergmann) + +1.7.5 / 2018/02/11 +================== + +* Support for object return type hints (thanks @greg0ire) + +1.7.4 / 2018/02/11 +================== + +* Fix issues with PHP 7.2 (thanks @greg0ire) +* Support object type hints in PHP 7.2 (thanks @@jansvoboda11) + +1.7.3 / 2017/11/24 +================== + +* Fix SplInfo ClassPatch to work with Symfony 4 (Thanks @gnugat) + +1.7.2 / 2017-10-04 +================== + +* Reverted "check method predictions only once" due to it breaking Spies + +1.7.1 / 2017-10-03 +================== + +* Allow PHP5 keywords methods generation on PHP7 (thanks @bycosta) +* Allow reflection-docblock v4 (thanks @GrahamCampbell) +* Check method predictions only once (thanks @dontub) +* Escape file path sent to \SplFileObjectConstructor when running on Windows (thanks @danmartin-epiphany) + +1.7.0 / 2017-03-02 +================== + +* Add full PHP 7.1 Support (thanks @prolic) +* Allow `sebastian/comparator ^2.0` (thanks @sebastianbergmann) +* Allow `sebastian/recursion-context ^3.0` (thanks @sebastianbergmann) +* Allow `\Error` instances in `ThrowPromise` (thanks @jameshalsall) +* Support `phpspec/phpspect ^3.2` (thanks @Sam-Burns) +* Fix failing builds (thanks @Sam-Burns) + +1.6.2 / 2016-11-21 +================== + +* Added support for detecting @method on interfaces that the class itself implements, or when the stubbed class is an interface itself (thanks @Seldaek) +* Added support for sebastian/recursion-context 2 (thanks @sebastianbergmann) +* Added testing on PHP 7.1 on Travis (thanks @danizord) +* Fixed the usage of the phpunit comparator (thanks @Anyqax) + +1.6.1 / 2016-06-07 +================== + + * Ignored empty method names in invalid `@method` phpdoc + * Fixed the mocking of SplFileObject + * Added compatibility with phpdocumentor/reflection-docblock 3 + +1.6.0 / 2016-02-15 +================== + + * Add Variadics support (thanks @pamil) + * Add ProphecyComparator for comparing objects that need revealing (thanks @jon-acker) + * Add ApproximateValueToken (thanks @dantleech) + * Add support for 'self' and 'parent' return type (thanks @bendavies) + * Add __invoke to allowed reflectable methods list (thanks @ftrrtf) + * Updated ExportUtil to reflect the latest changes by Sebastian (thanks @jakari) + * Specify the required php version for composer (thanks @jakzal) + * Exclude 'args' in the generated backtrace (thanks @oradwell) + * Fix code generation for scalar parameters (thanks @trowski) + * Fix missing sprintf in InvalidArgumentException __construct call (thanks @emmanuelballery) + * Fix phpdoc for magic methods (thanks @Tobion) + * Fix PhpDoc for interfaces usage (thanks @ImmRanneft) + * Prevent final methods from being manually extended (thanks @kamioftea) + * Enhance exception for invalid argument to ThrowPromise (thanks @Tobion) + +1.5.0 / 2015-04-27 +================== + + * Add support for PHP7 scalar type hints (thanks @trowski) + * Add support for PHP7 return types (thanks @trowski) + * Update internal test suite to support PHP7 + +1.4.1 / 2015-04-27 +================== + + * Fixed bug in closure-based argument tokens (#181) + +1.4.0 / 2015-03-27 +================== + + * Fixed errors in return type phpdocs (thanks @sobit) + * Fixed stringifying of hash containing one value (thanks @avant1) + * Improved clarity of method call expectation exception (thanks @dantleech) + * Add ability to specify which argument is returned in willReturnArgument (thanks @coderbyheart) + * Add more information to MethodNotFound exceptions (thanks @ciaranmcnulty) + * Support for mocking classes with methods that return references (thanks @edsonmedina) + * Improved object comparison (thanks @whatthejeff) + * Adopted '^' in composer dependencies (thanks @GrahamCampbell) + * Fixed non-typehinted arguments being treated as optional (thanks @whatthejeff) + * Magic methods are now filtered for keywords (thanks @seagoj) + * More readable errors for failure when expecting single calls (thanks @dantleech) + +1.3.1 / 2014-11-17 +================== + + * Fix the edge case when failed predictions weren't recorded for `getCheckedPredictions()` + +1.3.0 / 2014-11-14 +================== + + * Add a way to get checked predictions with `MethodProphecy::getCheckedPredictions()` + * Fix HHVM compatibility + * Remove dead code (thanks @stof) + * Add support for DirectoryIterators (thanks @shanethehat) + +1.2.0 / 2014-07-18 +================== + + * Added support for doubling magic methods documented in the class phpdoc (thanks @armetiz) + * Fixed a segfault appearing in some cases (thanks @dmoreaulf) + * Fixed the doubling of methods with typehints on non-existent classes (thanks @gquemener) + * Added support for internal classes using keywords as method names (thanks @milan) + * Added IdenticalValueToken and Argument::is (thanks @florianv) + * Removed the usage of scalar typehints in HHVM as HHVM 3 does not support them anymore in PHP code (thanks @whatthejeff) + +1.1.2 / 2014-01-24 +================== + + * Spy automatically promotes spied method call to an expected one + +1.1.1 / 2014-01-15 +================== + + * Added support for HHVM + +1.1.0 / 2014-01-01 +================== + + * Changed the generated class names to use a static counter instead of a random number + * Added a clss patch for ReflectionClass::newInstance to make its argument optional consistently (thanks @docteurklein) + * Fixed mirroring of classes with typehints on non-existent classes (thanks @docteurklein) + * Fixed the support of array callables in CallbackPromise and CallbackPrediction (thanks @ciaranmcnulty) + * Added support for properties in ObjectStateToken (thanks @adrienbrault) + * Added support for mocking classes with a final constructor (thanks @ciaranmcnulty) + * Added ArrayEveryEntryToken and Argument::withEveryEntry() (thanks @adrienbrault) + * Added an exception when trying to prophesize on a final method instead of ignoring silently (thanks @docteurklein) + * Added StringContainToken and Argument::containingString() (thanks @peterjmit) + * Added ``shouldNotHaveBeenCalled`` on the MethodProphecy (thanks @ciaranmcnulty) + * Fixed the comparison of objects in ExactValuetoken (thanks @sstok) + * Deprecated ``shouldNotBeenCalled`` in favor of ``shouldNotHaveBeenCalled`` + +1.0.4 / 2013-08-10 +================== + + * Better randomness for generated class names (thanks @sstok) + * Add support for interfaces into TypeToken and Argument::type() (thanks @sstok) + * Add support for old-style (method name === class name) constructors (thanks @l310 for report) + +1.0.3 / 2013-07-04 +================== + + * Support callable typehints (thanks @stof) + * Do not attempt to autoload arrays when generating code (thanks @MarcoDeBortoli) + * New ArrayEntryToken (thanks @kagux) + +1.0.2 / 2013-05-19 +================== + + * Logical `AND` token added (thanks @kagux) + * Logical `NOT` token added (thanks @kagux) + * Add support for setting custom constructor arguments + * Properly stringify hashes + * Record calls that throw exceptions + * Migrate spec suite to PhpSpec 2.0 + +1.0.1 / 2013-04-30 +================== + + * Fix broken UnexpectedCallException message + * Trim AggregateException message + +1.0.0 / 2013-04-29 +================== + + * Improve exception messages + +1.0.0-BETA2 / 2013-04-03 +======================== + + * Add more debug information to CallTimes and Call prediction exception messages + * Fix MethodNotFoundException wrong namespace (thanks @gunnarlium) + * Fix some typos in the exception messages (thanks @pborreli) + +1.0.0-BETA1 / 2013-03-25 +======================== + + * Initial release diff --git a/vendor/phpspec/prophecy/LICENSE b/vendor/phpspec/prophecy/LICENSE new file mode 100644 index 0000000..c8b3647 --- /dev/null +++ b/vendor/phpspec/prophecy/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2013 Konstantin Kudryashov + Marcello Duarte + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/phpspec/prophecy/README.md b/vendor/phpspec/prophecy/README.md new file mode 100644 index 0000000..b190d43 --- /dev/null +++ b/vendor/phpspec/prophecy/README.md @@ -0,0 +1,391 @@ +# Prophecy + +[![Stable release](https://poser.pugx.org/phpspec/prophecy/version.svg)](https://packagist.org/packages/phpspec/prophecy) +[![Build Status](https://travis-ci.org/phpspec/prophecy.svg?branch=master)](https://travis-ci.org/phpspec/prophecy) + +Prophecy is a highly opinionated yet very powerful and flexible PHP object mocking +framework. Though initially it was created to fulfil phpspec2 needs, it is flexible +enough to be used inside any testing framework out there with minimal effort. + +## A simple example + +```php +prophet->prophesize('App\Security\Hasher'); + $user = new App\Entity\User($hasher->reveal()); + + $hasher->generateHash($user, 'qwerty')->willReturn('hashed_pass'); + + $user->setPassword('qwerty'); + + $this->assertEquals('hashed_pass', $user->getPassword()); + } + + protected function setup() + { + $this->prophet = new \Prophecy\Prophet; + } + + protected function tearDown() + { + $this->prophet->checkPredictions(); + } +} +``` + +## Installation + +### Prerequisites + +Prophecy requires PHP 5.3.3 or greater. + +### Setup through composer + +First, add Prophecy to the list of dependencies inside your `composer.json`: + +```json +{ + "require-dev": { + "phpspec/prophecy": "~1.0" + } +} +``` + +Then simply install it with composer: + +```bash +$> composer install --prefer-dist +``` + +You can read more about Composer on its [official webpage](http://getcomposer.org). + +## How to use it + +First of all, in Prophecy every word has a logical meaning, even the name of the library +itself (Prophecy). When you start feeling that, you'll become very fluid with this +tool. + +For example, Prophecy has been named that way because it concentrates on describing the future +behavior of objects with very limited knowledge about them. But as with any other prophecy, +those object prophecies can't create themselves - there should be a Prophet: + +```php +$prophet = new Prophecy\Prophet; +``` + +The Prophet creates prophecies by *prophesizing* them: + +```php +$prophecy = $prophet->prophesize(); +``` + +The result of the `prophesize()` method call is a new object of class `ObjectProphecy`. Yes, +that's your specific object prophecy, which describes how your object would behave +in the near future. But first, you need to specify which object you're talking about, +right? + +```php +$prophecy->willExtend('stdClass'); +$prophecy->willImplement('SessionHandlerInterface'); +``` + +There are 2 interesting calls - `willExtend` and `willImplement`. The first one tells +object prophecy that our object should extend specific class, the second one says that +it should implement some interface. Obviously, objects in PHP can implement multiple +interfaces, but extend only one parent class. + +### Dummies + +Ok, now we have our object prophecy. What can we do with it? First of all, we can get +our object *dummy* by revealing its prophecy: + +```php +$dummy = $prophecy->reveal(); +``` + +The `$dummy` variable now holds a special dummy object. Dummy objects are objects that extend +and/or implement preset classes/interfaces by overriding all their public methods. The key +point about dummies is that they do not hold any logic - they just do nothing. Any method +of the dummy will always return `null` and the dummy will never throw any exceptions. +Dummy is your friend if you don't care about the actual behavior of this double and just need +a token object to satisfy a method typehint. + +You need to understand one thing - a dummy is not a prophecy. Your object prophecy is still +assigned to `$prophecy` variable and in order to manipulate with your expectations, you +should work with it. `$dummy` is a dummy - a simple php object that tries to fulfil your +prophecy. + +### Stubs + +Ok, now we know how to create basic prophecies and reveal dummies from them. That's +awesome if we don't care about our _doubles_ (objects that reflect originals) +interactions. If we do, we need to use *stubs* or *mocks*. + +A stub is an object double, which doesn't have any expectations about the object behavior, +but when put in specific environment, behaves in specific way. Ok, I know, it's cryptic, +but bear with me for a minute. Simply put, a stub is a dummy, which depending on the called +method signature does different things (has logic). To create stubs in Prophecy: + +```php +$prophecy->read('123')->willReturn('value'); +``` + +Oh wow. We've just made an arbitrary call on the object prophecy? Yes, we did. And this +call returned us a new object instance of class `MethodProphecy`. Yep, that's a specific +method with arguments prophecy. Method prophecies give you the ability to create method +promises or predictions. We'll talk about method predictions later in the _Mocks_ section. + +#### Promises + +Promises are logical blocks, that represent your fictional methods in prophecy terms +and they are handled by the `MethodProphecy::will(PromiseInterface $promise)` method. +As a matter of fact, the call that we made earlier (`willReturn('value')`) is a simple +shortcut to: + +```php +$prophecy->read('123')->will(new Prophecy\Promise\ReturnPromise(array('value'))); +``` + +This promise will cause any call to our double's `read()` method with exactly one +argument - `'123'` to always return `'value'`. But that's only for this +promise, there's plenty others you can use: + +- `ReturnPromise` or `->willReturn(1)` - returns a value from a method call +- `ReturnArgumentPromise` or `->willReturnArgument($index)` - returns the nth method argument from call +- `ThrowPromise` or `->willThrow($exception)` - causes the method to throw specific exception +- `CallbackPromise` or `->will($callback)` - gives you a quick way to define your own custom logic + +Keep in mind, that you can always add even more promises by implementing +`Prophecy\Promise\PromiseInterface`. + +#### Method prophecies idempotency + +Prophecy enforces same method prophecies and, as a consequence, same promises and +predictions for the same method calls with the same arguments. This means: + +```php +$methodProphecy1 = $prophecy->read('123'); +$methodProphecy2 = $prophecy->read('123'); +$methodProphecy3 = $prophecy->read('321'); + +$methodProphecy1 === $methodProphecy2; +$methodProphecy1 !== $methodProphecy3; +``` + +That's interesting, right? Now you might ask me how would you define more complex +behaviors where some method call changes behavior of others. In PHPUnit or Mockery +you do that by predicting how many times your method will be called. In Prophecy, +you'll use promises for that: + +```php +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName('everzet')->will(function () { + $this->getName()->willReturn('everzet'); +}); + +// For PHP 5.3 +$user->setName('everzet')->will(function ($args, $user) { + $user->getName()->willReturn('everzet'); +}); + +// Or +$user->setName('everzet')->will(function ($args) use ($user) { + $user->getName()->willReturn('everzet'); +}); +``` + +And now it doesn't matter how many times or in which order your methods are called. +What matters is their behaviors and how well you faked it. + +#### Arguments wildcarding + +The previous example is awesome (at least I hope it is for you), but that's not +optimal enough. We hardcoded `'everzet'` in our expectation. Isn't there a better +way? In fact there is, but it involves understanding what this `'everzet'` +actually is. + +You see, even if method arguments used during method prophecy creation look +like simple method arguments, in reality they are not. They are argument token +wildcards. As a matter of fact, `->setName('everzet')` looks like a simple call just +because Prophecy automatically transforms it under the hood into: + +```php +$user->setName(new Prophecy\Argument\Token\ExactValueToken('everzet')); +``` + +Those argument tokens are simple PHP classes, that implement +`Prophecy\Argument\Token\TokenInterface` and tell Prophecy how to compare real arguments +with your expectations. And yes, those classnames are damn big. That's why there's a +shortcut class `Prophecy\Argument`, which you can use to create tokens like that: + +```php +use Prophecy\Argument; + +$user->setName(Argument::exact('everzet')); +``` + +`ExactValueToken` is not very useful in our case as it forced us to hardcode the username. +That's why Prophecy comes bundled with a bunch of other tokens: + +- `IdenticalValueToken` or `Argument::is($value)` - checks that the argument is identical to a specific value +- `ExactValueToken` or `Argument::exact($value)` - checks that the argument matches a specific value +- `TypeToken` or `Argument::type($typeOrClass)` - checks that the argument matches a specific type or + classname +- `ObjectStateToken` or `Argument::which($method, $value)` - checks that the argument method returns + a specific value +- `CallbackToken` or `Argument::that(callback)` - checks that the argument matches a custom callback +- `AnyValueToken` or `Argument::any()` - matches any argument +- `AnyValuesToken` or `Argument::cetera()` - matches any arguments to the rest of the signature +- `StringContainsToken` or `Argument::containingString($value)` - checks that the argument contains a specific string value + +And you can add even more by implementing `TokenInterface` with your own custom classes. + +So, let's refactor our initial `{set,get}Name()` logic with argument tokens: + +```php +use Prophecy\Argument; + +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName(Argument::type('string'))->will(function ($args) { + $this->getName()->willReturn($args[0]); +}); + +// For PHP 5.3 +$user->setName(Argument::type('string'))->will(function ($args, $user) { + $user->getName()->willReturn($args[0]); +}); + +// Or +$user->setName(Argument::type('string'))->will(function ($args) use ($user) { + $user->getName()->willReturn($args[0]); +}); +``` + +That's it. Now our `{set,get}Name()` prophecy will work with any string argument provided to it. +We've just described how our stub object should behave, even though the original object could have +no behavior whatsoever. + +One last bit about arguments now. You might ask, what happens in case of: + +```php +use Prophecy\Argument; + +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName(Argument::type('string'))->will(function ($args) { + $this->getName()->willReturn($args[0]); +}); + +// For PHP 5.3 +$user->setName(Argument::type('string'))->will(function ($args, $user) { + $user->getName()->willReturn($args[0]); +}); + +// Or +$user->setName(Argument::type('string'))->will(function ($args) use ($user) { + $user->getName()->willReturn($args[0]); +}); + +$user->setName(Argument::any())->will(function () { +}); +``` + +Nothing. Your stub will continue behaving the way it did before. That's because of how +arguments wildcarding works. Every argument token type has a different score level, which +wildcard then uses to calculate the final arguments match score and use the method prophecy +promise that has the highest score. In this case, `Argument::type()` in case of success +scores `5` and `Argument::any()` scores `3`. So the type token wins, as does the first +`setName()` method prophecy and its promise. The simple rule of thumb - more precise token +always wins. + +#### Getting stub objects + +Ok, now we know how to define our prophecy method promises, let's get our stub from +it: + +```php +$stub = $prophecy->reveal(); +``` + +As you might see, the only difference between how we get dummies and stubs is that with +stubs we describe every object conversation instead of just agreeing with `null` returns +(object being *dummy*). As a matter of fact, after you define your first promise +(method call), Prophecy will force you to define all the communications - it throws +the `UnexpectedCallException` for any call you didn't describe with object prophecy before +calling it on a stub. + +### Mocks + +Now we know how to define doubles without behavior (dummies) and doubles with behavior, but +no expectations (stubs). What's left is doubles for which we have some expectations. These +are called mocks and in Prophecy they look almost exactly the same as stubs, except that +they define *predictions* instead of *promises* on method prophecies: + +```php +$entityManager->flush()->shouldBeCalled(); +``` + +#### Predictions + +The `shouldBeCalled()` method here assigns `CallPrediction` to our method prophecy. +Predictions are a delayed behavior check for your prophecies. You see, during the entire lifetime +of your doubles, Prophecy records every single call you're making against it inside your +code. After that, Prophecy can use this collected information to check if it matches defined +predictions. You can assign predictions to method prophecies using the +`MethodProphecy::should(PredictionInterface $prediction)` method. As a matter of fact, +the `shouldBeCalled()` method we used earlier is just a shortcut to: + +```php +$entityManager->flush()->should(new Prophecy\Prediction\CallPrediction()); +``` + +It checks if your method of interest (that matches both the method name and the arguments wildcard) +was called 1 or more times. If the prediction failed then it throws an exception. When does this +check happen? Whenever you call `checkPredictions()` on the main Prophet object: + +```php +$prophet->checkPredictions(); +``` + +In PHPUnit, you would want to put this call into the `tearDown()` method. If no predictions +are defined, it would do nothing. So it won't harm to call it after every test. + +There are plenty more predictions you can play with: + +- `CallPrediction` or `shouldBeCalled()` - checks that the method has been called 1 or more times +- `NoCallsPrediction` or `shouldNotBeCalled()` - checks that the method has not been called +- `CallTimesPrediction` or `shouldBeCalledTimes($count)` - checks that the method has been called + `$count` times +- `CallbackPrediction` or `should($callback)` - checks the method against your own custom callback + +Of course, you can always create your own custom prediction any time by implementing +`PredictionInterface`. + +### Spies + +The last bit of awesomeness in Prophecy is out-of-the-box spies support. As I said in the previous +section, Prophecy records every call made during the double's entire lifetime. This means +you don't need to record predictions in order to check them. You can also do it +manually by using the `MethodProphecy::shouldHave(PredictionInterface $prediction)` method: + +```php +$em = $prophet->prophesize('Doctrine\ORM\EntityManager'); + +$controller->createUser($em->reveal()); + +$em->flush()->shouldHaveBeenCalled(); +``` + +Such manipulation with doubles is called spying. And with Prophecy it just works. diff --git a/vendor/phpspec/prophecy/composer.json b/vendor/phpspec/prophecy/composer.json new file mode 100644 index 0000000..13b6658 --- /dev/null +++ b/vendor/phpspec/prophecy/composer.json @@ -0,0 +1,50 @@ +{ + "name": "phpspec/prophecy", + "description": "Highly opinionated mocking framework for PHP 5.3+", + "keywords": ["Mock", "Stub", "Dummy", "Double", "Fake", "Spy"], + "homepage": "https://github.com/phpspec/prophecy", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + + "require": { + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "doctrine/instantiator": "^1.0.2", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + + "autoload-dev": { + "psr-4": { + "Fixtures\\Prophecy\\": "fixtures" + } + }, + + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument.php b/vendor/phpspec/prophecy/src/Prophecy/Argument.php new file mode 100644 index 0000000..fde6aa9 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument.php @@ -0,0 +1,212 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy; + +use Prophecy\Argument\Token; + +/** + * Argument tokens shortcuts. + * + * @author Konstantin Kudryashov + */ +class Argument +{ + /** + * Checks that argument is exact value or object. + * + * @param mixed $value + * + * @return Token\ExactValueToken + */ + public static function exact($value) + { + return new Token\ExactValueToken($value); + } + + /** + * Checks that argument is of specific type or instance of specific class. + * + * @param string $type Type name (`integer`, `string`) or full class name + * + * @return Token\TypeToken + */ + public static function type($type) + { + return new Token\TypeToken($type); + } + + /** + * Checks that argument object has specific state. + * + * @param string $methodName + * @param mixed $value + * + * @return Token\ObjectStateToken + */ + public static function which($methodName, $value) + { + return new Token\ObjectStateToken($methodName, $value); + } + + /** + * Checks that argument matches provided callback. + * + * @param callable $callback + * + * @return Token\CallbackToken + */ + public static function that($callback) + { + return new Token\CallbackToken($callback); + } + + /** + * Matches any single value. + * + * @return Token\AnyValueToken + */ + public static function any() + { + return new Token\AnyValueToken; + } + + /** + * Matches all values to the rest of the signature. + * + * @return Token\AnyValuesToken + */ + public static function cetera() + { + return new Token\AnyValuesToken; + } + + /** + * Checks that argument matches all tokens + * + * @param mixed ... a list of tokens + * + * @return Token\LogicalAndToken + */ + public static function allOf() + { + return new Token\LogicalAndToken(func_get_args()); + } + + /** + * Checks that argument array or countable object has exact number of elements. + * + * @param integer $value array elements count + * + * @return Token\ArrayCountToken + */ + public static function size($value) + { + return new Token\ArrayCountToken($value); + } + + /** + * Checks that argument array contains (key, value) pair + * + * @param mixed $key exact value or token + * @param mixed $value exact value or token + * + * @return Token\ArrayEntryToken + */ + public static function withEntry($key, $value) + { + return new Token\ArrayEntryToken($key, $value); + } + + /** + * Checks that arguments array entries all match value + * + * @param mixed $value + * + * @return Token\ArrayEveryEntryToken + */ + public static function withEveryEntry($value) + { + return new Token\ArrayEveryEntryToken($value); + } + + /** + * Checks that argument array contains value + * + * @param mixed $value + * + * @return Token\ArrayEntryToken + */ + public static function containing($value) + { + return new Token\ArrayEntryToken(self::any(), $value); + } + + /** + * Checks that argument array has key + * + * @param mixed $key exact value or token + * + * @return Token\ArrayEntryToken + */ + public static function withKey($key) + { + return new Token\ArrayEntryToken($key, self::any()); + } + + /** + * Checks that argument does not match the value|token. + * + * @param mixed $value either exact value or argument token + * + * @return Token\LogicalNotToken + */ + public static function not($value) + { + return new Token\LogicalNotToken($value); + } + + /** + * @param string $value + * + * @return Token\StringContainsToken + */ + public static function containingString($value) + { + return new Token\StringContainsToken($value); + } + + /** + * Checks that argument is identical value. + * + * @param mixed $value + * + * @return Token\IdenticalValueToken + */ + public static function is($value) + { + return new Token\IdenticalValueToken($value); + } + + /** + * Check that argument is same value when rounding to the + * given precision. + * + * @param float $value + * @param float $precision + * + * @return Token\ApproximateValueToken + */ + public static function approximate($value, $precision = 0) + { + return new Token\ApproximateValueToken($value, $precision); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php new file mode 100644 index 0000000..a088f21 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php @@ -0,0 +1,101 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument; + +/** + * Arguments wildcarding. + * + * @author Konstantin Kudryashov + */ +class ArgumentsWildcard +{ + /** + * @var Token\TokenInterface[] + */ + private $tokens = array(); + private $string; + + /** + * Initializes wildcard. + * + * @param array $arguments Array of argument tokens or values + */ + public function __construct(array $arguments) + { + foreach ($arguments as $argument) { + if (!$argument instanceof Token\TokenInterface) { + $argument = new Token\ExactValueToken($argument); + } + + $this->tokens[] = $argument; + } + } + + /** + * Calculates wildcard match score for provided arguments. + * + * @param array $arguments + * + * @return false|int False OR integer score (higher - better) + */ + public function scoreArguments(array $arguments) + { + if (0 == count($arguments) && 0 == count($this->tokens)) { + return 1; + } + + $arguments = array_values($arguments); + $totalScore = 0; + foreach ($this->tokens as $i => $token) { + $argument = isset($arguments[$i]) ? $arguments[$i] : null; + if (1 >= $score = $token->scoreArgument($argument)) { + return false; + } + + $totalScore += $score; + + if (true === $token->isLast()) { + return $totalScore; + } + } + + if (count($arguments) > count($this->tokens)) { + return false; + } + + return $totalScore; + } + + /** + * Returns string representation for wildcard. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = implode(', ', array_map(function ($token) { + return (string) $token; + }, $this->tokens)); + } + + return $this->string; + } + + /** + * @return array + */ + public function getTokens() + { + return $this->tokens; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php new file mode 100644 index 0000000..5098811 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Any single value token. + * + * @author Konstantin Kudryashov + */ +class AnyValueToken implements TokenInterface +{ + /** + * Always scores 3 for any argument. + * + * @param $argument + * + * @return int + */ + public function scoreArgument($argument) + { + return 3; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return '*'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php new file mode 100644 index 0000000..f76b17b --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Any values token. + * + * @author Konstantin Kudryashov + */ +class AnyValuesToken implements TokenInterface +{ + /** + * Always scores 2 for any argument. + * + * @param $argument + * + * @return int + */ + public function scoreArgument($argument) + { + return 2; + } + + /** + * Returns true to stop wildcard from processing other tokens. + * + * @return bool + */ + public function isLast() + { + return true; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return '* [, ...]'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php new file mode 100644 index 0000000..d4918b1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php @@ -0,0 +1,55 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Approximate value token + * + * @author Daniel Leech + */ +class ApproximateValueToken implements TokenInterface +{ + private $value; + private $precision; + + public function __construct($value, $precision = 0) + { + $this->value = $value; + $this->precision = $precision; + } + + /** + * {@inheritdoc} + */ + public function scoreArgument($argument) + { + return round($argument, $this->precision) === round($this->value, $this->precision) ? 10 : false; + } + + /** + * {@inheritdoc} + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('≅%s', round($this->value, $this->precision)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php new file mode 100644 index 0000000..96b4bef --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php @@ -0,0 +1,86 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Array elements count token. + * + * @author Boris Mikhaylov + */ + +class ArrayCountToken implements TokenInterface +{ + private $count; + + /** + * @param integer $value + */ + public function __construct($value) + { + $this->count = $value; + } + + /** + * Scores 6 when argument has preset number of elements. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return $this->isCountable($argument) && $this->hasProperCount($argument) ? 6 : false; + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('count(%s)', $this->count); + } + + /** + * Returns true if object is either array or instance of \Countable + * + * @param $argument + * @return bool + */ + private function isCountable($argument) + { + return (is_array($argument) || $argument instanceof \Countable); + } + + /** + * Returns true if $argument has expected number of elements + * + * @param array|\Countable $argument + * + * @return bool + */ + private function hasProperCount($argument) + { + return $this->count === count($argument); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php new file mode 100644 index 0000000..0305fc7 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php @@ -0,0 +1,143 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Array entry token. + * + * @author Boris Mikhaylov + */ +class ArrayEntryToken implements TokenInterface +{ + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $key; + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $value; + + /** + * @param mixed $key exact value or token + * @param mixed $value exact value or token + */ + public function __construct($key, $value) + { + $this->key = $this->wrapIntoExactValueToken($key); + $this->value = $this->wrapIntoExactValueToken($value); + } + + /** + * Scores half of combined scores from key and value tokens for same entry. Capped at 8. + * If argument implements \ArrayAccess without \Traversable, then key token is restricted to ExactValueToken. + * + * @param array|\ArrayAccess|\Traversable $argument + * + * @throws \Prophecy\Exception\InvalidArgumentException + * @return bool|int + */ + public function scoreArgument($argument) + { + if ($argument instanceof \Traversable) { + $argument = iterator_to_array($argument); + } + + if ($argument instanceof \ArrayAccess) { + $argument = $this->convertArrayAccessToEntry($argument); + } + + if (!is_array($argument) || empty($argument)) { + return false; + } + + $keyScores = array_map(array($this->key,'scoreArgument'), array_keys($argument)); + $valueScores = array_map(array($this->value,'scoreArgument'), $argument); + $scoreEntry = function ($value, $key) { + return $value && $key ? min(8, ($key + $value) / 2) : false; + }; + + return max(array_map($scoreEntry, $valueScores, $keyScores)); + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('[..., %s => %s, ...]', $this->key, $this->value); + } + + /** + * Returns key + * + * @return TokenInterface + */ + public function getKey() + { + return $this->key; + } + + /** + * Returns value + * + * @return TokenInterface + */ + public function getValue() + { + return $this->value; + } + + /** + * Wraps non token $value into ExactValueToken + * + * @param $value + * @return TokenInterface + */ + private function wrapIntoExactValueToken($value) + { + return $value instanceof TokenInterface ? $value : new ExactValueToken($value); + } + + /** + * Converts instance of \ArrayAccess to key => value array entry + * + * @param \ArrayAccess $object + * + * @return array|null + * @throws \Prophecy\Exception\InvalidArgumentException + */ + private function convertArrayAccessToEntry(\ArrayAccess $object) + { + if (!$this->key instanceof ExactValueToken) { + throw new InvalidArgumentException(sprintf( + 'You can only use exact value tokens to match key of ArrayAccess object'.PHP_EOL. + 'But you used `%s`.', + $this->key + )); + } + + $key = $this->key->getValue(); + + return $object->offsetExists($key) ? array($key => $object[$key]) : array(); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php new file mode 100644 index 0000000..5d41fa4 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php @@ -0,0 +1,82 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Array every entry token. + * + * @author Adrien Brault + */ +class ArrayEveryEntryToken implements TokenInterface +{ + /** + * @var TokenInterface + */ + private $value; + + /** + * @param mixed $value exact value or token + */ + public function __construct($value) + { + if (!$value instanceof TokenInterface) { + $value = new ExactValueToken($value); + } + + $this->value = $value; + } + + /** + * {@inheritdoc} + */ + public function scoreArgument($argument) + { + if (!$argument instanceof \Traversable && !is_array($argument)) { + return false; + } + + $scores = array(); + foreach ($argument as $key => $argumentEntry) { + $scores[] = $this->value->scoreArgument($argumentEntry); + } + + if (empty($scores) || in_array(false, $scores, true)) { + return false; + } + + return array_sum($scores) / count($scores); + } + + /** + * {@inheritdoc} + */ + public function isLast() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('[%s, ..., %s]', $this->value, $this->value); + } + + /** + * @return TokenInterface + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php new file mode 100644 index 0000000..f45ba20 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php @@ -0,0 +1,75 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Callback-verified token. + * + * @author Konstantin Kudryashov + */ +class CallbackToken implements TokenInterface +{ + private $callback; + + /** + * Initializes token. + * + * @param callable $callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackToken, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Scores 7 if callback returns true, false otherwise. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return call_user_func($this->callback, $argument) ? 7 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return 'callback()'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php new file mode 100644 index 0000000..aa960f3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php @@ -0,0 +1,116 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Util\StringUtil; + +/** + * Exact value token. + * + * @author Konstantin Kudryashov + */ +class ExactValueToken implements TokenInterface +{ + private $value; + private $string; + private $util; + private $comparatorFactory; + + /** + * Initializes token. + * + * @param mixed $value + * @param StringUtil $util + * @param ComparatorFactory $comparatorFactory + */ + public function __construct($value, StringUtil $util = null, ComparatorFactory $comparatorFactory = null) + { + $this->value = $value; + $this->util = $util ?: new StringUtil(); + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Scores 10 if argument matches preset value. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (is_object($argument) && is_object($this->value)) { + $comparator = $this->comparatorFactory->getComparatorFor( + $argument, $this->value + ); + + try { + $comparator->assertEquals($argument, $this->value); + return 10; + } catch (ComparisonFailure $failure) {} + } + + // If either one is an object it should be castable to a string + if (is_object($argument) xor is_object($this->value)) { + if (is_object($argument) && !method_exists($argument, '__toString')) { + return false; + } + + if (is_object($this->value) && !method_exists($this->value, '__toString')) { + return false; + } + } elseif (is_numeric($argument) && is_numeric($this->value)) { + // noop + } elseif (gettype($argument) !== gettype($this->value)) { + return false; + } + + return $argument == $this->value ? 10 : false; + } + + /** + * Returns preset value against which token checks arguments. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = sprintf('exact(%s)', $this->util->stringify($this->value)); + } + + return $this->string; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php new file mode 100644 index 0000000..0b6d23a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php @@ -0,0 +1,74 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Util\StringUtil; + +/** + * Identical value token. + * + * @author Florian Voutzinos + */ +class IdenticalValueToken implements TokenInterface +{ + private $value; + private $string; + private $util; + + /** + * Initializes token. + * + * @param mixed $value + * @param StringUtil $util + */ + public function __construct($value, StringUtil $util = null) + { + $this->value = $value; + $this->util = $util ?: new StringUtil(); + } + + /** + * Scores 11 if argument matches preset value. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return $argument === $this->value ? 11 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = sprintf('identical(%s)', $this->util->stringify($this->value)); + } + + return $this->string; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php new file mode 100644 index 0000000..4ee1b25 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php @@ -0,0 +1,80 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Logical AND token. + * + * @author Boris Mikhaylov + */ +class LogicalAndToken implements TokenInterface +{ + private $tokens = array(); + + /** + * @param array $arguments exact values or tokens + */ + public function __construct(array $arguments) + { + foreach ($arguments as $argument) { + if (!$argument instanceof TokenInterface) { + $argument = new ExactValueToken($argument); + } + $this->tokens[] = $argument; + } + } + + /** + * Scores maximum score from scores returned by tokens for this argument if all of them score. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (0 === count($this->tokens)) { + return false; + } + + $maxScore = 0; + foreach ($this->tokens as $token) { + $score = $token->scoreArgument($argument); + if (false === $score) { + return false; + } + $maxScore = max($score, $maxScore); + } + + return $maxScore; + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('bool(%s)', implode(' AND ', $this->tokens)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php new file mode 100644 index 0000000..623efa5 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php @@ -0,0 +1,73 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Logical NOT token. + * + * @author Boris Mikhaylov + */ +class LogicalNotToken implements TokenInterface +{ + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $token; + + /** + * @param mixed $value exact value or token + */ + public function __construct($value) + { + $this->token = $value instanceof TokenInterface? $value : new ExactValueToken($value); + } + + /** + * Scores 4 when preset token does not match the argument. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return false === $this->token->scoreArgument($argument) ? 4 : false; + } + + /** + * Returns true if preset token is last. + * + * @return bool|int + */ + public function isLast() + { + return $this->token->isLast(); + } + + /** + * Returns originating token. + * + * @return TokenInterface + */ + public function getOriginatingToken() + { + return $this->token; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('not(%s)', $this->token); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php new file mode 100644 index 0000000..d771077 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php @@ -0,0 +1,104 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Util\StringUtil; + +/** + * Object state-checker token. + * + * @author Konstantin Kudryashov + */ +class ObjectStateToken implements TokenInterface +{ + private $name; + private $value; + private $util; + private $comparatorFactory; + + /** + * Initializes token. + * + * @param string $methodName + * @param mixed $value Expected return value + * @param null|StringUtil $util + * @param ComparatorFactory $comparatorFactory + */ + public function __construct( + $methodName, + $value, + StringUtil $util = null, + ComparatorFactory $comparatorFactory = null + ) { + $this->name = $methodName; + $this->value = $value; + $this->util = $util ?: new StringUtil; + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Scores 8 if argument is an object, which method returns expected value. + * + * @param mixed $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (is_object($argument) && method_exists($argument, $this->name)) { + $actual = call_user_func(array($argument, $this->name)); + + $comparator = $this->comparatorFactory->getComparatorFor( + $this->value, $actual + ); + + try { + $comparator->assertEquals($this->value, $actual); + return 8; + } catch (ComparisonFailure $failure) { + return false; + } + } + + if (is_object($argument) && property_exists($argument, $this->name)) { + return $argument->{$this->name} === $this->value ? 8 : false; + } + + return false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('state(%s(), %s)', + $this->name, + $this->util->stringify($this->value) + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php new file mode 100644 index 0000000..bd8d423 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php @@ -0,0 +1,67 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * String contains token. + * + * @author Peter Mitchell + */ +class StringContainsToken implements TokenInterface +{ + private $value; + + /** + * Initializes token. + * + * @param string $value + */ + public function __construct($value) + { + $this->value = $value; + } + + public function scoreArgument($argument) + { + return is_string($argument) && strpos($argument, $this->value) !== false ? 6 : false; + } + + /** + * Returns preset value against which token checks arguments. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('contains("%s")', $this->value); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php new file mode 100644 index 0000000..625d3ba --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php @@ -0,0 +1,43 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Argument token interface. + * + * @author Konstantin Kudryashov + */ +interface TokenInterface +{ + /** + * Calculates token match score for provided argument. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument); + + /** + * Returns true if this token prevents check of other tokens (is last one). + * + * @return bool|int + */ + public function isLast(); + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php new file mode 100644 index 0000000..cb65132 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php @@ -0,0 +1,76 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Value type token. + * + * @author Konstantin Kudryashov + */ +class TypeToken implements TokenInterface +{ + private $type; + + /** + * @param string $type + */ + public function __construct($type) + { + $checker = "is_{$type}"; + if (!function_exists($checker) && !interface_exists($type) && !class_exists($type)) { + throw new InvalidArgumentException(sprintf( + 'Type or class name expected as an argument to TypeToken, but got %s.', $type + )); + } + + $this->type = $type; + } + + /** + * Scores 5 if argument has the same type this token was constructed with. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + $checker = "is_{$this->type}"; + if (function_exists($checker)) { + return call_user_func($checker, $argument) ? 5 : false; + } + + return $argument instanceof $this->type ? 5 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('type(%s)', $this->type); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php b/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php new file mode 100644 index 0000000..2652235 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php @@ -0,0 +1,162 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Call; + +use Exception; +use Prophecy\Argument\ArgumentsWildcard; + +/** + * Call object. + * + * @author Konstantin Kudryashov + */ +class Call +{ + private $methodName; + private $arguments; + private $returnValue; + private $exception; + private $file; + private $line; + private $scores; + + /** + * Initializes call. + * + * @param string $methodName + * @param array $arguments + * @param mixed $returnValue + * @param Exception $exception + * @param null|string $file + * @param null|int $line + */ + public function __construct($methodName, array $arguments, $returnValue, + Exception $exception = null, $file, $line) + { + $this->methodName = $methodName; + $this->arguments = $arguments; + $this->returnValue = $returnValue; + $this->exception = $exception; + $this->scores = new \SplObjectStorage(); + + if ($file) { + $this->file = $file; + $this->line = intval($line); + } + } + + /** + * Returns called method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * Returns called method arguments. + * + * @return array + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Returns called method return value. + * + * @return null|mixed + */ + public function getReturnValue() + { + return $this->returnValue; + } + + /** + * Returns exception that call thrown. + * + * @return null|Exception + */ + public function getException() + { + return $this->exception; + } + + /** + * Returns callee filename. + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Returns callee line number. + * + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * Returns short notation for callee place. + * + * @return string + */ + public function getCallPlace() + { + if (null === $this->file) { + return 'unknown'; + } + + return sprintf('%s:%d', $this->file, $this->line); + } + + /** + * Adds the wildcard match score for the provided wildcard. + * + * @param ArgumentsWildcard $wildcard + * @param false|int $score + * + * @return $this + */ + public function addScore(ArgumentsWildcard $wildcard, $score) + { + $this->scores[$wildcard] = $score; + + return $this; + } + + /** + * Returns wildcard match score for the provided wildcard. The score is + * calculated if not already done. + * + * @param ArgumentsWildcard $wildcard + * + * @return false|int False OR integer score (higher - better) + */ + public function getScore(ArgumentsWildcard $wildcard) + { + if (isset($this->scores[$wildcard])) { + return $this->scores[$wildcard]; + } + + return $this->scores[$wildcard] = $wildcard->scoreArguments($this->getArguments()); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php b/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php new file mode 100644 index 0000000..bc936c8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php @@ -0,0 +1,229 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Call; + +use Prophecy\Exception\Prophecy\MethodProphecyException; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Call\UnexpectedCallException; + +/** + * Calls receiver & manager. + * + * @author Konstantin Kudryashov + */ +class CallCenter +{ + private $util; + + /** + * @var Call[] + */ + private $recordedCalls = array(); + + /** + * Initializes call center. + * + * @param StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Makes and records specific method call for object prophecy. + * + * @param ObjectProphecy $prophecy + * @param string $methodName + * @param array $arguments + * + * @return mixed Returns null if no promise for prophecy found or promise return value. + * + * @throws \Prophecy\Exception\Call\UnexpectedCallException If no appropriate method prophecy found + */ + public function makeCall(ObjectProphecy $prophecy, $methodName, array $arguments) + { + // For efficiency exclude 'args' from the generated backtrace + if (PHP_VERSION_ID >= 50400) { + // Limit backtrace to last 3 calls as we don't use the rest + // Limit argument was introduced in PHP 5.4.0 + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + } elseif (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) { + // DEBUG_BACKTRACE_IGNORE_ARGS was introduced in PHP 5.3.6 + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + } else { + $backtrace = debug_backtrace(); + } + + $file = $line = null; + if (isset($backtrace[2]) && isset($backtrace[2]['file'])) { + $file = $backtrace[2]['file']; + $line = $backtrace[2]['line']; + } + + // If no method prophecies defined, then it's a dummy, so we'll just return null + if ('__destruct' === $methodName || 0 == count($prophecy->getMethodProphecies())) { + $this->recordedCalls[] = new Call($methodName, $arguments, null, null, $file, $line); + + return null; + } + + // There are method prophecies, so it's a fake/stub. Searching prophecy for this call + $matches = array(); + foreach ($prophecy->getMethodProphecies($methodName) as $methodProphecy) { + if (0 < $score = $methodProphecy->getArgumentsWildcard()->scoreArguments($arguments)) { + $matches[] = array($score, $methodProphecy); + } + } + + // If fake/stub doesn't have method prophecy for this call - throw exception + if (!count($matches)) { + throw $this->createUnexpectedCallException($prophecy, $methodName, $arguments); + } + + // Sort matches by their score value + @usort($matches, function ($match1, $match2) { return $match2[0] - $match1[0]; }); + + $score = $matches[0][0]; + // If Highest rated method prophecy has a promise - execute it or return null instead + $methodProphecy = $matches[0][1]; + $returnValue = null; + $exception = null; + if ($promise = $methodProphecy->getPromise()) { + try { + $returnValue = $promise->execute($arguments, $prophecy, $methodProphecy); + } catch (\Exception $e) { + $exception = $e; + } + } + + if ($methodProphecy->hasReturnVoid() && $returnValue !== null) { + throw new MethodProphecyException( + "The method \"$methodName\" has a void return type, but the promise returned a value", + $methodProphecy + ); + } + + $this->recordedCalls[] = $call = new Call( + $methodName, $arguments, $returnValue, $exception, $file, $line + ); + $call->addScore($methodProphecy->getArgumentsWildcard(), $score); + + if (null !== $exception) { + throw $exception; + } + + return $returnValue; + } + + /** + * Searches for calls by method name & arguments wildcard. + * + * @param string $methodName + * @param ArgumentsWildcard $wildcard + * + * @return Call[] + */ + public function findCalls($methodName, ArgumentsWildcard $wildcard) + { + return array_values( + array_filter($this->recordedCalls, function (Call $call) use ($methodName, $wildcard) { + return $methodName === $call->getMethodName() + && 0 < $call->getScore($wildcard) + ; + }) + ); + } + + private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, + array $arguments) + { + $classname = get_class($prophecy->reveal()); + $indentationLength = 8; // looks good + $argstring = implode( + ",\n", + $this->indentArguments( + array_map(array($this->util, 'stringify'), $arguments), + $indentationLength + ) + ); + + $expected = array(); + + foreach (call_user_func_array('array_merge', $prophecy->getMethodProphecies()) as $methodProphecy) { + $expected[] = sprintf( + " - %s(\n" . + "%s\n" . + " )", + $methodProphecy->getMethodName(), + implode( + ",\n", + $this->indentArguments( + array_map('strval', $methodProphecy->getArgumentsWildcard()->getTokens()), + $indentationLength + ) + ) + ); + } + + return new UnexpectedCallException( + sprintf( + "Unexpected method call on %s:\n". + " - %s(\n". + "%s\n". + " )\n". + "expected calls were:\n". + "%s", + + $classname, $methodName, $argstring, implode("\n", $expected) + ), + $prophecy, $methodName, $arguments + + ); + } + + private function formatExceptionMessage(MethodProphecy $methodProphecy) + { + return sprintf( + " - %s(\n". + "%s\n". + " )", + $methodProphecy->getMethodName(), + implode( + ",\n", + $this->indentArguments( + array_map( + function ($token) { + return (string) $token; + }, + $methodProphecy->getArgumentsWildcard()->getTokens() + ), + $indentationLength + ) + ) + ); + } + + private function indentArguments(array $arguments, $indentationLength) + { + return preg_replace_callback( + '/^/m', + function () use ($indentationLength) { + return str_repeat(' ', $indentationLength); + }, + $arguments + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php new file mode 100644 index 0000000..874e474 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php @@ -0,0 +1,42 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use SebastianBergmann\Comparator\Comparator; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Closure comparator. + * + * @author Konstantin Kudryashov + */ +final class ClosureComparator extends Comparator +{ + public function accepts($expected, $actual) + { + return is_object($expected) && $expected instanceof \Closure + && is_object($actual) && $actual instanceof \Closure; + } + + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false) + { + throw new ComparisonFailure( + $expected, + $actual, + // we don't need a diff + '', + '', + false, + 'all closures are born different' + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php new file mode 100644 index 0000000..2070db1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php @@ -0,0 +1,47 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use SebastianBergmann\Comparator\Factory as BaseFactory; + +/** + * Prophecy comparator factory. + * + * @author Konstantin Kudryashov + */ +final class Factory extends BaseFactory +{ + /** + * @var Factory + */ + private static $instance; + + public function __construct() + { + parent::__construct(); + + $this->register(new ClosureComparator()); + $this->register(new ProphecyComparator()); + } + + /** + * @return Factory + */ + public static function getInstance() + { + if (self::$instance === null) { + self::$instance = new Factory; + } + + return self::$instance; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php new file mode 100644 index 0000000..298a8e3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php @@ -0,0 +1,28 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use Prophecy\Prophecy\ProphecyInterface; +use SebastianBergmann\Comparator\ObjectComparator; + +class ProphecyComparator extends ObjectComparator +{ + public function accepts($expected, $actual) + { + return is_object($expected) && is_object($actual) && $actual instanceof ProphecyInterface; + } + + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array()) + { + parent::assertEquals($expected, $actual->reveal(), $delta, $canonicalize, $ignoreCase, $processed); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php new file mode 100644 index 0000000..d6b6b1a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php @@ -0,0 +1,68 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use ReflectionClass; + +/** + * Cached class doubler. + * Prevents mirroring/creation of the same structure twice. + * + * @author Konstantin Kudryashov + */ +class CachedDoubler extends Doubler +{ + private $classes = array(); + + /** + * {@inheritdoc} + */ + public function registerClassPatch(ClassPatch\ClassPatchInterface $patch) + { + $this->classes[] = array(); + + parent::registerClassPatch($patch); + } + + /** + * {@inheritdoc} + */ + protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + { + $classId = $this->generateClassId($class, $interfaces); + if (isset($this->classes[$classId])) { + return $this->classes[$classId]; + } + + return $this->classes[$classId] = parent::createDoubleClass($class, $interfaces); + } + + /** + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + private function generateClassId(ReflectionClass $class = null, array $interfaces) + { + $parts = array(); + if (null !== $class) { + $parts[] = $class->getName(); + } + foreach ($interfaces as $interface) { + $parts[] = $interface->getName(); + } + sort($parts); + + return md5(implode('', $parts)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php new file mode 100644 index 0000000..d6d1968 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php @@ -0,0 +1,48 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Class patch interface. + * Class patches extend doubles functionality or help + * Prophecy to avoid some internal PHP bugs. + * + * @author Konstantin Kudryashov + */ +interface ClassPatchInterface +{ + /** + * Checks if patch supports specific class node. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node); + + /** + * Applies patch to the specific class node. + * + * @param ClassNode $node + * @return void + */ + public function apply(ClassNode $node); + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php new file mode 100644 index 0000000..9d84309 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php @@ -0,0 +1,76 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * Disable constructor. + * Makes all constructor arguments optional. + * + * @author Konstantin Kudryashov + */ +class DisableConstructorPatch implements ClassPatchInterface +{ + /** + * Checks if class has `__construct` method. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Makes all class constructor arguments optional. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + if (!$node->isExtendable('__construct')) { + return; + } + + if (!$node->hasMethod('__construct')) { + $node->addMethod(new MethodNode('__construct', '')); + + return; + } + + $constructor = $node->getMethod('__construct'); + foreach ($constructor->getArguments() as $argument) { + $argument->setDefault(null); + } + + $constructor->setCode(<< + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Exception patch for HHVM to remove the stubs from special methods + * + * @author Christophe Coevoet + */ +class HhvmExceptionPatch implements ClassPatchInterface +{ + /** + * Supports exceptions on HHVM. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (!defined('HHVM_VERSION')) { + return false; + } + + return 'Exception' === $node->getParentClass() || is_subclass_of($node->getParentClass(), 'Exception'); + } + + /** + * Removes special exception static methods from the doubled methods. + * + * @param ClassNode $node + * + * @return void + */ + public function apply(ClassNode $node) + { + if ($node->hasMethod('setTraceOptions')) { + $node->getMethod('setTraceOptions')->useParentCode(); + } + if ($node->hasMethod('getTraceOptions')) { + $node->getMethod('getTraceOptions')->useParentCode(); + } + } + + /** + * {@inheritdoc} + */ + public function getPriority() + { + return -50; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php new file mode 100644 index 0000000..41ea2fc --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php @@ -0,0 +1,140 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Remove method functionality from the double which will clash with php keywords. + * + * @author Milan Magudia + */ +class KeywordPatch implements ClassPatchInterface +{ + /** + * Support any class + * + * @param ClassNode $node + * + * @return boolean + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Remove methods that clash with php keywords + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $methodNames = array_keys($node->getMethods()); + $methodsToRemove = array_intersect($methodNames, $this->getKeywords()); + foreach ($methodsToRemove as $methodName) { + $node->removeMethod($methodName); + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 49; + } + + /** + * Returns array of php keywords. + * + * @return array + */ + private function getKeywords() + { + if (\PHP_VERSION_ID >= 70000) { + return array('__halt_compiler'); + } + + return array( + '__halt_compiler', + 'abstract', + 'and', + 'array', + 'as', + 'break', + 'callable', + 'case', + 'catch', + 'class', + 'clone', + 'const', + 'continue', + 'declare', + 'default', + 'die', + 'do', + 'echo', + 'else', + 'elseif', + 'empty', + 'enddeclare', + 'endfor', + 'endforeach', + 'endif', + 'endswitch', + 'endwhile', + 'eval', + 'exit', + 'extends', + 'final', + 'finally', + 'for', + 'foreach', + 'function', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'isset', + 'list', + 'namespace', + 'new', + 'or', + 'print', + 'private', + 'protected', + 'public', + 'require', + 'require_once', + 'return', + 'static', + 'switch', + 'throw', + 'trait', + 'try', + 'unset', + 'use', + 'var', + 'while', + 'xor', + 'yield', + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php new file mode 100644 index 0000000..9ff49cd --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -0,0 +1,94 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; +use Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever; +use Prophecy\PhpDocumentor\MethodTagRetrieverInterface; + +/** + * Discover Magical API using "@method" PHPDoc format. + * + * @author Thomas Tourlourat + * @author Kévin Dunglas + * @author Théo FIDRY + */ +class MagicCallPatch implements ClassPatchInterface +{ + private $tagRetriever; + + public function __construct(MethodTagRetrieverInterface $tagRetriever = null) + { + $this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever; + } + + /** + * Support any class + * + * @param ClassNode $node + * + * @return boolean + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Discover Magical API + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $types = array_filter($node->getInterfaces(), function ($interface) { + return 0 !== strpos($interface, 'Prophecy\\'); + }); + $types[] = $node->getParentClass(); + + foreach ($types as $type) { + $reflectionClass = new \ReflectionClass($type); + + while ($reflectionClass) { + $tagList = $this->tagRetriever->getTagList($reflectionClass); + + foreach ($tagList as $tag) { + $methodName = $tag->getMethodName(); + + if (empty($methodName)) { + continue; + } + + if (!$reflectionClass->hasMethod($methodName)) { + $methodNode = new MethodNode($methodName); + $methodNode->setStatic($tag->isStatic()); + $node->addMethod($methodNode); + } + } + + $reflectionClass = $reflectionClass->getParentClass(); + } + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return integer Priority number (higher - earlier) + */ + public function getPriority() + { + return 50; + } +} + diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php new file mode 100644 index 0000000..081dea8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php @@ -0,0 +1,104 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; +use Prophecy\Doubler\Generator\Node\ArgumentNode; + +/** + * Add Prophecy functionality to the double. + * This is a core class patch for Prophecy. + * + * @author Konstantin Kudryashov + */ +class ProphecySubjectPatch implements ClassPatchInterface +{ + /** + * Always returns true. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Apply Prophecy functionality to class node. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $node->addInterface('Prophecy\Prophecy\ProphecySubjectInterface'); + $node->addProperty('objectProphecy', 'private'); + + foreach ($node->getMethods() as $name => $method) { + if ('__construct' === strtolower($name)) { + continue; + } + + if ($method->getReturnType() === 'void') { + $method->setCode( + '$this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());' + ); + } else { + $method->setCode( + 'return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());' + ); + } + } + + $prophecySetter = new MethodNode('setProphecy'); + $prophecyArgument = new ArgumentNode('prophecy'); + $prophecyArgument->setTypeHint('Prophecy\Prophecy\ProphecyInterface'); + $prophecySetter->addArgument($prophecyArgument); + $prophecySetter->setCode('$this->objectProphecy = $prophecy;'); + + $prophecyGetter = new MethodNode('getProphecy'); + $prophecyGetter->setCode('return $this->objectProphecy;'); + + if ($node->hasMethod('__call')) { + $__call = $node->getMethod('__call'); + } else { + $__call = new MethodNode('__call'); + $__call->addArgument(new ArgumentNode('name')); + $__call->addArgument(new ArgumentNode('arguments')); + + $node->addMethod($__call, true); + } + + $__call->setCode(<<getProphecy(), func_get_arg(0) +); +PHP + ); + + $node->addMethod($prophecySetter, true); + $node->addMethod($prophecyGetter, true); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 0; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php new file mode 100644 index 0000000..9166aee --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php @@ -0,0 +1,57 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * ReflectionClass::newInstance patch. + * Makes first argument of newInstance optional, since it works but signature is misleading + * + * @author Florian Klein + */ +class ReflectionClassNewInstancePatch implements ClassPatchInterface +{ + /** + * Supports ReflectionClass + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return 'ReflectionClass' === $node->getParentClass(); + } + + /** + * Updates newInstance's first argument to make it optional + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + foreach ($node->getMethod('newInstance')->getArguments() as $argument) { + $argument->setDefault(null); + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher = earlier) + */ + public function getPriority() + { + return 50; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php new file mode 100644 index 0000000..ceee94a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php @@ -0,0 +1,123 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * SplFileInfo patch. + * Makes SplFileInfo and derivative classes usable with Prophecy. + * + * @author Konstantin Kudryashov + */ +class SplFileInfoPatch implements ClassPatchInterface +{ + /** + * Supports everything that extends SplFileInfo. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (null === $node->getParentClass()) { + return false; + } + return 'SplFileInfo' === $node->getParentClass() + || is_subclass_of($node->getParentClass(), 'SplFileInfo') + ; + } + + /** + * Updated constructor code to call parent one with dummy file argument. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + if ($node->hasMethod('__construct')) { + $constructor = $node->getMethod('__construct'); + } else { + $constructor = new MethodNode('__construct'); + $node->addMethod($constructor); + } + + if ($this->nodeIsDirectoryIterator($node)) { + $constructor->setCode('return parent::__construct("' . __DIR__ . '");'); + + return; + } + + if ($this->nodeIsSplFileObject($node)) { + $filePath = str_replace('\\','\\\\',__FILE__); + $constructor->setCode('return parent::__construct("' . $filePath .'");'); + + return; + } + + if ($this->nodeIsSymfonySplFileInfo($node)) { + $filePath = str_replace('\\','\\\\',__FILE__); + $constructor->setCode('return parent::__construct("' . $filePath .'", "", "");'); + + return; + } + + $constructor->useParentCode(); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 50; + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsDirectoryIterator(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'DirectoryIterator' === $parent + || is_subclass_of($parent, 'DirectoryIterator'); + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsSplFileObject(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'SplFileObject' === $parent + || is_subclass_of($parent, 'SplFileObject'); + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsSymfonySplFileInfo(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'Symfony\\Component\\Finder\\SplFileInfo' === $parent; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php new file mode 100644 index 0000000..b98e943 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php @@ -0,0 +1,95 @@ +implementsAThrowableInterface($node) && $this->doesNotExtendAThrowableClass($node); + } + + /** + * @param ClassNode $node + * @return bool + */ + private function implementsAThrowableInterface(ClassNode $node) + { + foreach ($node->getInterfaces() as $type) { + if (is_a($type, 'Throwable', true)) { + return true; + } + } + + return false; + } + + /** + * @param ClassNode $node + * @return bool + */ + private function doesNotExtendAThrowableClass(ClassNode $node) + { + return !is_a($node->getParentClass(), 'Throwable', true); + } + + /** + * Applies patch to the specific class node. + * + * @param ClassNode $node + * + * @return void + */ + public function apply(ClassNode $node) + { + $this->checkItCanBeDoubled($node); + $this->setParentClassToException($node); + } + + private function checkItCanBeDoubled(ClassNode $node) + { + $className = $node->getParentClass(); + if ($className !== 'stdClass') { + throw new ClassCreatorException( + sprintf( + 'Cannot double concrete class %s as well as implement Traversable', + $className + ), + $node + ); + } + } + + private function setParentClassToException(ClassNode $node) + { + $node->setParentClass('Exception'); + + $node->removeMethod('getMessage'); + $node->removeMethod('getCode'); + $node->removeMethod('getFile'); + $node->removeMethod('getLine'); + $node->removeMethod('getTrace'); + $node->removeMethod('getPrevious'); + $node->removeMethod('getNext'); + $node->removeMethod('getTraceAsString'); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 100; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php new file mode 100644 index 0000000..eea0202 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php @@ -0,0 +1,83 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * Traversable interface patch. + * Forces classes that implement interfaces, that extend Traversable to also implement Iterator. + * + * @author Konstantin Kudryashov + */ +class TraversablePatch implements ClassPatchInterface +{ + /** + * Supports nodetree, that implement Traversable, but not Iterator or IteratorAggregate. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (in_array('Iterator', $node->getInterfaces())) { + return false; + } + if (in_array('IteratorAggregate', $node->getInterfaces())) { + return false; + } + + foreach ($node->getInterfaces() as $interface) { + if ('Traversable' !== $interface && !is_subclass_of($interface, 'Traversable')) { + continue; + } + if ('Iterator' === $interface || is_subclass_of($interface, 'Iterator')) { + continue; + } + if ('IteratorAggregate' === $interface || is_subclass_of($interface, 'IteratorAggregate')) { + continue; + } + + return true; + } + + return false; + } + + /** + * Forces class to implement Iterator interface. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $node->addInterface('Iterator'); + + $node->addMethod(new MethodNode('current')); + $node->addMethod(new MethodNode('key')); + $node->addMethod(new MethodNode('next')); + $node->addMethod(new MethodNode('rewind')); + $node->addMethod(new MethodNode('valid')); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 100; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php new file mode 100644 index 0000000..699be3a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php @@ -0,0 +1,22 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +/** + * Core double interface. + * All doubled classes will implement this one. + * + * @author Konstantin Kudryashov + */ +interface DoubleInterface +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php new file mode 100644 index 0000000..a378ae2 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php @@ -0,0 +1,146 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use Doctrine\Instantiator\Instantiator; +use Prophecy\Doubler\ClassPatch\ClassPatchInterface; +use Prophecy\Doubler\Generator\ClassMirror; +use Prophecy\Doubler\Generator\ClassCreator; +use Prophecy\Exception\InvalidArgumentException; +use ReflectionClass; + +/** + * Cached class doubler. + * Prevents mirroring/creation of the same structure twice. + * + * @author Konstantin Kudryashov + */ +class Doubler +{ + private $mirror; + private $creator; + private $namer; + + /** + * @var ClassPatchInterface[] + */ + private $patches = array(); + + /** + * @var \Doctrine\Instantiator\Instantiator + */ + private $instantiator; + + /** + * Initializes doubler. + * + * @param ClassMirror $mirror + * @param ClassCreator $creator + * @param NameGenerator $namer + */ + public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null, + NameGenerator $namer = null) + { + $this->mirror = $mirror ?: new ClassMirror; + $this->creator = $creator ?: new ClassCreator; + $this->namer = $namer ?: new NameGenerator; + } + + /** + * Returns list of registered class patches. + * + * @return ClassPatchInterface[] + */ + public function getClassPatches() + { + return $this->patches; + } + + /** + * Registers new class patch. + * + * @param ClassPatchInterface $patch + */ + public function registerClassPatch(ClassPatchInterface $patch) + { + $this->patches[] = $patch; + + @usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { + return $patch2->getPriority() - $patch1->getPriority(); + }); + } + + /** + * Creates double from specific class or/and list of interfaces. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces Array of ReflectionClass instances + * @param array $args Constructor arguments + * + * @return DoubleInterface + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function double(ReflectionClass $class = null, array $interfaces, array $args = null) + { + foreach ($interfaces as $interface) { + if (!$interface instanceof ReflectionClass) { + throw new InvalidArgumentException(sprintf( + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". + "a second argument to `Doubler::double(...)`, but got %s.", + is_object($interface) ? get_class($interface).' class' : gettype($interface) + )); + } + } + + $classname = $this->createDoubleClass($class, $interfaces); + $reflection = new ReflectionClass($classname); + + if (null !== $args) { + return $reflection->newInstanceArgs($args); + } + if ((null === $constructor = $reflection->getConstructor()) + || ($constructor->isPublic() && !$constructor->isFinal())) { + return $reflection->newInstance(); + } + + if (!$this->instantiator) { + $this->instantiator = new Instantiator(); + } + + return $this->instantiator->instantiate($classname); + } + + /** + * Creates double class and returns its FQN. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + { + $name = $this->namer->name($class, $interfaces); + $node = $this->mirror->reflect($class, $interfaces); + + foreach ($this->patches as $patch) { + if ($patch->supports($node)) { + $patch->apply($node); + } + } + + $this->creator->create($name, $node); + + return $name; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php new file mode 100644 index 0000000..891faa8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php @@ -0,0 +1,129 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +/** + * Class code creator. + * Generates PHP code for specific class node tree. + * + * @author Konstantin Kudryashov + */ +class ClassCodeGenerator +{ + /** + * @var TypeHintReference + */ + private $typeHintReference; + + public function __construct(TypeHintReference $typeHintReference = null) + { + $this->typeHintReference = $typeHintReference ?: new TypeHintReference(); + } + + /** + * Generates PHP code for class node. + * + * @param string $classname + * @param Node\ClassNode $class + * + * @return string + */ + public function generate($classname, Node\ClassNode $class) + { + $parts = explode('\\', $classname); + $classname = array_pop($parts); + $namespace = implode('\\', $parts); + + $code = sprintf("class %s extends \%s implements %s {\n", + $classname, $class->getParentClass(), implode(', ', + array_map(function ($interface) {return '\\'.$interface;}, $class->getInterfaces()) + ) + ); + + foreach ($class->getProperties() as $name => $visibility) { + $code .= sprintf("%s \$%s;\n", $visibility, $name); + } + $code .= "\n"; + + foreach ($class->getMethods() as $method) { + $code .= $this->generateMethod($method)."\n"; + } + $code .= "\n}"; + + return sprintf("namespace %s {\n%s\n}", $namespace, $code); + } + + private function generateMethod(Node\MethodNode $method) + { + $php = sprintf("%s %s function %s%s(%s)%s {\n", + $method->getVisibility(), + $method->isStatic() ? 'static' : '', + $method->returnsReference() ? '&':'', + $method->getName(), + implode(', ', $this->generateArguments($method->getArguments())), + $this->getReturnType($method) + ); + $php .= $method->getCode()."\n"; + + return $php.'}'; + } + + /** + * @return string + */ + private function getReturnType(Node\MethodNode $method) + { + if (version_compare(PHP_VERSION, '7.1', '>=')) { + if ($method->hasReturnType()) { + return $method->hasNullableReturnType() + ? sprintf(': ?%s', $method->getReturnType()) + : sprintf(': %s', $method->getReturnType()); + } + } + + if (version_compare(PHP_VERSION, '7.0', '>=')) { + return $method->hasReturnType() && $method->getReturnType() !== 'void' + ? sprintf(': %s', $method->getReturnType()) + : ''; + } + + return ''; + } + + private function generateArguments(array $arguments) + { + $typeHintReference = $this->typeHintReference; + return array_map(function (Node\ArgumentNode $argument) use ($typeHintReference) { + $php = ''; + + if (version_compare(PHP_VERSION, '7.1', '>=')) { + $php .= $argument->isNullable() ? '?' : ''; + } + + if ($hint = $argument->getTypeHint()) { + $php .= $typeHintReference->isBuiltInParamTypeHint($hint) ? $hint : '\\'.$hint; + } + + $php .= ' '.($argument->isPassedByReference() ? '&' : ''); + + $php .= $argument->isVariadic() ? '...' : ''; + + $php .= '$'.$argument->getName(); + + if ($argument->isOptional() && !$argument->isVariadic()) { + $php .= ' = '.var_export($argument->getDefault(), true); + } + + return $php; + }, $arguments); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php new file mode 100644 index 0000000..882a4a4 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php @@ -0,0 +1,67 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +use Prophecy\Exception\Doubler\ClassCreatorException; + +/** + * Class creator. + * Creates specific class in current environment. + * + * @author Konstantin Kudryashov + */ +class ClassCreator +{ + private $generator; + + /** + * Initializes creator. + * + * @param ClassCodeGenerator $generator + */ + public function __construct(ClassCodeGenerator $generator = null) + { + $this->generator = $generator ?: new ClassCodeGenerator; + } + + /** + * Creates class. + * + * @param string $classname + * @param Node\ClassNode $class + * + * @return mixed + * + * @throws \Prophecy\Exception\Doubler\ClassCreatorException + */ + public function create($classname, Node\ClassNode $class) + { + $code = $this->generator->generate($classname, $class); + $return = eval($code); + + if (!class_exists($classname, false)) { + if (count($class->getInterfaces())) { + throw new ClassCreatorException(sprintf( + 'Could not double `%s` and implement interfaces: [%s].', + $class->getParentClass(), implode(', ', $class->getInterfaces()) + ), $class); + } + + throw new ClassCreatorException( + sprintf('Could not double `%s`.', $class->getParentClass()), + $class + ); + } + + return $return; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php new file mode 100644 index 0000000..c5f9a5c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php @@ -0,0 +1,260 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Exception\Doubler\ClassMirrorException; +use ReflectionClass; +use ReflectionMethod; +use ReflectionParameter; + +/** + * Class mirror. + * Core doubler class. Mirrors specific class and/or interfaces into class node tree. + * + * @author Konstantin Kudryashov + */ +class ClassMirror +{ + private static $reflectableMethods = array( + '__construct', + '__destruct', + '__sleep', + '__wakeup', + '__toString', + '__call', + '__invoke' + ); + + /** + * Reflects provided arguments into class node. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return Node\ClassNode + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function reflect(ReflectionClass $class = null, array $interfaces) + { + $node = new Node\ClassNode; + + if (null !== $class) { + if (true === $class->isInterface()) { + throw new InvalidArgumentException(sprintf( + "Could not reflect %s as a class, because it\n". + "is interface - use the second argument instead.", + $class->getName() + )); + } + + $this->reflectClassToNode($class, $node); + } + + foreach ($interfaces as $interface) { + if (!$interface instanceof ReflectionClass) { + throw new InvalidArgumentException(sprintf( + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". + "a second argument to `ClassMirror::reflect(...)`, but got %s.", + is_object($interface) ? get_class($interface).' class' : gettype($interface) + )); + } + if (false === $interface->isInterface()) { + throw new InvalidArgumentException(sprintf( + "Could not reflect %s as an interface, because it\n". + "is class - use the first argument instead.", + $interface->getName() + )); + } + + $this->reflectInterfaceToNode($interface, $node); + } + + $node->addInterface('Prophecy\Doubler\Generator\ReflectionInterface'); + + return $node; + } + + private function reflectClassToNode(ReflectionClass $class, Node\ClassNode $node) + { + if (true === $class->isFinal()) { + throw new ClassMirrorException(sprintf( + 'Could not reflect class %s as it is marked final.', $class->getName() + ), $class); + } + + $node->setParentClass($class->getName()); + + foreach ($class->getMethods(ReflectionMethod::IS_ABSTRACT) as $method) { + if (false === $method->isProtected()) { + continue; + } + + $this->reflectMethodToNode($method, $node); + } + + foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { + if (0 === strpos($method->getName(), '_') + && !in_array($method->getName(), self::$reflectableMethods)) { + continue; + } + + if (true === $method->isFinal()) { + $node->addUnextendableMethod($method->getName()); + continue; + } + + $this->reflectMethodToNode($method, $node); + } + } + + private function reflectInterfaceToNode(ReflectionClass $interface, Node\ClassNode $node) + { + $node->addInterface($interface->getName()); + + foreach ($interface->getMethods() as $method) { + $this->reflectMethodToNode($method, $node); + } + } + + private function reflectMethodToNode(ReflectionMethod $method, Node\ClassNode $classNode) + { + $node = new Node\MethodNode($method->getName()); + + if (true === $method->isProtected()) { + $node->setVisibility('protected'); + } + + if (true === $method->isStatic()) { + $node->setStatic(); + } + + if (true === $method->returnsReference()) { + $node->setReturnsReference(); + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && $method->hasReturnType()) { + $returnType = (string) $method->getReturnType(); + $returnTypeLower = strtolower($returnType); + + if ('self' === $returnTypeLower) { + $returnType = $method->getDeclaringClass()->getName(); + } + if ('parent' === $returnTypeLower) { + $returnType = $method->getDeclaringClass()->getParentClass()->getName(); + } + + $node->setReturnType($returnType); + + if (version_compare(PHP_VERSION, '7.1', '>=') && $method->getReturnType()->allowsNull()) { + $node->setNullableReturnType(true); + } + } + + if (is_array($params = $method->getParameters()) && count($params)) { + foreach ($params as $param) { + $this->reflectArgumentToNode($param, $node); + } + } + + $classNode->addMethod($node); + } + + private function reflectArgumentToNode(ReflectionParameter $parameter, Node\MethodNode $methodNode) + { + $name = $parameter->getName() == '...' ? '__dot_dot_dot__' : $parameter->getName(); + $node = new Node\ArgumentNode($name); + + $node->setTypeHint($this->getTypeHint($parameter)); + + if ($this->isVariadic($parameter)) { + $node->setAsVariadic(); + } + + if ($this->hasDefaultValue($parameter)) { + $node->setDefault($this->getDefaultValue($parameter)); + } + + if ($parameter->isPassedByReference()) { + $node->setAsPassedByReference(); + } + + $node->setAsNullable($this->isNullable($parameter)); + + $methodNode->addArgument($node); + } + + private function hasDefaultValue(ReflectionParameter $parameter) + { + if ($this->isVariadic($parameter)) { + return false; + } + + if ($parameter->isDefaultValueAvailable()) { + return true; + } + + return $parameter->isOptional() || $this->isNullable($parameter); + } + + private function getDefaultValue(ReflectionParameter $parameter) + { + if (!$parameter->isDefaultValueAvailable()) { + return null; + } + + return $parameter->getDefaultValue(); + } + + private function getTypeHint(ReflectionParameter $parameter) + { + if (null !== $className = $this->getParameterClassName($parameter)) { + return $className; + } + + if (true === $parameter->isArray()) { + return 'array'; + } + + if (version_compare(PHP_VERSION, '5.4', '>=') && true === $parameter->isCallable()) { + return 'callable'; + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && true === $parameter->hasType()) { + return (string) $parameter->getType(); + } + + return null; + } + + private function isVariadic(ReflectionParameter $parameter) + { + return PHP_VERSION_ID >= 50600 && $parameter->isVariadic(); + } + + private function isNullable(ReflectionParameter $parameter) + { + return $parameter->allowsNull() && null !== $this->getTypeHint($parameter); + } + + private function getParameterClassName(ReflectionParameter $parameter) + { + try { + return $parameter->getClass() ? $parameter->getClass()->getName() : null; + } catch (\ReflectionException $e) { + preg_match('/\[\s\<\w+?>\s([\w,\\\]+)/s', $parameter, $matches); + + return isset($matches[1]) ? $matches[1] : null; + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php new file mode 100644 index 0000000..dd29b68 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php @@ -0,0 +1,102 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +/** + * Argument node. + * + * @author Konstantin Kudryashov + */ +class ArgumentNode +{ + private $name; + private $typeHint; + private $default; + private $optional = false; + private $byReference = false; + private $isVariadic = false; + private $isNullable = false; + + /** + * @param string $name + */ + public function __construct($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function getTypeHint() + { + return $this->typeHint; + } + + public function setTypeHint($typeHint = null) + { + $this->typeHint = $typeHint; + } + + public function hasDefault() + { + return $this->isOptional() && !$this->isVariadic(); + } + + public function getDefault() + { + return $this->default; + } + + public function setDefault($default = null) + { + $this->optional = true; + $this->default = $default; + } + + public function isOptional() + { + return $this->optional; + } + + public function setAsPassedByReference($byReference = true) + { + $this->byReference = $byReference; + } + + public function isPassedByReference() + { + return $this->byReference; + } + + public function setAsVariadic($isVariadic = true) + { + $this->isVariadic = $isVariadic; + } + + public function isVariadic() + { + return $this->isVariadic; + } + + public function isNullable() + { + return $this->isNullable; + } + + public function setAsNullable($isNullable = true) + { + $this->isNullable = $isNullable; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php new file mode 100644 index 0000000..f7bd285 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php @@ -0,0 +1,169 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +use Prophecy\Exception\Doubler\MethodNotExtendableException; +use Prophecy\Exception\InvalidArgumentException; + +/** + * Class node. + * + * @author Konstantin Kudryashov + */ +class ClassNode +{ + private $parentClass = 'stdClass'; + private $interfaces = array(); + private $properties = array(); + private $unextendableMethods = array(); + + /** + * @var MethodNode[] + */ + private $methods = array(); + + public function getParentClass() + { + return $this->parentClass; + } + + /** + * @param string $class + */ + public function setParentClass($class) + { + $this->parentClass = $class ?: 'stdClass'; + } + + /** + * @return string[] + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * @param string $interface + */ + public function addInterface($interface) + { + if ($this->hasInterface($interface)) { + return; + } + + array_unshift($this->interfaces, $interface); + } + + /** + * @param string $interface + * + * @return bool + */ + public function hasInterface($interface) + { + return in_array($interface, $this->interfaces); + } + + public function getProperties() + { + return $this->properties; + } + + public function addProperty($name, $visibility = 'public') + { + $visibility = strtolower($visibility); + + if (!in_array($visibility, array('public', 'private', 'protected'))) { + throw new InvalidArgumentException(sprintf( + '`%s` property visibility is not supported.', $visibility + )); + } + + $this->properties[$name] = $visibility; + } + + /** + * @return MethodNode[] + */ + public function getMethods() + { + return $this->methods; + } + + public function addMethod(MethodNode $method, $force = false) + { + if (!$this->isExtendable($method->getName())){ + $message = sprintf( + 'Method `%s` is not extendable, so can not be added.', $method->getName() + ); + throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName()); + } + + if ($force || !isset($this->methods[$method->getName()])) { + $this->methods[$method->getName()] = $method; + } + } + + public function removeMethod($name) + { + unset($this->methods[$name]); + } + + /** + * @param string $name + * + * @return MethodNode|null + */ + public function getMethod($name) + { + return $this->hasMethod($name) ? $this->methods[$name] : null; + } + + /** + * @param string $name + * + * @return bool + */ + public function hasMethod($name) + { + return isset($this->methods[$name]); + } + + /** + * @return string[] + */ + public function getUnextendableMethods() + { + return $this->unextendableMethods; + } + + /** + * @param string $unextendableMethod + */ + public function addUnextendableMethod($unextendableMethod) + { + if (!$this->isExtendable($unextendableMethod)){ + return; + } + $this->unextendableMethods[] = $unextendableMethod; + } + + /** + * @param string $method + * @return bool + */ + public function isExtendable($method) + { + return !in_array($method, $this->unextendableMethods); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php new file mode 100644 index 0000000..c74b483 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php @@ -0,0 +1,198 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +use Prophecy\Doubler\Generator\TypeHintReference; +use Prophecy\Exception\InvalidArgumentException; + +/** + * Method node. + * + * @author Konstantin Kudryashov + */ +class MethodNode +{ + private $name; + private $code; + private $visibility = 'public'; + private $static = false; + private $returnsReference = false; + private $returnType; + private $nullableReturnType = false; + + /** + * @var ArgumentNode[] + */ + private $arguments = array(); + + /** + * @var TypeHintReference + */ + private $typeHintReference; + + /** + * @param string $name + * @param string $code + */ + public function __construct($name, $code = null, TypeHintReference $typeHintReference = null) + { + $this->name = $name; + $this->code = $code; + $this->typeHintReference = $typeHintReference ?: new TypeHintReference(); + } + + public function getVisibility() + { + return $this->visibility; + } + + /** + * @param string $visibility + */ + public function setVisibility($visibility) + { + $visibility = strtolower($visibility); + + if (!in_array($visibility, array('public', 'private', 'protected'))) { + throw new InvalidArgumentException(sprintf( + '`%s` method visibility is not supported.', $visibility + )); + } + + $this->visibility = $visibility; + } + + public function isStatic() + { + return $this->static; + } + + public function setStatic($static = true) + { + $this->static = (bool) $static; + } + + public function returnsReference() + { + return $this->returnsReference; + } + + public function setReturnsReference() + { + $this->returnsReference = true; + } + + public function getName() + { + return $this->name; + } + + public function addArgument(ArgumentNode $argument) + { + $this->arguments[] = $argument; + } + + /** + * @return ArgumentNode[] + */ + public function getArguments() + { + return $this->arguments; + } + + public function hasReturnType() + { + return null !== $this->returnType; + } + + /** + * @param string $type + */ + public function setReturnType($type = null) + { + if ($type === '' || $type === null) { + $this->returnType = null; + return; + } + $typeMap = array( + 'double' => 'float', + 'real' => 'float', + 'boolean' => 'bool', + 'integer' => 'int', + ); + if (isset($typeMap[$type])) { + $type = $typeMap[$type]; + } + $this->returnType = $this->typeHintReference->isBuiltInReturnTypeHint($type) ? + $type : + '\\' . ltrim($type, '\\'); + } + + public function getReturnType() + { + return $this->returnType; + } + + /** + * @param bool $bool + */ + public function setNullableReturnType($bool = true) + { + $this->nullableReturnType = (bool) $bool; + } + + /** + * @return bool + */ + public function hasNullableReturnType() + { + return $this->nullableReturnType; + } + + /** + * @param string $code + */ + public function setCode($code) + { + $this->code = $code; + } + + public function getCode() + { + if ($this->returnsReference) + { + return "throw new \Prophecy\Exception\Doubler\ReturnByReferenceException('Returning by reference not supported', get_class(\$this), '{$this->name}');"; + } + + return (string) $this->code; + } + + public function useParentCode() + { + $this->code = sprintf( + 'return parent::%s(%s);', $this->getName(), implode(', ', + array_map(array($this, 'generateArgument'), $this->arguments) + ) + ); + } + + private function generateArgument(ArgumentNode $arg) + { + $argument = '$'.$arg->getName(); + + if ($arg->isVariadic()) { + $argument = '...'.$argument; + } + + return $argument; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php new file mode 100644 index 0000000..d720b15 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php @@ -0,0 +1,22 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +/** + * Reflection interface. + * All reflected classes implement this interface. + * + * @author Konstantin Kudryashov + */ +interface ReflectionInterface +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php new file mode 100644 index 0000000..ce95202 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php @@ -0,0 +1,46 @@ += 50400; + + case 'bool': + case 'float': + case 'int': + case 'string': + return PHP_VERSION_ID >= 70000; + + case 'iterable': + return PHP_VERSION_ID >= 70100; + + case 'object': + return PHP_VERSION_ID >= 70200; + + default: + return false; + } + } + + public function isBuiltInReturnTypeHint($type) + { + if ($type === 'void') { + return PHP_VERSION_ID >= 70100; + } + + return $this->isBuiltInParamTypeHint($type); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php new file mode 100644 index 0000000..8a99c4c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php @@ -0,0 +1,127 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use Prophecy\Exception\Doubler\DoubleException; +use Prophecy\Exception\Doubler\ClassNotFoundException; +use Prophecy\Exception\Doubler\InterfaceNotFoundException; +use ReflectionClass; + +/** + * Lazy double. + * Gives simple interface to describe double before creating it. + * + * @author Konstantin Kudryashov + */ +class LazyDouble +{ + private $doubler; + private $class; + private $interfaces = array(); + private $arguments = null; + private $double; + + /** + * Initializes lazy double. + * + * @param Doubler $doubler + */ + public function __construct(Doubler $doubler) + { + $this->doubler = $doubler; + } + + /** + * Tells doubler to use specific class as parent one for double. + * + * @param string|ReflectionClass $class + * + * @throws \Prophecy\Exception\Doubler\ClassNotFoundException + * @throws \Prophecy\Exception\Doubler\DoubleException + */ + public function setParentClass($class) + { + if (null !== $this->double) { + throw new DoubleException('Can not extend class with already instantiated double.'); + } + + if (!$class instanceof ReflectionClass) { + if (!class_exists($class)) { + throw new ClassNotFoundException(sprintf('Class %s not found.', $class), $class); + } + + $class = new ReflectionClass($class); + } + + $this->class = $class; + } + + /** + * Tells doubler to implement specific interface with double. + * + * @param string|ReflectionClass $interface + * + * @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException + * @throws \Prophecy\Exception\Doubler\DoubleException + */ + public function addInterface($interface) + { + if (null !== $this->double) { + throw new DoubleException( + 'Can not implement interface with already instantiated double.' + ); + } + + if (!$interface instanceof ReflectionClass) { + if (!interface_exists($interface)) { + throw new InterfaceNotFoundException( + sprintf('Interface %s not found.', $interface), + $interface + ); + } + + $interface = new ReflectionClass($interface); + } + + $this->interfaces[] = $interface; + } + + /** + * Sets constructor arguments. + * + * @param array $arguments + */ + public function setArguments(array $arguments = null) + { + $this->arguments = $arguments; + } + + /** + * Creates double instance or returns already created one. + * + * @return DoubleInterface + */ + public function getInstance() + { + if (null === $this->double) { + if (null !== $this->arguments) { + return $this->double = $this->doubler->double( + $this->class, $this->interfaces, $this->arguments + ); + } + + $this->double = $this->doubler->double($this->class, $this->interfaces); + } + + return $this->double; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php new file mode 100644 index 0000000..d67ec6a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use ReflectionClass; + +/** + * Name generator. + * Generates classname for double. + * + * @author Konstantin Kudryashov + */ +class NameGenerator +{ + private static $counter = 1; + + /** + * Generates name. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + public function name(ReflectionClass $class = null, array $interfaces) + { + $parts = array(); + + if (null !== $class) { + $parts[] = $class->getName(); + } else { + foreach ($interfaces as $interface) { + $parts[] = $interface->getShortName(); + } + } + + if (!count($parts)) { + $parts[] = 'stdClass'; + } + + return sprintf('Double\%s\P%d', implode('\\', $parts), self::$counter++); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php new file mode 100644 index 0000000..48ed225 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php @@ -0,0 +1,40 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Call; + +use Prophecy\Exception\Prophecy\ObjectProphecyException; +use Prophecy\Prophecy\ObjectProphecy; + +class UnexpectedCallException extends ObjectProphecyException +{ + private $methodName; + private $arguments; + + public function __construct($message, ObjectProphecy $objectProphecy, + $methodName, array $arguments) + { + parent::__construct($message, $objectProphecy); + + $this->methodName = $methodName; + $this->arguments = $arguments; + } + + public function getMethodName() + { + return $this->methodName; + } + + public function getArguments() + { + return $this->arguments; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php new file mode 100644 index 0000000..822918a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +class ClassCreatorException extends \RuntimeException implements DoublerException +{ + private $node; + + public function __construct($message, ClassNode $node) + { + parent::__construct($message); + + $this->node = $node; + } + + public function getClassNode() + { + return $this->node; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php new file mode 100644 index 0000000..8fc53b8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use ReflectionClass; + +class ClassMirrorException extends \RuntimeException implements DoublerException +{ + private $class; + + public function __construct($message, ReflectionClass $class) + { + parent::__construct($message); + + $this->class = $class; + } + + public function getReflectedClass() + { + return $this->class; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php new file mode 100644 index 0000000..5bc826d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php @@ -0,0 +1,33 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class ClassNotFoundException extends DoubleException +{ + private $classname; + + /** + * @param string $message + * @param string $classname + */ + public function __construct($message, $classname) + { + parent::__construct($message); + + $this->classname = $classname; + } + + public function getClassname() + { + return $this->classname; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php new file mode 100644 index 0000000..6642a58 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use RuntimeException; + +class DoubleException extends RuntimeException implements DoublerException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php new file mode 100644 index 0000000..9d6be17 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use Prophecy\Exception\Exception; + +interface DoublerException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php new file mode 100644 index 0000000..e344dea --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php @@ -0,0 +1,20 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class InterfaceNotFoundException extends ClassNotFoundException +{ + public function getInterfaceName() + { + return $this->getClassname(); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php new file mode 100644 index 0000000..56f47b1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php @@ -0,0 +1,41 @@ +methodName = $methodName; + $this->className = $className; + } + + + /** + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @return string + */ + public function getClassName() + { + return $this->className; + } + + } diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php new file mode 100644 index 0000000..a538349 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php @@ -0,0 +1,60 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class MethodNotFoundException extends DoubleException +{ + /** + * @var string|object + */ + private $classname; + + /** + * @var string + */ + private $methodName; + + /** + * @var array + */ + private $arguments; + + /** + * @param string $message + * @param string|object $classname + * @param string $methodName + * @param null|Argument\ArgumentsWildcard|array $arguments + */ + public function __construct($message, $classname, $methodName, $arguments = null) + { + parent::__construct($message); + + $this->classname = $classname; + $this->methodName = $methodName; + $this->arguments = $arguments; + } + + public function getClassname() + { + return $this->classname; + } + + public function getMethodName() + { + return $this->methodName; + } + + public function getArguments() + { + return $this->arguments; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php new file mode 100644 index 0000000..6303049 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php @@ -0,0 +1,41 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class ReturnByReferenceException extends DoubleException +{ + private $classname; + private $methodName; + + /** + * @param string $message + * @param string $classname + * @param string $methodName + */ + public function __construct($message, $classname, $methodName) + { + parent::__construct($message); + + $this->classname = $classname; + $this->methodName = $methodName; + } + + public function getClassname() + { + return $this->classname; + } + + public function getMethodName() + { + return $this->methodName; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php new file mode 100644 index 0000000..ac9fe4d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php @@ -0,0 +1,26 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception; + +/** + * Core Prophecy exception interface. + * All Prophecy exceptions implement it. + * + * @author Konstantin Kudryashov + */ +interface Exception +{ + /** + * @return string + */ + public function getMessage(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..bc91c69 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php @@ -0,0 +1,16 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception; + +class InvalidArgumentException extends \InvalidArgumentException implements Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php new file mode 100644 index 0000000..a00dfb0 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php @@ -0,0 +1,51 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\ObjectProphecy; + +class AggregateException extends \RuntimeException implements PredictionException +{ + private $exceptions = array(); + private $objectProphecy; + + public function append(PredictionException $exception) + { + $message = $exception->getMessage(); + $message = strtr($message, array("\n" => "\n "))."\n"; + $message = empty($this->exceptions) ? $message : "\n" . $message; + + $this->message = rtrim($this->message.$message); + $this->exceptions[] = $exception; + } + + /** + * @return PredictionException[] + */ + public function getExceptions() + { + return $this->exceptions; + } + + public function setObjectProphecy(ObjectProphecy $objectProphecy) + { + $this->objectProphecy = $objectProphecy; + } + + /** + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php new file mode 100644 index 0000000..bbbbc3d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php @@ -0,0 +1,24 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use RuntimeException; + +/** + * Basic failed prediction exception. + * Use it for custom prediction failures. + * + * @author Konstantin Kudryashov + */ +class FailedPredictionException extends RuntimeException implements PredictionException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php new file mode 100644 index 0000000..05ea4aa --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Exception\Prophecy\MethodProphecyException; + +class NoCallsException extends MethodProphecyException implements PredictionException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php new file mode 100644 index 0000000..2596b1e --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Exception\Exception; + +interface PredictionException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php new file mode 100644 index 0000000..9d90543 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\MethodProphecy; + +class UnexpectedCallsCountException extends UnexpectedCallsException +{ + private $expectedCount; + + public function __construct($message, MethodProphecy $methodProphecy, $count, array $calls) + { + parent::__construct($message, $methodProphecy, $calls); + + $this->expectedCount = intval($count); + } + + public function getExpectedCount() + { + return $this->expectedCount; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php new file mode 100644 index 0000000..7a99c2d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php @@ -0,0 +1,32 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\Prophecy\MethodProphecyException; + +class UnexpectedCallsException extends MethodProphecyException implements PredictionException +{ + private $calls = array(); + + public function __construct($message, MethodProphecy $methodProphecy, array $calls) + { + parent::__construct($message, $methodProphecy); + + $this->calls = $calls; + } + + public function getCalls() + { + return $this->calls; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php new file mode 100644 index 0000000..1b03eaf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Prophecy\MethodProphecy; + +class MethodProphecyException extends ObjectProphecyException +{ + private $methodProphecy; + + public function __construct($message, MethodProphecy $methodProphecy) + { + parent::__construct($message, $methodProphecy->getObjectProphecy()); + + $this->methodProphecy = $methodProphecy; + } + + /** + * @return MethodProphecy + */ + public function getMethodProphecy() + { + return $this->methodProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php new file mode 100644 index 0000000..e345402 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Prophecy\ObjectProphecy; + +class ObjectProphecyException extends \RuntimeException implements ProphecyException +{ + private $objectProphecy; + + public function __construct($message, ObjectProphecy $objectProphecy) + { + parent::__construct($message); + + $this->objectProphecy = $objectProphecy; + } + + /** + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php new file mode 100644 index 0000000..9157332 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Exception\Exception; + +interface ProphecyException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php new file mode 100644 index 0000000..209821c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -0,0 +1,69 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface +{ + private $classRetriever; + + public function __construct(MethodTagRetrieverInterface $classRetriever = null) + { + if (null !== $classRetriever) { + $this->classRetriever = $classRetriever; + + return; + } + + $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory') + ? new ClassTagRetriever() + : new LegacyClassTagRetriever() + ; + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + return array_merge( + $this->classRetriever->getTagList($reflectionClass), + $this->getInterfacesTagList($reflectionClass) + ); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + private function getInterfacesTagList(\ReflectionClass $reflectionClass) + { + $interfaces = $reflectionClass->getInterfaces(); + $tagList = array(); + + foreach($interfaces as $interface) { + $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); + } + + return $tagList; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php new file mode 100644 index 0000000..1d2da8f --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\Types\ContextFactory; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class ClassTagRetriever implements MethodTagRetrieverInterface +{ + private $docBlockFactory; + private $contextFactory; + + public function __construct() + { + $this->docBlockFactory = DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + try { + $phpdoc = $this->docBlockFactory->create( + $reflectionClass, + $this->contextFactory->createFromReflector($reflectionClass) + ); + + return $phpdoc->getTagsByName('method'); + } catch (\InvalidArgumentException $e) { + return array(); + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php new file mode 100644 index 0000000..c0dec3d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php @@ -0,0 +1,35 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class LegacyClassTagRetriever implements MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + $phpdoc = new DocBlock($reflectionClass->getDocComment()); + + return $phpdoc->getTagsByName('method'); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php new file mode 100644 index 0000000..d3989da --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php @@ -0,0 +1,30 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + * + * @internal + */ +interface MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php new file mode 100644 index 0000000..b478736 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php @@ -0,0 +1,86 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Argument\Token\AnyValuesToken; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\NoCallsException; + +/** + * Call prediction. + * + * @author Konstantin Kudryashov + */ +class CallPrediction implements PredictionInterface +{ + private $util; + + /** + * Initializes prediction. + * + * @param StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there was at least one call. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\NoCallsException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if (count($calls)) { + return; + } + + $methodCalls = $object->findProphecyMethodCalls( + $method->getMethodName(), + new ArgumentsWildcard(array(new AnyValuesToken)) + ); + + if (count($methodCalls)) { + throw new NoCallsException(sprintf( + "No calls have been made that match:\n". + " %s->%s(%s)\n". + "but expected at least one.\n". + "Recorded `%s(...)` calls:\n%s", + + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + $method->getMethodName(), + $this->util->stringifyCalls($methodCalls) + ), $method); + } + + throw new NoCallsException(sprintf( + "No calls have been made that match:\n". + " %s->%s(%s)\n". + "but expected at least one.", + + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard() + ), $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php new file mode 100644 index 0000000..31c6c57 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php @@ -0,0 +1,107 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Argument\Token\AnyValuesToken; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\UnexpectedCallsCountException; + +/** + * Prediction interface. + * Predictions are logical test blocks, tied to `should...` keyword. + * + * @author Konstantin Kudryashov + */ +class CallTimesPrediction implements PredictionInterface +{ + private $times; + private $util; + + /** + * Initializes prediction. + * + * @param int $times + * @param StringUtil $util + */ + public function __construct($times, StringUtil $util = null) + { + $this->times = intval($times); + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there was exact amount of calls made. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\UnexpectedCallsCountException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if ($this->times == count($calls)) { + return; + } + + $methodCalls = $object->findProphecyMethodCalls( + $method->getMethodName(), + new ArgumentsWildcard(array(new AnyValuesToken)) + ); + + if (count($calls)) { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but %d were made:\n%s", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + count($calls), + $this->util->stringifyCalls($calls) + ); + } elseif (count($methodCalls)) { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but none were made.\n". + "Recorded `%s(...)` calls:\n%s", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + $method->getMethodName(), + $this->util->stringifyCalls($methodCalls) + ); + } else { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but none were made.", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard() + ); + } + + throw new UnexpectedCallsCountException($message, $method, $this->times, $calls); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php new file mode 100644 index 0000000..44bc782 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php @@ -0,0 +1,65 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use Closure; + +/** + * Callback prediction. + * + * @author Konstantin Kudryashov + */ +class CallbackPrediction implements PredictionInterface +{ + private $callback; + + /** + * Initializes callback prediction. + * + * @param callable $callback Custom callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackPrediction, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Executes preset callback. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + $callback = $this->callback; + + if ($callback instanceof Closure && method_exists('Closure', 'bind')) { + $callback = Closure::bind($callback, $object); + } + + call_user_func($callback, $calls, $object, $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php new file mode 100644 index 0000000..46ac5bf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php @@ -0,0 +1,68 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\UnexpectedCallsException; + +/** + * No calls prediction. + * + * @author Konstantin Kudryashov + */ +class NoCallsPrediction implements PredictionInterface +{ + private $util; + + /** + * Initializes prediction. + * + * @param null|StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there were no calls made. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\UnexpectedCallsException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if (!count($calls)) { + return; + } + + $verb = count($calls) === 1 ? 'was' : 'were'; + + throw new UnexpectedCallsException(sprintf( + "No calls expected that match:\n". + " %s->%s(%s)\n". + "but %d %s made:\n%s", + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + count($calls), + $verb, + $this->util->stringifyCalls($calls) + ), $method, $calls); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php new file mode 100644 index 0000000..f7fb06a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php @@ -0,0 +1,37 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Prediction interface. + * Predictions are logical test blocks, tied to `should...` keyword. + * + * @author Konstantin Kudryashov + */ +interface PredictionInterface +{ + /** + * Tests that double fulfilled prediction. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws object + * @return void + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php new file mode 100644 index 0000000..5f406bf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php @@ -0,0 +1,66 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use Closure; + +/** + * Callback promise. + * + * @author Konstantin Kudryashov + */ +class CallbackPromise implements PromiseInterface +{ + private $callback; + + /** + * Initializes callback promise. + * + * @param callable $callback Custom callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackPromise, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Evaluates promise callback. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + $callback = $this->callback; + + if ($callback instanceof Closure && method_exists('Closure', 'bind')) { + $callback = Closure::bind($callback, $object); + } + + return call_user_func($callback, $args, $object, $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php new file mode 100644 index 0000000..382537b --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php @@ -0,0 +1,35 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Promise interface. + * Promises are logical blocks, tied to `will...` keyword. + * + * @author Konstantin Kudryashov + */ +interface PromiseInterface +{ + /** + * Evaluates promise. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php new file mode 100644 index 0000000..39bfeea --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php @@ -0,0 +1,61 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Return argument promise. + * + * @author Konstantin Kudryashov + */ +class ReturnArgumentPromise implements PromiseInterface +{ + /** + * @var int + */ + private $index; + + /** + * Initializes callback promise. + * + * @param int $index The zero-indexed number of the argument to return + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($index = 0) + { + if (!is_int($index) || $index < 0) { + throw new InvalidArgumentException(sprintf( + 'Zero-based index expected as argument to ReturnArgumentPromise, but got %s.', + $index + )); + } + $this->index = $index; + } + + /** + * Returns nth argument if has one, null otherwise. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return null|mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + return count($args) > $this->index ? $args[$this->index] : null; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php new file mode 100644 index 0000000..c7d5ac5 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php @@ -0,0 +1,55 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Return promise. + * + * @author Konstantin Kudryashov + */ +class ReturnPromise implements PromiseInterface +{ + private $returnValues = array(); + + /** + * Initializes promise. + * + * @param array $returnValues Array of values + */ + public function __construct(array $returnValues) + { + $this->returnValues = $returnValues; + } + + /** + * Returns saved values one by one until last one, then continuously returns last value. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + $value = array_shift($this->returnValues); + + if (!count($this->returnValues)) { + $this->returnValues[] = $value; + } + + return $value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php new file mode 100644 index 0000000..7250fa3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php @@ -0,0 +1,99 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Doctrine\Instantiator\Instantiator; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use ReflectionClass; + +/** + * Throw promise. + * + * @author Konstantin Kudryashov + */ +class ThrowPromise implements PromiseInterface +{ + private $exception; + + /** + * @var \Doctrine\Instantiator\Instantiator + */ + private $instantiator; + + /** + * Initializes promise. + * + * @param string|\Exception|\Throwable $exception Exception class name or instance + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($exception) + { + if (is_string($exception)) { + if (!class_exists($exception) || !$this->isAValidThrowable($exception)) { + throw new InvalidArgumentException(sprintf( + 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', + $exception + )); + } + } elseif (!$exception instanceof \Exception && !$exception instanceof \Throwable) { + throw new InvalidArgumentException(sprintf( + 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', + is_object($exception) ? get_class($exception) : gettype($exception) + )); + } + + $this->exception = $exception; + } + + /** + * Throws predefined exception. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws object + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + if (is_string($this->exception)) { + $classname = $this->exception; + $reflection = new ReflectionClass($classname); + $constructor = $reflection->getConstructor(); + + if ($constructor->isPublic() && 0 == $constructor->getNumberOfRequiredParameters()) { + throw $reflection->newInstance(); + } + + if (!$this->instantiator) { + $this->instantiator = new Instantiator(); + } + + throw $this->instantiator->instantiate($classname); + } + + throw $this->exception; + } + + /** + * @param string $exception + * + * @return bool + */ + private function isAValidThrowable($exception) + { + return is_a($exception, 'Exception', true) || is_subclass_of($exception, 'Throwable', true); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php new file mode 100644 index 0000000..7084ed6 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php @@ -0,0 +1,488 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +use Prophecy\Argument; +use Prophecy\Prophet; +use Prophecy\Promise; +use Prophecy\Prediction; +use Prophecy\Exception\Doubler\MethodNotFoundException; +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Exception\Prophecy\MethodProphecyException; + +/** + * Method prophecy. + * + * @author Konstantin Kudryashov + */ +class MethodProphecy +{ + private $objectProphecy; + private $methodName; + private $argumentsWildcard; + private $promise; + private $prediction; + private $checkedPredictions = array(); + private $bound = false; + private $voidReturnType = false; + + /** + * Initializes method prophecy. + * + * @param ObjectProphecy $objectProphecy + * @param string $methodName + * @param null|Argument\ArgumentsWildcard|array $arguments + * + * @throws \Prophecy\Exception\Doubler\MethodNotFoundException If method not found + */ + public function __construct(ObjectProphecy $objectProphecy, $methodName, $arguments = null) + { + $double = $objectProphecy->reveal(); + if (!method_exists($double, $methodName)) { + throw new MethodNotFoundException(sprintf( + 'Method `%s::%s()` is not defined.', get_class($double), $methodName + ), get_class($double), $methodName, $arguments); + } + + $this->objectProphecy = $objectProphecy; + $this->methodName = $methodName; + + $reflectedMethod = new \ReflectionMethod($double, $methodName); + if ($reflectedMethod->isFinal()) { + throw new MethodProphecyException(sprintf( + "Can not add prophecy for a method `%s::%s()`\n". + "as it is a final method.", + get_class($double), + $methodName + ), $this); + } + + if (null !== $arguments) { + $this->withArguments($arguments); + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && true === $reflectedMethod->hasReturnType()) { + $type = (string) $reflectedMethod->getReturnType(); + + if ('void' === $type) { + $this->voidReturnType = true; + } + + $this->will(function () use ($type) { + switch ($type) { + case 'void': return; + case 'string': return ''; + case 'float': return 0.0; + case 'int': return 0; + case 'bool': return false; + case 'array': return array(); + + case 'callable': + case 'Closure': + return function () {}; + + case 'Traversable': + case 'Generator': + // Remove eval() when minimum version >=5.5 + /** @var callable $generator */ + $generator = eval('return function () { yield; };'); + return $generator(); + + default: + $prophet = new Prophet; + return $prophet->prophesize($type)->reveal(); + } + }); + } + } + + /** + * Sets argument wildcard. + * + * @param array|Argument\ArgumentsWildcard $arguments + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function withArguments($arguments) + { + if (is_array($arguments)) { + $arguments = new Argument\ArgumentsWildcard($arguments); + } + + if (!$arguments instanceof Argument\ArgumentsWildcard) { + throw new InvalidArgumentException(sprintf( + "Either an array or an instance of ArgumentsWildcard expected as\n". + 'a `MethodProphecy::withArguments()` argument, but got %s.', + gettype($arguments) + )); + } + + $this->argumentsWildcard = $arguments; + + return $this; + } + + /** + * Sets custom promise to the prophecy. + * + * @param callable|Promise\PromiseInterface $promise + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function will($promise) + { + if (is_callable($promise)) { + $promise = new Promise\CallbackPromise($promise); + } + + if (!$promise instanceof Promise\PromiseInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PromiseInterface, but got %s.', + gettype($promise) + )); + } + + $this->bindToObjectProphecy(); + $this->promise = $promise; + + return $this; + } + + /** + * Sets return promise to the prophecy. + * + * @see \Prophecy\Promise\ReturnPromise + * + * @return $this + */ + public function willReturn() + { + if ($this->voidReturnType) { + throw new MethodProphecyException( + "The method \"$this->methodName\" has a void return type, and so cannot return anything", + $this + ); + } + + return $this->will(new Promise\ReturnPromise(func_get_args())); + } + + /** + * Sets return argument promise to the prophecy. + * + * @param int $index The zero-indexed number of the argument to return + * + * @see \Prophecy\Promise\ReturnArgumentPromise + * + * @return $this + */ + public function willReturnArgument($index = 0) + { + if ($this->voidReturnType) { + throw new MethodProphecyException("The method \"$this->methodName\" has a void return type", $this); + } + + return $this->will(new Promise\ReturnArgumentPromise($index)); + } + + /** + * Sets throw promise to the prophecy. + * + * @see \Prophecy\Promise\ThrowPromise + * + * @param string|\Exception $exception Exception class or instance + * + * @return $this + */ + public function willThrow($exception) + { + return $this->will(new Promise\ThrowPromise($exception)); + } + + /** + * Sets custom prediction to the prophecy. + * + * @param callable|Prediction\PredictionInterface $prediction + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function should($prediction) + { + if (is_callable($prediction)) { + $prediction = new Prediction\CallbackPrediction($prediction); + } + + if (!$prediction instanceof Prediction\PredictionInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PredictionInterface, but got %s.', + gettype($prediction) + )); + } + + $this->bindToObjectProphecy(); + $this->prediction = $prediction; + + return $this; + } + + /** + * Sets call prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallPrediction + * + * @return $this + */ + public function shouldBeCalled() + { + return $this->should(new Prediction\CallPrediction); + } + + /** + * Sets no calls prediction to the prophecy. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * + * @return $this + */ + public function shouldNotBeCalled() + { + return $this->should(new Prediction\NoCallsPrediction); + } + + /** + * Sets call times prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @param $count + * + * @return $this + */ + public function shouldBeCalledTimes($count) + { + return $this->should(new Prediction\CallTimesPrediction($count)); + } + + /** + * Sets call times prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @return $this + */ + public function shouldBeCalledOnce() + { + return $this->shouldBeCalledTimes(1); + } + + /** + * Checks provided prediction immediately. + * + * @param callable|Prediction\PredictionInterface $prediction + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function shouldHave($prediction) + { + if (is_callable($prediction)) { + $prediction = new Prediction\CallbackPrediction($prediction); + } + + if (!$prediction instanceof Prediction\PredictionInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PredictionInterface, but got %s.', + gettype($prediction) + )); + } + + if (null === $this->promise && !$this->voidReturnType) { + $this->willReturn(); + } + + $calls = $this->getObjectProphecy()->findProphecyMethodCalls( + $this->getMethodName(), + $this->getArgumentsWildcard() + ); + + try { + $prediction->check($calls, $this->getObjectProphecy(), $this); + $this->checkedPredictions[] = $prediction; + } catch (\Exception $e) { + $this->checkedPredictions[] = $prediction; + + throw $e; + } + + return $this; + } + + /** + * Checks call prediction. + * + * @see \Prophecy\Prediction\CallPrediction + * + * @return $this + */ + public function shouldHaveBeenCalled() + { + return $this->shouldHave(new Prediction\CallPrediction); + } + + /** + * Checks no calls prediction. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * + * @return $this + */ + public function shouldNotHaveBeenCalled() + { + return $this->shouldHave(new Prediction\NoCallsPrediction); + } + + /** + * Checks no calls prediction. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * @deprecated + * + * @return $this + */ + public function shouldNotBeenCalled() + { + return $this->shouldNotHaveBeenCalled(); + } + + /** + * Checks call times prediction. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @param int $count + * + * @return $this + */ + public function shouldHaveBeenCalledTimes($count) + { + return $this->shouldHave(new Prediction\CallTimesPrediction($count)); + } + + /** + * Checks call times prediction. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @return $this + */ + public function shouldHaveBeenCalledOnce() + { + return $this->shouldHaveBeenCalledTimes(1); + } + + /** + * Checks currently registered [with should(...)] prediction. + */ + public function checkPrediction() + { + if (null === $this->prediction) { + return; + } + + $this->shouldHave($this->prediction); + } + + /** + * Returns currently registered promise. + * + * @return null|Promise\PromiseInterface + */ + public function getPromise() + { + return $this->promise; + } + + /** + * Returns currently registered prediction. + * + * @return null|Prediction\PredictionInterface + */ + public function getPrediction() + { + return $this->prediction; + } + + /** + * Returns predictions that were checked on this object. + * + * @return Prediction\PredictionInterface[] + */ + public function getCheckedPredictions() + { + return $this->checkedPredictions; + } + + /** + * Returns object prophecy this method prophecy is tied to. + * + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } + + /** + * Returns method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * Returns arguments wildcard. + * + * @return Argument\ArgumentsWildcard + */ + public function getArgumentsWildcard() + { + return $this->argumentsWildcard; + } + + /** + * @return bool + */ + public function hasReturnVoid() + { + return $this->voidReturnType; + } + + private function bindToObjectProphecy() + { + if ($this->bound) { + return; + } + + $this->getObjectProphecy()->addMethodProphecy($this); + $this->bound = true; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php new file mode 100644 index 0000000..8d8f8a1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php @@ -0,0 +1,281 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Call\Call; +use Prophecy\Doubler\LazyDouble; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Call\CallCenter; +use Prophecy\Exception\Prophecy\ObjectProphecyException; +use Prophecy\Exception\Prophecy\MethodProphecyException; +use Prophecy\Exception\Prediction\AggregateException; +use Prophecy\Exception\Prediction\PredictionException; + +/** + * Object prophecy. + * + * @author Konstantin Kudryashov + */ +class ObjectProphecy implements ProphecyInterface +{ + private $lazyDouble; + private $callCenter; + private $revealer; + private $comparatorFactory; + + /** + * @var MethodProphecy[][] + */ + private $methodProphecies = array(); + + /** + * Initializes object prophecy. + * + * @param LazyDouble $lazyDouble + * @param CallCenter $callCenter + * @param RevealerInterface $revealer + * @param ComparatorFactory $comparatorFactory + */ + public function __construct( + LazyDouble $lazyDouble, + CallCenter $callCenter = null, + RevealerInterface $revealer = null, + ComparatorFactory $comparatorFactory = null + ) { + $this->lazyDouble = $lazyDouble; + $this->callCenter = $callCenter ?: new CallCenter; + $this->revealer = $revealer ?: new Revealer; + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Forces double to extend specific class. + * + * @param string $class + * + * @return $this + */ + public function willExtend($class) + { + $this->lazyDouble->setParentClass($class); + + return $this; + } + + /** + * Forces double to implement specific interface. + * + * @param string $interface + * + * @return $this + */ + public function willImplement($interface) + { + $this->lazyDouble->addInterface($interface); + + return $this; + } + + /** + * Sets constructor arguments. + * + * @param array $arguments + * + * @return $this + */ + public function willBeConstructedWith(array $arguments = null) + { + $this->lazyDouble->setArguments($arguments); + + return $this; + } + + /** + * Reveals double. + * + * @return object + * + * @throws \Prophecy\Exception\Prophecy\ObjectProphecyException If double doesn't implement needed interface + */ + public function reveal() + { + $double = $this->lazyDouble->getInstance(); + + if (null === $double || !$double instanceof ProphecySubjectInterface) { + throw new ObjectProphecyException( + "Generated double must implement ProphecySubjectInterface, but it does not.\n". + 'It seems you have wrongly configured doubler without required ClassPatch.', + $this + ); + } + + $double->setProphecy($this); + + return $double; + } + + /** + * Adds method prophecy to object prophecy. + * + * @param MethodProphecy $methodProphecy + * + * @throws \Prophecy\Exception\Prophecy\MethodProphecyException If method prophecy doesn't + * have arguments wildcard + */ + public function addMethodProphecy(MethodProphecy $methodProphecy) + { + $argumentsWildcard = $methodProphecy->getArgumentsWildcard(); + if (null === $argumentsWildcard) { + throw new MethodProphecyException(sprintf( + "Can not add prophecy for a method `%s::%s()`\n". + "as you did not specify arguments wildcard for it.", + get_class($this->reveal()), + $methodProphecy->getMethodName() + ), $methodProphecy); + } + + $methodName = $methodProphecy->getMethodName(); + + if (!isset($this->methodProphecies[$methodName])) { + $this->methodProphecies[$methodName] = array(); + } + + $this->methodProphecies[$methodName][] = $methodProphecy; + } + + /** + * Returns either all or related to single method prophecies. + * + * @param null|string $methodName + * + * @return MethodProphecy[] + */ + public function getMethodProphecies($methodName = null) + { + if (null === $methodName) { + return $this->methodProphecies; + } + + if (!isset($this->methodProphecies[$methodName])) { + return array(); + } + + return $this->methodProphecies[$methodName]; + } + + /** + * Makes specific method call. + * + * @param string $methodName + * @param array $arguments + * + * @return mixed + */ + public function makeProphecyMethodCall($methodName, array $arguments) + { + $arguments = $this->revealer->reveal($arguments); + $return = $this->callCenter->makeCall($this, $methodName, $arguments); + + return $this->revealer->reveal($return); + } + + /** + * Finds calls by method name & arguments wildcard. + * + * @param string $methodName + * @param ArgumentsWildcard $wildcard + * + * @return Call[] + */ + public function findProphecyMethodCalls($methodName, ArgumentsWildcard $wildcard) + { + return $this->callCenter->findCalls($methodName, $wildcard); + } + + /** + * Checks that registered method predictions do not fail. + * + * @throws \Prophecy\Exception\Prediction\AggregateException If any of registered predictions fail + */ + public function checkProphecyMethodsPredictions() + { + $exception = new AggregateException(sprintf("%s:\n", get_class($this->reveal()))); + $exception->setObjectProphecy($this); + + foreach ($this->methodProphecies as $prophecies) { + foreach ($prophecies as $prophecy) { + try { + $prophecy->checkPrediction(); + } catch (PredictionException $e) { + $exception->append($e); + } + } + } + + if (count($exception->getExceptions())) { + throw $exception; + } + } + + /** + * Creates new method prophecy using specified method name and arguments. + * + * @param string $methodName + * @param array $arguments + * + * @return MethodProphecy + */ + public function __call($methodName, array $arguments) + { + $arguments = new ArgumentsWildcard($this->revealer->reveal($arguments)); + + foreach ($this->getMethodProphecies($methodName) as $prophecy) { + $argumentsWildcard = $prophecy->getArgumentsWildcard(); + $comparator = $this->comparatorFactory->getComparatorFor( + $argumentsWildcard, $arguments + ); + + try { + $comparator->assertEquals($argumentsWildcard, $arguments); + return $prophecy; + } catch (ComparisonFailure $failure) {} + } + + return new MethodProphecy($this, $methodName, $arguments); + } + + /** + * Tries to get property value from double. + * + * @param string $name + * + * @return mixed + */ + public function __get($name) + { + return $this->reveal()->$name; + } + + /** + * Tries to set property value to double. + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + $this->reveal()->$name = $this->revealer->reveal($value); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php new file mode 100644 index 0000000..462f15a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php @@ -0,0 +1,27 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Core Prophecy interface. + * + * @author Konstantin Kudryashov + */ +interface ProphecyInterface +{ + /** + * Reveals prophecy object (double) . + * + * @return object + */ + public function reveal(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php new file mode 100644 index 0000000..2d83958 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Controllable doubles interface. + * + * @author Konstantin Kudryashov + */ +interface ProphecySubjectInterface +{ + /** + * Sets subject prophecy. + * + * @param ProphecyInterface $prophecy + */ + public function setProphecy(ProphecyInterface $prophecy); + + /** + * Returns subject prophecy. + * + * @return ProphecyInterface + */ + public function getProphecy(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php new file mode 100644 index 0000000..60ecdac --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php @@ -0,0 +1,44 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Basic prophecies revealer. + * + * @author Konstantin Kudryashov + */ +class Revealer implements RevealerInterface +{ + /** + * Unwraps value(s). + * + * @param mixed $value + * + * @return mixed + */ + public function reveal($value) + { + if (is_array($value)) { + return array_map(array($this, __FUNCTION__), $value); + } + + if (!is_object($value)) { + return $value; + } + + if ($value instanceof ProphecyInterface) { + $value = $value->reveal(); + } + + return $value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php new file mode 100644 index 0000000..ffc82bb --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php @@ -0,0 +1,29 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Prophecies revealer interface. + * + * @author Konstantin Kudryashov + */ +interface RevealerInterface +{ + /** + * Unwraps value(s). + * + * @param mixed $value + * + * @return mixed + */ + public function reveal($value); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophet.php b/vendor/phpspec/prophecy/src/Prophecy/Prophet.php new file mode 100644 index 0000000..a4fe4b0 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophet.php @@ -0,0 +1,135 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy; + +use Prophecy\Doubler\Doubler; +use Prophecy\Doubler\LazyDouble; +use Prophecy\Doubler\ClassPatch; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\RevealerInterface; +use Prophecy\Prophecy\Revealer; +use Prophecy\Call\CallCenter; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\PredictionException; +use Prophecy\Exception\Prediction\AggregateException; + +/** + * Prophet creates prophecies. + * + * @author Konstantin Kudryashov + */ +class Prophet +{ + private $doubler; + private $revealer; + private $util; + + /** + * @var ObjectProphecy[] + */ + private $prophecies = array(); + + /** + * Initializes Prophet. + * + * @param null|Doubler $doubler + * @param null|RevealerInterface $revealer + * @param null|StringUtil $util + */ + public function __construct(Doubler $doubler = null, RevealerInterface $revealer = null, + StringUtil $util = null) + { + if (null === $doubler) { + $doubler = new Doubler; + $doubler->registerClassPatch(new ClassPatch\SplFileInfoPatch); + $doubler->registerClassPatch(new ClassPatch\TraversablePatch); + $doubler->registerClassPatch(new ClassPatch\ThrowablePatch); + $doubler->registerClassPatch(new ClassPatch\DisableConstructorPatch); + $doubler->registerClassPatch(new ClassPatch\ProphecySubjectPatch); + $doubler->registerClassPatch(new ClassPatch\ReflectionClassNewInstancePatch); + $doubler->registerClassPatch(new ClassPatch\HhvmExceptionPatch()); + $doubler->registerClassPatch(new ClassPatch\MagicCallPatch); + $doubler->registerClassPatch(new ClassPatch\KeywordPatch); + } + + $this->doubler = $doubler; + $this->revealer = $revealer ?: new Revealer; + $this->util = $util ?: new StringUtil; + } + + /** + * Creates new object prophecy. + * + * @param null|string $classOrInterface Class or interface name + * + * @return ObjectProphecy + */ + public function prophesize($classOrInterface = null) + { + $this->prophecies[] = $prophecy = new ObjectProphecy( + new LazyDouble($this->doubler), + new CallCenter($this->util), + $this->revealer + ); + + if ($classOrInterface && class_exists($classOrInterface)) { + return $prophecy->willExtend($classOrInterface); + } + + if ($classOrInterface && interface_exists($classOrInterface)) { + return $prophecy->willImplement($classOrInterface); + } + + return $prophecy; + } + + /** + * Returns all created object prophecies. + * + * @return ObjectProphecy[] + */ + public function getProphecies() + { + return $this->prophecies; + } + + /** + * Returns Doubler instance assigned to this Prophet. + * + * @return Doubler + */ + public function getDoubler() + { + return $this->doubler; + } + + /** + * Checks all predictions defined by prophecies of this Prophet. + * + * @throws Exception\Prediction\AggregateException If any prediction fails + */ + public function checkPredictions() + { + $exception = new AggregateException("Some predictions failed:\n"); + foreach ($this->prophecies as $prophecy) { + try { + $prophecy->checkProphecyMethodsPredictions(); + } catch (PredictionException $e) { + $exception->append($e); + } + } + + if (count($exception->getExceptions())) { + throw $exception; + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php b/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php new file mode 100644 index 0000000..50dd3f3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php @@ -0,0 +1,212 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * This class is a modification from sebastianbergmann/exporter + * @see https://github.com/sebastianbergmann/exporter + */ +class ExportUtil +{ + /** + * Exports a value as a string + * + * The output of this method is similar to the output of print_r(), but + * improved in various aspects: + * + * - NULL is rendered as "null" (instead of "") + * - TRUE is rendered as "true" (instead of "1") + * - FALSE is rendered as "false" (instead of "") + * - Strings are always quoted with single quotes + * - Carriage returns and newlines are normalized to \n + * - Recursion and repeated rendering is treated properly + * + * @param mixed $value + * @param int $indentation The indentation level of the 2nd+ line + * @return string + */ + public static function export($value, $indentation = 0) + { + return self::recursiveExport($value, $indentation); + } + + /** + * Converts an object to an array containing all of its private, protected + * and public properties. + * + * @param mixed $value + * @return array + */ + public static function toArray($value) + { + if (!is_object($value)) { + return (array) $value; + } + + $array = array(); + + foreach ((array) $value as $key => $val) { + // properties are transformed to keys in the following way: + // private $property => "\0Classname\0property" + // protected $property => "\0*\0property" + // public $property => "property" + if (preg_match('/^\0.+\0(.+)$/', $key, $matches)) { + $key = $matches[1]; + } + + // See https://github.com/php/php-src/commit/5721132 + if ($key === "\0gcdata") { + continue; + } + + $array[$key] = $val; + } + + // Some internal classes like SplObjectStorage don't work with the + // above (fast) mechanism nor with reflection in Zend. + // Format the output similarly to print_r() in this case + if ($value instanceof \SplObjectStorage) { + // However, the fast method does work in HHVM, and exposes the + // internal implementation. Hide it again. + if (property_exists('\SplObjectStorage', '__storage')) { + unset($array['__storage']); + } elseif (property_exists('\SplObjectStorage', 'storage')) { + unset($array['storage']); + } + + if (property_exists('\SplObjectStorage', '__key')) { + unset($array['__key']); + } + + foreach ($value as $key => $val) { + $array[spl_object_hash($val)] = array( + 'obj' => $val, + 'inf' => $value->getInfo(), + ); + } + } + + return $array; + } + + /** + * Recursive implementation of export + * + * @param mixed $value The value to export + * @param int $indentation The indentation level of the 2nd+ line + * @param \SebastianBergmann\RecursionContext\Context $processed Previously processed objects + * @return string + * @see SebastianBergmann\Exporter\Exporter::export + */ + protected static function recursiveExport(&$value, $indentation, $processed = null) + { + if ($value === null) { + return 'null'; + } + + if ($value === true) { + return 'true'; + } + + if ($value === false) { + return 'false'; + } + + if (is_float($value) && floatval(intval($value)) === $value) { + return "$value.0"; + } + + if (is_resource($value)) { + return sprintf( + 'resource(%d) of type (%s)', + $value, + get_resource_type($value) + ); + } + + if (is_string($value)) { + // Match for most non printable chars somewhat taking multibyte chars into account + if (preg_match('/[^\x09-\x0d\x20-\xff]/', $value)) { + return 'Binary String: 0x' . bin2hex($value); + } + + return "'" . + str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value) . + "'"; + } + + $whitespace = str_repeat(' ', 4 * $indentation); + + if (!$processed) { + $processed = new Context; + } + + if (is_array($value)) { + if (($key = $processed->contains($value)) !== false) { + return 'Array &' . $key; + } + + $array = $value; + $key = $processed->add($value); + $values = ''; + + if (count($array) > 0) { + foreach ($array as $k => $v) { + $values .= sprintf( + '%s %s => %s' . "\n", + $whitespace, + self::recursiveExport($k, $indentation), + self::recursiveExport($value[$k], $indentation + 1, $processed) + ); + } + + $values = "\n" . $values . $whitespace; + } + + return sprintf('Array &%s (%s)', $key, $values); + } + + if (is_object($value)) { + $class = get_class($value); + + if ($value instanceof ProphecyInterface) { + return sprintf('%s Object (*Prophecy*)', $class); + } elseif ($hash = $processed->contains($value)) { + return sprintf('%s:%s Object', $class, $hash); + } + + $hash = $processed->add($value); + $values = ''; + $array = self::toArray($value); + + if (count($array) > 0) { + foreach ($array as $k => $v) { + $values .= sprintf( + '%s %s => %s' . "\n", + $whitespace, + self::recursiveExport($k, $indentation), + self::recursiveExport($v, $indentation + 1, $processed) + ); + } + + $values = "\n" . $values . $whitespace; + } + + return sprintf('%s:%s Object (%s)', $class, $hash, $values); + } + + return var_export($value, true); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php b/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php new file mode 100644 index 0000000..ba4faff --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php @@ -0,0 +1,99 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Util; + +use Prophecy\Call\Call; + +/** + * String utility. + * + * @author Konstantin Kudryashov + */ +class StringUtil +{ + private $verbose; + + /** + * @param bool $verbose + */ + public function __construct($verbose = true) + { + $this->verbose = $verbose; + } + + /** + * Stringifies any provided value. + * + * @param mixed $value + * @param boolean $exportObject + * + * @return string + */ + public function stringify($value, $exportObject = true) + { + if (is_array($value)) { + if (range(0, count($value) - 1) === array_keys($value)) { + return '['.implode(', ', array_map(array($this, __FUNCTION__), $value)).']'; + } + + $stringify = array($this, __FUNCTION__); + + return '['.implode(', ', array_map(function ($item, $key) use ($stringify) { + return (is_integer($key) ? $key : '"'.$key.'"'). + ' => '.call_user_func($stringify, $item); + }, $value, array_keys($value))).']'; + } + if (is_resource($value)) { + return get_resource_type($value).':'.$value; + } + if (is_object($value)) { + return $exportObject ? ExportUtil::export($value) : sprintf('%s:%s', get_class($value), spl_object_hash($value)); + } + if (true === $value || false === $value) { + return $value ? 'true' : 'false'; + } + if (is_string($value)) { + $str = sprintf('"%s"', str_replace("\n", '\\n', $value)); + + if (!$this->verbose && 50 <= strlen($str)) { + return substr($str, 0, 50).'"...'; + } + + return $str; + } + if (null === $value) { + return 'null'; + } + + return (string) $value; + } + + /** + * Stringifies provided array of calls. + * + * @param Call[] $calls Array of Call instances + * + * @return string + */ + public function stringifyCalls(array $calls) + { + $self = $this; + + return implode(PHP_EOL, array_map(function (Call $call) use ($self) { + return sprintf(' - %s(%s) @ %s', + $call->getMethodName(), + implode(', ', array_map(array($self, 'stringify'), $call->getArguments())), + str_replace(GETCWD().DIRECTORY_SEPARATOR, '', $call->getCallPlace()) + ); + }, $calls)); + } +} diff --git a/vendor/phpunit/php-code-coverage/.gitattributes b/vendor/phpunit/php-code-coverage/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md b/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md new file mode 100644 index 0000000..76a4345 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md @@ -0,0 +1 @@ +Please refer to [https://github.com/sebastianbergmann/phpunit/blob/master/CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/CONTRIBUTING.md) for details on how to contribute to this project. diff --git a/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md b/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..dc8e3b0 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,18 @@ +| Q | A +| --------------------------| --------------- +| php-code-coverage version | x.y.z +| PHP version | x.y.z +| Driver | Xdebug / PHPDBG +| Xdebug version (if used) | x.y.z +| Installation Method | Composer / PHPUnit PHAR +| Usage Method | PHPUnit / other +| PHPUnit version (if used) | x.y.z + + + diff --git a/vendor/phpunit/php-code-coverage/.gitignore b/vendor/phpunit/php-code-coverage/.gitignore new file mode 100644 index 0000000..603bc9e --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.gitignore @@ -0,0 +1,6 @@ +/tests/_files/tmp +/vendor +/composer.lock +/.idea +/.php_cs.cache + diff --git a/vendor/phpunit/php-code-coverage/.php_cs b/vendor/phpunit/php-code-coverage/.php_cs new file mode 100644 index 0000000..cb77f99 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.php_cs @@ -0,0 +1,87 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'align_double_arrow' => true, + 'align_equals' => true + ], + 'blank_line_after_namespace' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'return', + 'throw', + 'try', + ], + ], + 'braces' => true, + 'cast_spaces' => true, + 'concat_space' => ['spacing' => 'one'], + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'line_ending' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'method_argument_space' => true, + 'native_function_invocation' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_closing_tag' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_whitespace' => true, + 'no_unused_imports' => true, + 'no_whitespace_in_blank_line' => true, + 'ordered_imports' => true, + 'phpdoc_align' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_var_without_name' => true, + 'self_accessor' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'ternary_operator_spaces' => true, + 'trim_array_spaces' => true, + 'visibility_required' => true, + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/src') + ->name('*.php') + ); diff --git a/vendor/phpunit/php-code-coverage/.travis.yml b/vendor/phpunit/php-code-coverage/.travis.yml new file mode 100644 index 0000000..b6dfe62 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.travis.yml @@ -0,0 +1,40 @@ +language: php + +sudo: false + +php: + - 7.0 + - 7.1 + - 7.2 + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +env: + matrix: + - DEPENDENCIES="high" + - DEPENDENCIES="low" + global: + - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + +before_install: + - composer self-update + - composer clear-cache + +install: + - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi + - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi + +script: + - if [[ "$DRIVER" = 'phpdbg' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi + - if [[ "$DRIVER" = 'xdebug' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md b/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md new file mode 100644 index 0000000..353b6f6 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-2.2.md @@ -0,0 +1,56 @@ +# Changes in PHP_CodeCoverage 2.2 + +All notable changes of the PHP_CodeCoverage 2.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [2.2.4] - 2015-10-06 + +### Fixed + +* Fixed [#391](https://github.com/sebastianbergmann/php-code-coverage/pull/391): Missing `` tag + +## [2.2.3] - 2015-09-14 + +### Fixed + +* Fixed [#368](https://github.com/sebastianbergmann/php-code-coverage/pull/368): Blacklists and whitelists are not merged when merging data sets +* Fixed [#370](https://github.com/sebastianbergmann/php-code-coverage/issues/370): Confusing statistics for source file that declares a class without methods +* Fixed [#372](https://github.com/sebastianbergmann/php-code-coverage/pull/372): Nested classes and functions are not handled correctly +* Fixed [#382](https://github.com/sebastianbergmann/php-code-coverage/issues/382): Crap4J report generates incorrect XML logfile + +## [2.2.2] - 2015-08-04 + +### Added + +* Reintroduced the `PHP_CodeCoverage_Driver_HHVM` driver as an extension of `PHP_CodeCoverage_Driver_Xdebug` that does not use `xdebug_start_code_coverage()` with options not supported by HHVM + +### Changed + +* Bumped required version of `sebastian/environment` to 1.3.2 for [#365](https://github.com/sebastianbergmann/php-code-coverage/issues/365) + +## [2.2.1] - 2015-08-02 + +### Changed + +* Bumped required version of `sebastian/environment` to 1.3.1 for [#365](https://github.com/sebastianbergmann/php-code-coverage/issues/365) + +## [2.2.0] - 2015-08-01 + +### Added + +* Added a driver for PHPDBG (requires PHP 7) +* Added `PHP_CodeCoverage::setDisableIgnoredLines()` to disable the ignoring of lines using annotations such as `@codeCoverageIgnore` + +### Changed + +* Annotating a method with `@deprecated` now has the same effect as annotating it with `@codeCoverageIgnore` + +### Removed + +* The dedicated driver for HHVM, `PHP_CodeCoverage_Driver_HHVM` has been removed + +[2.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.3...2.2.4 +[2.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.2...2.2.3 +[2.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.1...2.2.2 +[2.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.0...2.2.1 +[2.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.1...2.2.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-3.0.md b/vendor/phpunit/php-code-coverage/ChangeLog-3.0.md new file mode 100644 index 0000000..a39fa8d --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-3.0.md @@ -0,0 +1,31 @@ +# Changes in PHP_CodeCoverage 3.0 + +All notable changes of the PHP_CodeCoverage 3.0 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.0.2] - 2015-11-12 + +### Changed + +* It is now optional that `@deprecated` code is ignored + +## [3.0.1] - 2015-10-06 + +### Fixed + +* Fixed [#391](https://github.com/sebastianbergmann/php-code-coverage/pull/391): Missing `` tag + +## [3.0.0] - 2015-10-02 + +### Changed + +* It is now mandatory to configure a whitelist + +### Removed + +* The blacklist functionality has been removed +* PHP_CodeCoverage is no longer supported on PHP 5.3, PHP 5.4, and PHP 5.5 + +[3.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2...3.0.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-3.1.md b/vendor/phpunit/php-code-coverage/ChangeLog-3.1.md new file mode 100644 index 0000000..f7a0de9 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-3.1.md @@ -0,0 +1,30 @@ +# Changes in PHP_CodeCoverage 3.1 + +All notable changes of the PHP_CodeCoverage 3.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.1.1] - 2016-02-04 + +### Changed + +* Allow version 2.0.x of `sebastian/version` dependency + +## [3.1.0] - 2016-01-11 + +### Added + +* Implemented [#234](https://github.com/sebastianbergmann/php-code-coverage/issues/234): Optionally raise an exception when a specified unit of code is not executed + +### Changed + +* The Clover XML report now contains cyclomatic complexity information +* The Clover XML report now contains method visibility information +* Cleanup and refactoring of various areas of code +* Added missing test cases + +### Removed + +* The functionality controlled by the `mapTestClassNameToCoveredClassName` setting has been removed + +[3.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.1.0...3.1.1 +[3.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0...3.1.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-3.2.md b/vendor/phpunit/php-code-coverage/ChangeLog-3.2.md new file mode 100644 index 0000000..34c65cf --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-3.2.md @@ -0,0 +1,23 @@ +# Changes in PHP_CodeCoverage 3.2 + +All notable changes of the PHP_CodeCoverage 3.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.2.1] - 2016-02-18 + +### Changed + +* Updated dependency information in `composer.json` + +## [3.2.0] - 2016-02-13 + +### Added + +* Added optional check for missing `@covers` annotation when the usage of `@covers` annotations is forced + +### Changed + +* Improved `PHP_CodeCoverage_UnintentionallyCoveredCodeException` message + +[3.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.2.0...3.2.1 +[3.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.1...3.2.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-3.3.md b/vendor/phpunit/php-code-coverage/ChangeLog-3.3.md new file mode 100644 index 0000000..2cf1522 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-3.3.md @@ -0,0 +1,33 @@ +# Changes in PHP_CodeCoverage 3.3 + +All notable changes of the PHP_CodeCoverage 3.3 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.3.3] - 2016-MM-DD + +### Fixed + +* Fixed [#438](https://github.com/sebastianbergmann/php-code-coverage/issues/438): Wrong base directory for Clover reports + +## [3.3.2] - 2016-05-25 + +### Changed + +* The constructor of `PHP_CodeCoverage_Report_Text` now has default values for its parameters + +## [3.3.1] - 2016-04-08 + +### Fixed + +* Fixed handling of lines that contain `declare` statements + +## [3.3.0] - 2016-03-03 + +### Added + +* Added support for whitelisting classes for the unintentionally covered code unit check + +[3.3.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.3.2...3.3.3 +[3.3.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.3.1...3.3.2 +[3.3.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.3.0...3.3.1 +[3.3.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.2...3.3.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-4.0.md b/vendor/phpunit/php-code-coverage/ChangeLog-4.0.md new file mode 100644 index 0000000..30df010 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-4.0.md @@ -0,0 +1,67 @@ +# Changes in PHP_CodeCoverage 4.0 + +All notable changes of the PHP_CodeCoverage 4.0 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [4.0.8] - 2017-04-02 + +* Fixed [#515](https://github.com/sebastianbergmann/php-code-coverage/pull/515): Wrong use of recursive iterator causing duplicate entries in XML coverage report + +## [4.0.7] - 2017-03-01 + +### Changed + +* Cleaned up requirements in `composer.json` + +## [4.0.6] - 2017-02-23 + +### Changed + +* Added support for `phpunit/php-token-stream` 2.0 +* Updated HTML report assets + +## [4.0.5] - 2017-01-20 + +### Fixed + +* Fixed formatting of executed lines percentage for classes in file view + +## [4.0.4] - 2016-12-20 + +### Changed + +* Implemented [#432](https://github.com/sebastianbergmann/php-code-coverage/issues/432): Change how files with no executable lines are displayed in the HTML report + +## [4.0.3] - 2016-11-28 + +### Changed + +* The check for unintentionally covered code is no longer performed for `@medium` and `@large` tests + +## [4.0.2] - 2016-11-01 + +### Fixed + +* Fixed [#440](https://github.com/sebastianbergmann/php-code-coverage/pull/440): Dashboard charts not showing tooltips for data points + +## [4.0.1] - 2016-07-26 + +### Fixed + +* Fixed [#458](https://github.com/sebastianbergmann/php-code-coverage/pull/458): XML report does not know about warning status + +## [4.0.0] - 2016-06-03 + +### Changed + +* This component now uses namespaces + +[4.0.8]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.7...4.0.8 +[4.0.7]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.6...4.0.7 +[4.0.6]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.5...4.0.6 +[4.0.5]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.4...4.0.5 +[4.0.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.3...4.0.4 +[4.0.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.2...4.0.3 +[4.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.1...4.0.2 +[4.0.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0.0...4.0.1 +[4.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.3...4.0.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-5.0.md b/vendor/phpunit/php-code-coverage/ChangeLog-5.0.md new file mode 100644 index 0000000..a1f9152 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-5.0.md @@ -0,0 +1,45 @@ +# Changes in PHP_CodeCoverage 5.0 + +All notable changes of the PHP_CodeCoverage 5.0 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [5.0.4] - 2017-04-02 + +### Added + +* Added `SebastianBergmann\CodeCoverage\Version::id()` method + +### Fixed + +* Fixed [#515](https://github.com/sebastianbergmann/php-code-coverage/pull/515): Wrong use of recursive iterator causing duplicate entries in XML coverage report + +## [5.0.3] - 2017-03-06 + +### Fixed + +* Fixed [#451](https://github.com/sebastianbergmann/php-code-coverage/pull/451): Conflict between HTML report assets and directories named `css`, `fonts`, or `js` +* Fixed [#485](https://github.com/sebastianbergmann/php-code-coverage/issues/485): Large popover contents cannot be viewed + +## [5.0.2] - 2017-03-01 + +### Changed + +* Cleaned up requirements in `composer.json` + +## [5.0.1] - 2017-02-23 + +### Added + +* Implemented [#508](https://github.com/sebastianbergmann/php-code-coverage/pull/508): Support for HackLang's `ENUM` declaration + +## [5.0.0] - 2017-02-03 + +### Removed + +* This component is no longer supported on PHP 5 + +[5.0.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.0.3...5.0.4 +[5.0.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.0.2...5.0.3 +[5.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.0.1...5.0.2 +[5.0.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.0.0...5.0.1 +[5.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/4.0...5.0.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-5.1.md b/vendor/phpunit/php-code-coverage/ChangeLog-5.1.md new file mode 100644 index 0000000..7cf7023 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-5.1.md @@ -0,0 +1,19 @@ +# Changes in PHP_CodeCoverage 5.1 + +All notable changes of the PHP_CodeCoverage 5.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [5.1.1] - 2017-04-12 + +## Fixed + +* Fixed [#420](https://github.com/sebastianbergmann/php-code-coverage/issues/420): Check for unexecuted covered or used code is too strict + +## [5.1.0] - 2017-04-07 + +## Changed + +* Implemented [#516](https://github.com/sebastianbergmann/php-code-coverage/pull/516): Add more information to XML code coverage report + +[5.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.1.0...5.1.1 +[5.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.0...5.1.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-5.2.md b/vendor/phpunit/php-code-coverage/ChangeLog-5.2.md new file mode 100644 index 0000000..caf1013 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-5.2.md @@ -0,0 +1,44 @@ +# Changes in PHP_CodeCoverage 5.2 + +All notable changes of the PHP_CodeCoverage 5.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [5.2.4] - 2017-11-27 + +### Fixed + +* Fixed [#424](https://github.com/sebastianbergmann/php-code-coverage/issues/424): Rest of a function or method is ignored after an anonymous function +* Fixed [#455](https://github.com/sebastianbergmann/php-code-coverage/issues/455): Dashboard does not handle namespaced classes properly +* Fixed [#468](https://github.com/sebastianbergmann/php-code-coverage/issues/468): Global functions are not properly counted +* Fixed [#560](https://github.com/sebastianbergmann/php-code-coverage/issues/560): Uncovered whitelisted files are missing from the report + +## [5.2.3] - 2017-11-03 + +### Fixed + +* Fixed [#540](https://github.com/sebastianbergmann/php-code-coverage/issues/540): Missing attribute `type` in the CSS `` elements +* Fixed [#554](https://github.com/sebastianbergmann/php-code-coverage/pull/554): `Parameter must be an array or an object that implements Countable` + +## [5.2.2] - 2017-08-03 + +## Changed + +* Bumped required versions of dependencies + +## [5.2.1] - 2017-04-21 + +## Changed + +* Version 3 of `sebastian/environment` is now required + +## [5.2.0] - 2017-04-20 + +## Changed + +* Implemented [#518](https://github.com/sebastianbergmann/php-code-coverage/pull/518): Add more information to XML code coverage report + +[5.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2.3...5.2.4 +[5.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2.2...5.2.3 +[5.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2.1...5.2.2 +[5.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2.0...5.2.1 +[5.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.1...5.2.0 + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md b/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md new file mode 100644 index 0000000..ca839b1 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md @@ -0,0 +1,34 @@ +# Changes in PHP_CodeCoverage 5.3 + +All notable changes of the PHP_CodeCoverage 5.3 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [5.3.2] - 2018-04-06 + +### Fixed + +* Fixed [#602](https://github.com/sebastianbergmann/php-code-coverage/pull/602): Regression introduced in version 5.3.1 + +## [5.3.1] - 2018-04-06 + +### Changed + +* `Clover`, `Crap4j`, and `PHP` report writers now raise an exception when their call to `file_put_contents()` fails + +### Fixed + +* Fixed [#559](https://github.com/sebastianbergmann/php-code-coverage/issues/559): Ignored classes and methods are reported as 100% covered + +## [5.3.0] - 2017-12-06 + +### Added + +* Added option to ignore the `forceCoversAnnotation="true"` setting for a single test + +### Fixed + +* Fixed [#564](https://github.com/sebastianbergmann/php-code-coverage/issues/564): `setDisableIgnoredLines(true)` disables more than it should + +[5.3.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.3.1...5.3.2 +[5.3.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.3.0...5.3.1 +[5.3.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2...5.3.0 + diff --git a/vendor/phpunit/php-code-coverage/LICENSE b/vendor/phpunit/php-code-coverage/LICENSE new file mode 100644 index 0000000..9b9787d --- /dev/null +++ b/vendor/phpunit/php-code-coverage/LICENSE @@ -0,0 +1,33 @@ +PHP_CodeCoverage + +Copyright (c) 2009-2017, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-code-coverage/README.md b/vendor/phpunit/php-code-coverage/README.md new file mode 100644 index 0000000..6c401ef --- /dev/null +++ b/vendor/phpunit/php-code-coverage/README.md @@ -0,0 +1,40 @@ +[![Latest Stable Version](https://poser.pugx.org/phpunit/php-code-coverage/v/stable.png)](https://packagist.org/packages/phpunit/php-code-coverage) +[![Build Status](https://travis-ci.org/sebastianbergmann/php-code-coverage.svg?branch=5.3)](https://travis-ci.org/sebastianbergmann/php-code-coverage) + +# SebastianBergmann\CodeCoverage + +**SebastianBergmann\CodeCoverage** is a library that provides collection, processing, and rendering functionality for PHP code coverage information. + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phpunit/php-code-coverage + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phpunit/php-code-coverage + +## Using the SebastianBergmann\CodeCoverage API + +```php +filter()->addDirectoryToWhitelist('/path/to/src'); + +$coverage->start(''); + +// ... + +$coverage->stop(); + +$writer = new \SebastianBergmann\CodeCoverage\Report\Clover; +$writer->process($coverage, '/tmp/clover.xml'); + +$writer = new \SebastianBergmann\CodeCoverage\Report\Html\Facade; +$writer->process($coverage, '/tmp/code-coverage-report'); +``` + diff --git a/vendor/phpunit/php-code-coverage/build.xml b/vendor/phpunit/php-code-coverage/build.xml new file mode 100644 index 0000000..40eeeec --- /dev/null +++ b/vendor/phpunit/php-code-coverage/build.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/composer.json b/vendor/phpunit/php-code-coverage/composer.json new file mode 100644 index 0000000..ed87651 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/composer.json @@ -0,0 +1,55 @@ +{ + "name": "phpunit/php-code-coverage", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "type": "library", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "prefer-stable": true, + "require": { + "php": "^7.0", + "ext-dom": "*", + "ext-xmlwriter": "*", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-token-stream": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + } +} diff --git a/vendor/phpunit/php-code-coverage/phpunit.xml b/vendor/phpunit/php-code-coverage/phpunit.xml new file mode 100644 index 0000000..37e2219 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/phpunit.xml @@ -0,0 +1,21 @@ + + + + tests/tests + + + + + src + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/CodeCoverage.php b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php new file mode 100644 index 0000000..f3e9eaa --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php @@ -0,0 +1,1184 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +use PHPUnit\Framework\TestCase; +use PHPUnit\Runner\PhptTestCase; +use SebastianBergmann\CodeCoverage\Driver\Driver; +use SebastianBergmann\CodeCoverage\Driver\HHVM; +use SebastianBergmann\CodeCoverage\Driver\PHPDBG; +use SebastianBergmann\CodeCoverage\Driver\Xdebug; +use SebastianBergmann\CodeCoverage\Node\Builder; +use SebastianBergmann\CodeCoverage\Node\Directory; +use SebastianBergmann\CodeUnitReverseLookup\Wizard; +use SebastianBergmann\Environment\Runtime; + +/** + * Provides collection functionality for PHP code coverage information. + */ +class CodeCoverage +{ + /** + * @var Driver + */ + private $driver; + + /** + * @var Filter + */ + private $filter; + + /** + * @var Wizard + */ + private $wizard; + + /** + * @var bool + */ + private $cacheTokens = false; + + /** + * @var bool + */ + private $checkForUnintentionallyCoveredCode = false; + + /** + * @var bool + */ + private $forceCoversAnnotation = false; + + /** + * @var bool + */ + private $checkForUnexecutedCoveredCode = false; + + /** + * @var bool + */ + private $checkForMissingCoversAnnotation = false; + + /** + * @var bool + */ + private $addUncoveredFilesFromWhitelist = true; + + /** + * @var bool + */ + private $processUncoveredFilesFromWhitelist = false; + + /** + * @var bool + */ + private $ignoreDeprecatedCode = false; + + /** + * @var mixed + */ + private $currentId; + + /** + * Code coverage data. + * + * @var array + */ + private $data = []; + + /** + * @var array + */ + private $ignoredLines = []; + + /** + * @var bool + */ + private $disableIgnoredLines = false; + + /** + * Test data. + * + * @var array + */ + private $tests = []; + + /** + * @var string[] + */ + private $unintentionallyCoveredSubclassesWhitelist = []; + + /** + * Determine if the data has been initialized or not + * + * @var bool + */ + private $isInitialized = false; + + /** + * Determine whether we need to check for dead and unused code on each test + * + * @var bool + */ + private $shouldCheckForDeadAndUnused = true; + + /** + * @var Directory + */ + private $report; + + /** + * Constructor. + * + * @param Driver $driver + * @param Filter $filter + * + * @throws RuntimeException + */ + public function __construct(Driver $driver = null, Filter $filter = null) + { + if ($driver === null) { + $driver = $this->selectDriver(); + } + + if ($filter === null) { + $filter = new Filter; + } + + $this->driver = $driver; + $this->filter = $filter; + + $this->wizard = new Wizard; + } + + /** + * Returns the code coverage information as a graph of node objects. + * + * @return Directory + */ + public function getReport() + { + if ($this->report === null) { + $builder = new Builder; + + $this->report = $builder->build($this); + } + + return $this->report; + } + + /** + * Clears collected code coverage data. + */ + public function clear() + { + $this->isInitialized = false; + $this->currentId = null; + $this->data = []; + $this->tests = []; + $this->report = null; + } + + /** + * Returns the filter object used. + * + * @return Filter + */ + public function filter() + { + return $this->filter; + } + + /** + * Returns the collected code coverage data. + * Set $raw = true to bypass all filters. + * + * @param bool $raw + * + * @return array + */ + public function getData($raw = false) + { + if (!$raw && $this->addUncoveredFilesFromWhitelist) { + $this->addUncoveredFilesFromWhitelist(); + } + + return $this->data; + } + + /** + * Sets the coverage data. + * + * @param array $data + */ + public function setData(array $data) + { + $this->data = $data; + $this->report = null; + } + + /** + * Returns the test data. + * + * @return array + */ + public function getTests() + { + return $this->tests; + } + + /** + * Sets the test data. + * + * @param array $tests + */ + public function setTests(array $tests) + { + $this->tests = $tests; + } + + /** + * Start collection of code coverage information. + * + * @param mixed $id + * @param bool $clear + * + * @throws InvalidArgumentException + */ + public function start($id, $clear = false) + { + if (!\is_bool($clear)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + if ($clear) { + $this->clear(); + } + + if ($this->isInitialized === false) { + $this->initializeData(); + } + + $this->currentId = $id; + + $this->driver->start($this->shouldCheckForDeadAndUnused); + } + + /** + * Stop collection of code coverage information. + * + * @param bool $append + * @param mixed $linesToBeCovered + * @param array $linesToBeUsed + * @param bool $ignoreForceCoversAnnotation + * + * @return array + * + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + * @throws InvalidArgumentException + */ + public function stop($append = true, $linesToBeCovered = [], array $linesToBeUsed = [], $ignoreForceCoversAnnotation = false) + { + if (!\is_bool($append)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + if (!\is_array($linesToBeCovered) && $linesToBeCovered !== false) { + throw InvalidArgumentException::create( + 2, + 'array or false' + ); + } + + $data = $this->driver->stop(); + $this->append($data, null, $append, $linesToBeCovered, $linesToBeUsed, $ignoreForceCoversAnnotation); + + $this->currentId = null; + + return $data; + } + + /** + * Appends code coverage data. + * + * @param array $data + * @param mixed $id + * @param bool $append + * @param mixed $linesToBeCovered + * @param array $linesToBeUsed + * @param bool $ignoreForceCoversAnnotation + * + * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException + * @throws \SebastianBergmann\CodeCoverage\MissingCoversAnnotationException + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \ReflectionException + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws RuntimeException + */ + public function append(array $data, $id = null, $append = true, $linesToBeCovered = [], array $linesToBeUsed = [], $ignoreForceCoversAnnotation = false) + { + if ($id === null) { + $id = $this->currentId; + } + + if ($id === null) { + throw new RuntimeException; + } + + $this->applyListsFilter($data); + $this->applyIgnoredLinesFilter($data); + $this->initializeFilesThatAreSeenTheFirstTime($data); + + if (!$append) { + return; + } + + if ($id !== 'UNCOVERED_FILES_FROM_WHITELIST') { + $this->applyCoversAnnotationFilter( + $data, + $linesToBeCovered, + $linesToBeUsed, + $ignoreForceCoversAnnotation + ); + } + + if (empty($data)) { + return; + } + + $size = 'unknown'; + $status = null; + + if ($id instanceof TestCase) { + $_size = $id->getSize(); + + if ($_size === \PHPUnit\Util\Test::SMALL) { + $size = 'small'; + } elseif ($_size === \PHPUnit\Util\Test::MEDIUM) { + $size = 'medium'; + } elseif ($_size === \PHPUnit\Util\Test::LARGE) { + $size = 'large'; + } + + $status = $id->getStatus(); + $id = \get_class($id) . '::' . $id->getName(); + } elseif ($id instanceof PhptTestCase) { + $size = 'large'; + $id = $id->getName(); + } + + $this->tests[$id] = ['size' => $size, 'status' => $status]; + + foreach ($data as $file => $lines) { + if (!$this->filter->isFile($file)) { + continue; + } + + foreach ($lines as $k => $v) { + if ($v === Driver::LINE_EXECUTED) { + if (empty($this->data[$file][$k]) || !\in_array($id, $this->data[$file][$k])) { + $this->data[$file][$k][] = $id; + } + } + } + } + + $this->report = null; + } + + /** + * Merges the data from another instance. + * + * @param CodeCoverage $that + */ + public function merge(self $that) + { + $this->filter->setWhitelistedFiles( + \array_merge($this->filter->getWhitelistedFiles(), $that->filter()->getWhitelistedFiles()) + ); + + foreach ($that->data as $file => $lines) { + if (!isset($this->data[$file])) { + if (!$this->filter->isFiltered($file)) { + $this->data[$file] = $lines; + } + + continue; + } + + foreach ($lines as $line => $data) { + if ($data !== null) { + if (!isset($this->data[$file][$line])) { + $this->data[$file][$line] = $data; + } else { + $this->data[$file][$line] = \array_unique( + \array_merge($this->data[$file][$line], $data) + ); + } + } + } + } + + $this->tests = \array_merge($this->tests, $that->getTests()); + $this->report = null; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setCacheTokens($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->cacheTokens = $flag; + } + + /** + * @return bool + */ + public function getCacheTokens() + { + return $this->cacheTokens; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setCheckForUnintentionallyCoveredCode($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->checkForUnintentionallyCoveredCode = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setForceCoversAnnotation($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->forceCoversAnnotation = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setCheckForMissingCoversAnnotation($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->checkForMissingCoversAnnotation = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setCheckForUnexecutedCoveredCode($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->checkForUnexecutedCoveredCode = $flag; + } + + /** + * @deprecated + * + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setMapTestClassNameToCoveredClassName($flag) + { + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setAddUncoveredFilesFromWhitelist($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->addUncoveredFilesFromWhitelist = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setProcessUncoveredFilesFromWhitelist($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->processUncoveredFilesFromWhitelist = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setDisableIgnoredLines($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->disableIgnoredLines = $flag; + } + + /** + * @param bool $flag + * + * @throws InvalidArgumentException + */ + public function setIgnoreDeprecatedCode($flag) + { + if (!\is_bool($flag)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + $this->ignoreDeprecatedCode = $flag; + } + + /** + * @param array $whitelist + */ + public function setUnintentionallyCoveredSubclassesWhitelist(array $whitelist) + { + $this->unintentionallyCoveredSubclassesWhitelist = $whitelist; + } + + /** + * Applies the @covers annotation filtering. + * + * @param array $data + * @param mixed $linesToBeCovered + * @param array $linesToBeUsed + * @param bool $ignoreForceCoversAnnotation + * + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \ReflectionException + * @throws MissingCoversAnnotationException + * @throws UnintentionallyCoveredCodeException + */ + private function applyCoversAnnotationFilter(array &$data, $linesToBeCovered, array $linesToBeUsed, $ignoreForceCoversAnnotation) + { + if ($linesToBeCovered === false || + ($this->forceCoversAnnotation && empty($linesToBeCovered) && !$ignoreForceCoversAnnotation)) { + if ($this->checkForMissingCoversAnnotation) { + throw new MissingCoversAnnotationException; + } + + $data = []; + + return; + } + + if (empty($linesToBeCovered)) { + return; + } + + if ($this->checkForUnintentionallyCoveredCode && + (!$this->currentId instanceof TestCase || + (!$this->currentId->isMedium() && !$this->currentId->isLarge()))) { + $this->performUnintentionallyCoveredCodeCheck($data, $linesToBeCovered, $linesToBeUsed); + } + + if ($this->checkForUnexecutedCoveredCode) { + $this->performUnexecutedCoveredCodeCheck($data, $linesToBeCovered, $linesToBeUsed); + } + + $data = \array_intersect_key($data, $linesToBeCovered); + + foreach (\array_keys($data) as $filename) { + $_linesToBeCovered = \array_flip($linesToBeCovered[$filename]); + $data[$filename] = \array_intersect_key($data[$filename], $_linesToBeCovered); + } + } + + /** + * Applies the whitelist filtering. + * + * @param array $data + */ + private function applyListsFilter(array &$data) + { + foreach (\array_keys($data) as $filename) { + if ($this->filter->isFiltered($filename)) { + unset($data[$filename]); + } + } + } + + /** + * Applies the "ignored lines" filtering. + * + * @param array $data + * + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + */ + private function applyIgnoredLinesFilter(array &$data) + { + foreach (\array_keys($data) as $filename) { + if (!$this->filter->isFile($filename)) { + continue; + } + + foreach ($this->getLinesToBeIgnored($filename) as $line) { + unset($data[$filename][$line]); + } + } + } + + /** + * @param array $data + */ + private function initializeFilesThatAreSeenTheFirstTime(array $data) + { + foreach ($data as $file => $lines) { + if (!isset($this->data[$file]) && $this->filter->isFile($file)) { + $this->data[$file] = []; + + foreach ($lines as $k => $v) { + $this->data[$file][$k] = $v === -2 ? null : []; + } + } + } + } + + /** + * Processes whitelisted files that are not covered. + */ + private function addUncoveredFilesFromWhitelist() + { + $data = []; + $uncoveredFiles = \array_diff( + $this->filter->getWhitelist(), + \array_keys($this->data) + ); + + foreach ($uncoveredFiles as $uncoveredFile) { + if (!\file_exists($uncoveredFile)) { + continue; + } + + $data[$uncoveredFile] = []; + + $lines = \count(\file($uncoveredFile)); + + for ($i = 1; $i <= $lines; $i++) { + $data[$uncoveredFile][$i] = Driver::LINE_NOT_EXECUTED; + } + } + + $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST'); + } + + /** + * Returns the lines of a source file that should be ignored. + * + * @param string $filename + * + * @return array + * + * @throws InvalidArgumentException + */ + private function getLinesToBeIgnored($filename) + { + if (!\is_string($filename)) { + throw InvalidArgumentException::create( + 1, + 'string' + ); + } + + if (isset($this->ignoredLines[$filename])) { + return $this->ignoredLines[$filename]; + } + + $this->ignoredLines[$filename] = []; + + $lines = \file($filename); + + foreach ($lines as $index => $line) { + if (!\trim($line)) { + $this->ignoredLines[$filename][] = $index + 1; + } + } + + if ($this->cacheTokens) { + $tokens = \PHP_Token_Stream_CachingFactory::get($filename); + } else { + $tokens = new \PHP_Token_Stream($filename); + } + + foreach ($tokens->getInterfaces() as $interface) { + $interfaceStartLine = $interface['startLine']; + $interfaceEndLine = $interface['endLine']; + + foreach (\range($interfaceStartLine, $interfaceEndLine) as $line) { + $this->ignoredLines[$filename][] = $line; + } + } + + foreach (\array_merge($tokens->getClasses(), $tokens->getTraits()) as $classOrTrait) { + $classOrTraitStartLine = $classOrTrait['startLine']; + $classOrTraitEndLine = $classOrTrait['endLine']; + + if (empty($classOrTrait['methods'])) { + foreach (\range($classOrTraitStartLine, $classOrTraitEndLine) as $line) { + $this->ignoredLines[$filename][] = $line; + } + + continue; + } + + $firstMethod = \array_shift($classOrTrait['methods']); + $firstMethodStartLine = $firstMethod['startLine']; + $firstMethodEndLine = $firstMethod['endLine']; + $lastMethodEndLine = $firstMethodEndLine; + + do { + $lastMethod = \array_pop($classOrTrait['methods']); + } while ($lastMethod !== null && 0 === \strpos($lastMethod['signature'], 'anonymousFunction')); + + if ($lastMethod !== null) { + $lastMethodEndLine = $lastMethod['endLine']; + } + + foreach (\range($classOrTraitStartLine, $firstMethodStartLine) as $line) { + $this->ignoredLines[$filename][] = $line; + } + + foreach (\range($lastMethodEndLine + 1, $classOrTraitEndLine) as $line) { + $this->ignoredLines[$filename][] = $line; + } + } + + if ($this->disableIgnoredLines) { + $this->ignoredLines[$filename] = array_unique($this->ignoredLines[$filename]); + \sort($this->ignoredLines[$filename]); + + return $this->ignoredLines[$filename]; + } + + $ignore = false; + $stop = false; + + foreach ($tokens->tokens() as $token) { + switch (\get_class($token)) { + case \PHP_Token_COMMENT::class: + case \PHP_Token_DOC_COMMENT::class: + $_token = \trim($token); + $_line = \trim($lines[$token->getLine() - 1]); + + if ($_token === '// @codeCoverageIgnore' || + $_token === '//@codeCoverageIgnore') { + $ignore = true; + $stop = true; + } elseif ($_token === '// @codeCoverageIgnoreStart' || + $_token === '//@codeCoverageIgnoreStart') { + $ignore = true; + } elseif ($_token === '// @codeCoverageIgnoreEnd' || + $_token === '//@codeCoverageIgnoreEnd') { + $stop = true; + } + + if (!$ignore) { + $start = $token->getLine(); + $end = $start + \substr_count($token, "\n"); + + // Do not ignore the first line when there is a token + // before the comment + if (0 !== \strpos($_token, $_line)) { + $start++; + } + + for ($i = $start; $i < $end; $i++) { + $this->ignoredLines[$filename][] = $i; + } + + // A DOC_COMMENT token or a COMMENT token starting with "/*" + // does not contain the final \n character in its text + if (isset($lines[$i - 1]) && 0 === \strpos($_token, '/*') && '*/' === \substr(\trim($lines[$i - 1]), -2)) { + $this->ignoredLines[$filename][] = $i; + } + } + + break; + + case \PHP_Token_INTERFACE::class: + case \PHP_Token_TRAIT::class: + case \PHP_Token_CLASS::class: + case \PHP_Token_FUNCTION::class: + /* @var \PHP_Token_Interface $token */ + + $docblock = $token->getDocblock(); + + $this->ignoredLines[$filename][] = $token->getLine(); + + if (\strpos($docblock, '@codeCoverageIgnore') || ($this->ignoreDeprecatedCode && \strpos($docblock, '@deprecated'))) { + $endLine = $token->getEndLine(); + + for ($i = $token->getLine(); $i <= $endLine; $i++) { + $this->ignoredLines[$filename][] = $i; + } + } + + break; + + case \PHP_Token_ENUM::class: + $this->ignoredLines[$filename][] = $token->getLine(); + + break; + + case \PHP_Token_NAMESPACE::class: + $this->ignoredLines[$filename][] = $token->getEndLine(); + + // Intentional fallthrough + case \PHP_Token_DECLARE::class: + case \PHP_Token_OPEN_TAG::class: + case \PHP_Token_CLOSE_TAG::class: + case \PHP_Token_USE::class: + $this->ignoredLines[$filename][] = $token->getLine(); + + break; + } + + if ($ignore) { + $this->ignoredLines[$filename][] = $token->getLine(); + + if ($stop) { + $ignore = false; + $stop = false; + } + } + } + + $this->ignoredLines[$filename][] = \count($lines) + 1; + + $this->ignoredLines[$filename] = \array_unique( + $this->ignoredLines[$filename] + ); + + $this->ignoredLines[$filename] = array_unique($this->ignoredLines[$filename]); + \sort($this->ignoredLines[$filename]); + + return $this->ignoredLines[$filename]; + } + + /** + * @param array $data + * @param array $linesToBeCovered + * @param array $linesToBeUsed + * + * @throws \ReflectionException + * @throws UnintentionallyCoveredCodeException + */ + private function performUnintentionallyCoveredCodeCheck(array &$data, array $linesToBeCovered, array $linesToBeUsed) + { + $allowedLines = $this->getAllowedLines( + $linesToBeCovered, + $linesToBeUsed + ); + + $unintentionallyCoveredUnits = []; + + foreach ($data as $file => $_data) { + foreach ($_data as $line => $flag) { + if ($flag === 1 && !isset($allowedLines[$file][$line])) { + $unintentionallyCoveredUnits[] = $this->wizard->lookup($file, $line); + } + } + } + + $unintentionallyCoveredUnits = $this->processUnintentionallyCoveredUnits($unintentionallyCoveredUnits); + + if (!empty($unintentionallyCoveredUnits)) { + throw new UnintentionallyCoveredCodeException( + $unintentionallyCoveredUnits + ); + } + } + + /** + * @param array $data + * @param array $linesToBeCovered + * @param array $linesToBeUsed + * + * @throws CoveredCodeNotExecutedException + */ + private function performUnexecutedCoveredCodeCheck(array &$data, array $linesToBeCovered, array $linesToBeUsed) + { + $executedCodeUnits = $this->coverageToCodeUnits($data); + $message = ''; + + foreach ($this->linesToCodeUnits($linesToBeCovered) as $codeUnit) { + if (!\in_array($codeUnit, $executedCodeUnits)) { + $message .= \sprintf( + '- %s is expected to be executed (@covers) but was not executed' . "\n", + $codeUnit + ); + } + } + + foreach ($this->linesToCodeUnits($linesToBeUsed) as $codeUnit) { + if (!\in_array($codeUnit, $executedCodeUnits)) { + $message .= \sprintf( + '- %s is expected to be executed (@uses) but was not executed' . "\n", + $codeUnit + ); + } + } + + if (!empty($message)) { + throw new CoveredCodeNotExecutedException($message); + } + } + + /** + * @param array $linesToBeCovered + * @param array $linesToBeUsed + * + * @return array + */ + private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed) + { + $allowedLines = []; + + foreach (\array_keys($linesToBeCovered) as $file) { + if (!isset($allowedLines[$file])) { + $allowedLines[$file] = []; + } + + $allowedLines[$file] = \array_merge( + $allowedLines[$file], + $linesToBeCovered[$file] + ); + } + + foreach (\array_keys($linesToBeUsed) as $file) { + if (!isset($allowedLines[$file])) { + $allowedLines[$file] = []; + } + + $allowedLines[$file] = \array_merge( + $allowedLines[$file], + $linesToBeUsed[$file] + ); + } + + foreach (\array_keys($allowedLines) as $file) { + $allowedLines[$file] = \array_flip( + \array_unique($allowedLines[$file]) + ); + } + + return $allowedLines; + } + + /** + * @return Driver + * + * @throws RuntimeException + */ + private function selectDriver() + { + $runtime = new Runtime; + + if (!$runtime->canCollectCodeCoverage()) { + throw new RuntimeException('No code coverage driver available'); + } + + if ($runtime->isHHVM()) { + return new HHVM; + } + + if ($runtime->isPHPDBG()) { + return new PHPDBG; + } + + return new Xdebug; + } + + /** + * @param array $unintentionallyCoveredUnits + * + * @return array + * + * @throws \ReflectionException + */ + private function processUnintentionallyCoveredUnits(array $unintentionallyCoveredUnits) + { + $unintentionallyCoveredUnits = \array_unique($unintentionallyCoveredUnits); + \sort($unintentionallyCoveredUnits); + + foreach (\array_keys($unintentionallyCoveredUnits) as $k => $v) { + $unit = \explode('::', $unintentionallyCoveredUnits[$k]); + + if (\count($unit) !== 2) { + continue; + } + + $class = new \ReflectionClass($unit[0]); + + foreach ($this->unintentionallyCoveredSubclassesWhitelist as $whitelisted) { + if ($class->isSubclassOf($whitelisted)) { + unset($unintentionallyCoveredUnits[$k]); + + break; + } + } + } + + return \array_values($unintentionallyCoveredUnits); + } + + /** + * If we are processing uncovered files from whitelist, + * we can initialize the data before we start to speed up the tests + * + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + */ + protected function initializeData() + { + $this->isInitialized = true; + + if ($this->processUncoveredFilesFromWhitelist) { + $this->shouldCheckForDeadAndUnused = false; + + $this->driver->start(true); + + foreach ($this->filter->getWhitelist() as $file) { + if ($this->filter->isFile($file)) { + include_once($file); + } + } + + $data = []; + $coverage = $this->driver->stop(); + + foreach ($coverage as $file => $fileCoverage) { + if ($this->filter->isFiltered($file)) { + continue; + } + + foreach (\array_keys($fileCoverage) as $key) { + if ($fileCoverage[$key] === Driver::LINE_EXECUTED) { + $fileCoverage[$key] = Driver::LINE_NOT_EXECUTED; + } + } + + $data[$file] = $fileCoverage; + } + + $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST'); + } + } + + /** + * @param array $data + * + * @return array + */ + private function coverageToCodeUnits(array $data) + { + $codeUnits = []; + + foreach ($data as $filename => $lines) { + foreach ($lines as $line => $flag) { + if ($flag === 1) { + $codeUnits[] = $this->wizard->lookup($filename, $line); + } + } + } + + return \array_unique($codeUnits); + } + + /** + * @param array $data + * + * @return array + */ + private function linesToCodeUnits(array $data) + { + $codeUnits = []; + + foreach ($data as $filename => $lines) { + foreach ($lines as $line) { + $codeUnits[] = $this->wizard->lookup($filename, $line); + } + } + + return \array_unique($codeUnits); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/Driver.php b/vendor/phpunit/php-code-coverage/src/Driver/Driver.php new file mode 100644 index 0000000..bdd1b97 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/Driver.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Driver; + +/** + * Interface for code coverage drivers. + */ +interface Driver +{ + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + const LINE_EXECUTED = 1; + + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + const LINE_NOT_EXECUTED = -1; + + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + const LINE_NOT_EXECUTABLE = -2; + + /** + * Start collection of code coverage information. + * + * @param bool $determineUnusedAndDead + */ + public function start($determineUnusedAndDead = true); + + /** + * Stop collection of code coverage information. + * + * @return array + */ + public function stop(); +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/HHVM.php b/vendor/phpunit/php-code-coverage/src/Driver/HHVM.php new file mode 100644 index 0000000..e8cdc2a --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/HHVM.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Driver; + +/** + * Driver for HHVM's code coverage functionality. + * + * @codeCoverageIgnore + */ +class HHVM extends Xdebug +{ + /** + * Start collection of code coverage information. + * + * @param bool $determineUnusedAndDead + */ + public function start($determineUnusedAndDead = true) + { + \xdebug_start_code_coverage(); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php b/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php new file mode 100644 index 0000000..71b9559 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Driver; + +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Driver for PHPDBG's code coverage functionality. + * + * @codeCoverageIgnore + */ +class PHPDBG implements Driver +{ + /** + * Constructor. + */ + public function __construct() + { + if (PHP_SAPI !== 'phpdbg') { + throw new RuntimeException( + 'This driver requires the PHPDBG SAPI' + ); + } + + if (!\function_exists('phpdbg_start_oplog')) { + throw new RuntimeException( + 'This build of PHPDBG does not support code coverage' + ); + } + } + + /** + * Start collection of code coverage information. + * + * @param bool $determineUnusedAndDead + */ + public function start($determineUnusedAndDead = true) + { + phpdbg_start_oplog(); + } + + /** + * Stop collection of code coverage information. + * + * @return array + */ + public function stop() + { + static $fetchedLines = []; + + $dbgData = phpdbg_end_oplog(); + + if ($fetchedLines == []) { + $sourceLines = phpdbg_get_executable(); + } else { + $newFiles = \array_diff( + \get_included_files(), + \array_keys($fetchedLines) + ); + + if ($newFiles) { + $sourceLines = phpdbg_get_executable( + ['files' => $newFiles] + ); + } else { + $sourceLines = []; + } + } + + foreach ($sourceLines as $file => $lines) { + foreach ($lines as $lineNo => $numExecuted) { + $sourceLines[$file][$lineNo] = self::LINE_NOT_EXECUTED; + } + } + + $fetchedLines = \array_merge($fetchedLines, $sourceLines); + + return $this->detectExecutedLines($fetchedLines, $dbgData); + } + + /** + * Convert phpdbg based data into the format CodeCoverage expects + * + * @param array $sourceLines + * @param array $dbgData + * + * @return array + */ + private function detectExecutedLines(array $sourceLines, array $dbgData) + { + foreach ($dbgData as $file => $coveredLines) { + foreach ($coveredLines as $lineNo => $numExecuted) { + // phpdbg also reports $lineNo=0 when e.g. exceptions get thrown. + // make sure we only mark lines executed which are actually executable. + if (isset($sourceLines[$file][$lineNo])) { + $sourceLines[$file][$lineNo] = self::LINE_EXECUTED; + } + } + } + + return $sourceLines; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php b/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php new file mode 100644 index 0000000..208ae2b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Driver; + +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Driver for Xdebug's code coverage functionality. + * + * @codeCoverageIgnore + */ +class Xdebug implements Driver +{ + /** + * Cache the number of lines for each file + * + * @var array + */ + private $cacheNumLines = []; + + /** + * Constructor. + */ + public function __construct() + { + if (!\extension_loaded('xdebug')) { + throw new RuntimeException('This driver requires Xdebug'); + } + + if (\version_compare(\phpversion('xdebug'), '2.2.1', '>=') && + !\ini_get('xdebug.coverage_enable')) { + throw new RuntimeException( + 'xdebug.coverage_enable=On has to be set in php.ini' + ); + } + } + + /** + * Start collection of code coverage information. + * + * @param bool $determineUnusedAndDead + */ + public function start($determineUnusedAndDead = true) + { + if ($determineUnusedAndDead) { + \xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); + } else { + \xdebug_start_code_coverage(); + } + } + + /** + * Stop collection of code coverage information. + * + * @return array + */ + public function stop() + { + $data = \xdebug_get_code_coverage(); + \xdebug_stop_code_coverage(); + + return $this->cleanup($data); + } + + /** + * @param array $data + * + * @return array + */ + private function cleanup(array $data) + { + foreach (\array_keys($data) as $file) { + unset($data[$file][0]); + + if (\strpos($file, 'xdebug://debug-eval') !== 0 && \file_exists($file)) { + $numLines = $this->getNumberOfLinesInFile($file); + + foreach (\array_keys($data[$file]) as $line) { + if ($line > $numLines) { + unset($data[$file][$line]); + } + } + } + } + + return $data; + } + + /** + * @param string $file + * + * @return int + */ + private function getNumberOfLinesInFile($file) + { + if (!isset($this->cacheNumLines[$file])) { + $buffer = \file_get_contents($file); + $lines = \substr_count($buffer, "\n"); + + if (\substr($buffer, -1) !== "\n") { + $lines++; + } + + $this->cacheNumLines[$file] = $lines; + } + + return $this->cacheNumLines[$file]; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php b/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php new file mode 100644 index 0000000..ca28a23 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when covered code is not executed. + */ +class CoveredCodeNotExecutedException extends RuntimeException +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/Exception.php b/vendor/phpunit/php-code-coverage/src/Exception/Exception.php new file mode 100644 index 0000000..a3ba4c4 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/Exception.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception interface for php-code-coverage component. + */ +interface Exception +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php b/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..1c63261 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +class InvalidArgumentException extends \InvalidArgumentException implements Exception +{ + /** + * @param int $argument + * @param string $type + * @param mixed $value + * + * @return InvalidArgumentException + */ + public static function create($argument, $type, $value = null) + { + $stack = \debug_backtrace(0); + + return new self( + \sprintf( + 'Argument #%d%sof %s::%s() must be a %s', + $argument, + $value !== null ? ' (' . \gettype($value) . '#' . $value . ')' : ' (No Value) ', + $stack[1]['class'], + $stack[1]['function'], + $type + ) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php b/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php new file mode 100644 index 0000000..7bc5cf3 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when @covers must be used but is not. + */ +class MissingCoversAnnotationException extends RuntimeException +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php b/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php new file mode 100644 index 0000000..c143db7 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +class RuntimeException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php b/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php new file mode 100644 index 0000000..3ea542b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when code is unintentionally covered. + */ +class UnintentionallyCoveredCodeException extends RuntimeException +{ + /** + * @var array + */ + private $unintentionallyCoveredUnits = []; + + /** + * @param array $unintentionallyCoveredUnits + */ + public function __construct(array $unintentionallyCoveredUnits) + { + $this->unintentionallyCoveredUnits = $unintentionallyCoveredUnits; + + parent::__construct($this->toString()); + } + + /** + * @return array + */ + public function getUnintentionallyCoveredUnits() + { + return $this->unintentionallyCoveredUnits; + } + + /** + * @return string + */ + private function toString() + { + $message = ''; + + foreach ($this->unintentionallyCoveredUnits as $unit) { + $message .= '- ' . $unit . "\n"; + } + + return $message; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Filter.php b/vendor/phpunit/php-code-coverage/src/Filter.php new file mode 100644 index 0000000..3d99abb --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Filter.php @@ -0,0 +1,173 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +/** + * Filter for whitelisting of code coverage information. + */ +class Filter +{ + /** + * Source files that are whitelisted. + * + * @var array + */ + private $whitelistedFiles = []; + + /** + * Adds a directory to the whitelist (recursively). + * + * @param string $directory + * @param string $suffix + * @param string $prefix + */ + public function addDirectoryToWhitelist($directory, $suffix = '.php', $prefix = '') + { + $facade = new \File_Iterator_Facade; + $files = $facade->getFilesAsArray($directory, $suffix, $prefix); + + foreach ($files as $file) { + $this->addFileToWhitelist($file); + } + } + + /** + * Adds a file to the whitelist. + * + * @param string $filename + */ + public function addFileToWhitelist($filename) + { + $this->whitelistedFiles[\realpath($filename)] = true; + } + + /** + * Adds files to the whitelist. + * + * @param array $files + */ + public function addFilesToWhitelist(array $files) + { + foreach ($files as $file) { + $this->addFileToWhitelist($file); + } + } + + /** + * Removes a directory from the whitelist (recursively). + * + * @param string $directory + * @param string $suffix + * @param string $prefix + */ + public function removeDirectoryFromWhitelist($directory, $suffix = '.php', $prefix = '') + { + $facade = new \File_Iterator_Facade; + $files = $facade->getFilesAsArray($directory, $suffix, $prefix); + + foreach ($files as $file) { + $this->removeFileFromWhitelist($file); + } + } + + /** + * Removes a file from the whitelist. + * + * @param string $filename + */ + public function removeFileFromWhitelist($filename) + { + $filename = \realpath($filename); + + unset($this->whitelistedFiles[$filename]); + } + + /** + * Checks whether a filename is a real filename. + * + * @param string $filename + * + * @return bool + */ + public function isFile($filename) + { + if ($filename == '-' || + \strpos($filename, 'vfs://') === 0 || + \strpos($filename, 'xdebug://debug-eval') !== false || + \strpos($filename, 'eval()\'d code') !== false || + \strpos($filename, 'runtime-created function') !== false || + \strpos($filename, 'runkit created function') !== false || + \strpos($filename, 'assert code') !== false || + \strpos($filename, 'regexp code') !== false) { + return false; + } + + return \file_exists($filename); + } + + /** + * Checks whether or not a file is filtered. + * + * @param string $filename + * + * @return bool + */ + public function isFiltered($filename) + { + if (!$this->isFile($filename)) { + return true; + } + + $filename = \realpath($filename); + + return !isset($this->whitelistedFiles[$filename]); + } + + /** + * Returns the list of whitelisted files. + * + * @return array + */ + public function getWhitelist() + { + return \array_keys($this->whitelistedFiles); + } + + /** + * Returns whether this filter has a whitelist. + * + * @return bool + */ + public function hasWhitelist() + { + return !empty($this->whitelistedFiles); + } + + /** + * Returns the whitelisted files. + * + * @return array + */ + public function getWhitelistedFiles() + { + return $this->whitelistedFiles; + } + + /** + * Sets the whitelisted files. + * + * @param array $whitelistedFiles + */ + public function setWhitelistedFiles($whitelistedFiles) + { + $this->whitelistedFiles = $whitelistedFiles; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php b/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php new file mode 100644 index 0000000..e8f08cb --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php @@ -0,0 +1,404 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\Util; + +/** + * Base class for nodes in the code coverage information tree. + */ +abstract class AbstractNode implements \Countable +{ + /** + * @var string + */ + private $name; + + /** + * @var string + */ + private $path; + + /** + * @var array + */ + private $pathArray; + + /** + * @var AbstractNode + */ + private $parent; + + /** + * @var string + */ + private $id; + + /** + * Constructor. + * + * @param string $name + * @param AbstractNode $parent + */ + public function __construct($name, self $parent = null) + { + if (\substr($name, -1) == '/') { + $name = \substr($name, 0, -1); + } + + $this->name = $name; + $this->parent = $parent; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @return string + */ + public function getId() + { + if ($this->id === null) { + $parent = $this->getParent(); + + if ($parent === null) { + $this->id = 'index'; + } else { + $parentId = $parent->getId(); + + if ($parentId == 'index') { + $this->id = \str_replace(':', '_', $this->name); + } else { + $this->id = $parentId . '/' . $this->name; + } + } + } + + return $this->id; + } + + /** + * @return string + */ + public function getPath() + { + if ($this->path === null) { + if ($this->parent === null || $this->parent->getPath() === null || $this->parent->getPath() === false) { + $this->path = $this->name; + } else { + $this->path = $this->parent->getPath() . '/' . $this->name; + } + } + + return $this->path; + } + + /** + * @return array + */ + public function getPathAsArray() + { + if ($this->pathArray === null) { + if ($this->parent === null) { + $this->pathArray = []; + } else { + $this->pathArray = $this->parent->getPathAsArray(); + } + + $this->pathArray[] = $this; + } + + return $this->pathArray; + } + + /** + * @return AbstractNode + */ + public function getParent() + { + return $this->parent; + } + + /** + * Returns the percentage of classes that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedClassesPercent($asString = true) + { + return Util::percent( + $this->getNumTestedClasses(), + $this->getNumClasses(), + $asString + ); + } + + /** + * Returns the percentage of traits that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedTraitsPercent($asString = true) + { + return Util::percent( + $this->getNumTestedTraits(), + $this->getNumTraits(), + $asString + ); + } + + /** + * Returns the percentage of classes and traits that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedClassesAndTraitsPercent($asString = true) + { + return Util::percent( + $this->getNumTestedClassesAndTraits(), + $this->getNumClassesAndTraits(), + $asString + ); + } + + /** + * Returns the percentage of functions that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedFunctionsPercent($asString = true) + { + return Util::percent( + $this->getNumTestedFunctions(), + $this->getNumFunctions(), + $asString + ); + } + + /** + * Returns the percentage of methods that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedMethodsPercent($asString = true) + { + return Util::percent( + $this->getNumTestedMethods(), + $this->getNumMethods(), + $asString + ); + } + + /** + * Returns the percentage of functions and methods that has been tested. + * + * @param bool $asString + * + * @return int + */ + public function getTestedFunctionsAndMethodsPercent($asString = true) + { + return Util::percent( + $this->getNumTestedFunctionsAndMethods(), + $this->getNumFunctionsAndMethods(), + $asString + ); + } + + /** + * Returns the percentage of executed lines. + * + * @param bool $asString + * + * @return int + */ + public function getLineExecutedPercent($asString = true) + { + return Util::percent( + $this->getNumExecutedLines(), + $this->getNumExecutableLines(), + $asString + ); + } + + /** + * Returns the number of classes and traits. + * + * @return int + */ + public function getNumClassesAndTraits() + { + return $this->getNumClasses() + $this->getNumTraits(); + } + + /** + * Returns the number of tested classes and traits. + * + * @return int + */ + public function getNumTestedClassesAndTraits() + { + return $this->getNumTestedClasses() + $this->getNumTestedTraits(); + } + + /** + * Returns the classes and traits of this node. + * + * @return array + */ + public function getClassesAndTraits() + { + return \array_merge($this->getClasses(), $this->getTraits()); + } + + /** + * Returns the number of functions and methods. + * + * @return int + */ + public function getNumFunctionsAndMethods() + { + return $this->getNumFunctions() + $this->getNumMethods(); + } + + /** + * Returns the number of tested functions and methods. + * + * @return int + */ + public function getNumTestedFunctionsAndMethods() + { + return $this->getNumTestedFunctions() + $this->getNumTestedMethods(); + } + + /** + * Returns the functions and methods of this node. + * + * @return array + */ + public function getFunctionsAndMethods() + { + return \array_merge($this->getFunctions(), $this->getMethods()); + } + + /** + * Returns the classes of this node. + * + * @return array + */ + abstract public function getClasses(); + + /** + * Returns the traits of this node. + * + * @return array + */ + abstract public function getTraits(); + + /** + * Returns the functions of this node. + * + * @return array + */ + abstract public function getFunctions(); + + /** + * Returns the LOC/CLOC/NCLOC of this node. + * + * @return array + */ + abstract public function getLinesOfCode(); + + /** + * Returns the number of executable lines. + * + * @return int + */ + abstract public function getNumExecutableLines(); + + /** + * Returns the number of executed lines. + * + * @return int + */ + abstract public function getNumExecutedLines(); + + /** + * Returns the number of classes. + * + * @return int + */ + abstract public function getNumClasses(); + + /** + * Returns the number of tested classes. + * + * @return int + */ + abstract public function getNumTestedClasses(); + + /** + * Returns the number of traits. + * + * @return int + */ + abstract public function getNumTraits(); + + /** + * Returns the number of tested traits. + * + * @return int + */ + abstract public function getNumTestedTraits(); + + /** + * Returns the number of methods. + * + * @return int + */ + abstract public function getNumMethods(); + + /** + * Returns the number of tested methods. + * + * @return int + */ + abstract public function getNumTestedMethods(); + + /** + * Returns the number of functions. + * + * @return int + */ + abstract public function getNumFunctions(); + + /** + * Returns the number of tested functions. + * + * @return int + */ + abstract public function getNumTestedFunctions(); +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Builder.php b/vendor/phpunit/php-code-coverage/src/Node/Builder.php new file mode 100644 index 0000000..56541d5 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Builder.php @@ -0,0 +1,245 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\CodeCoverage; + +class Builder +{ + /** + * @param CodeCoverage $coverage + * + * @return Directory + */ + public function build(CodeCoverage $coverage) + { + $files = $coverage->getData(); + $commonPath = $this->reducePaths($files); + $root = new Directory( + $commonPath, + null + ); + + $this->addItems( + $root, + $this->buildDirectoryStructure($files), + $coverage->getTests(), + $coverage->getCacheTokens() + ); + + return $root; + } + + /** + * @param Directory $root + * @param array $items + * @param array $tests + * @param bool $cacheTokens + */ + private function addItems(Directory $root, array $items, array $tests, $cacheTokens) + { + foreach ($items as $key => $value) { + if (\substr($key, -2) == '/f') { + $key = \substr($key, 0, -2); + + if (\file_exists($root->getPath() . DIRECTORY_SEPARATOR . $key)) { + $root->addFile($key, $value, $tests, $cacheTokens); + } + } else { + $child = $root->addDirectory($key); + $this->addItems($child, $value, $tests, $cacheTokens); + } + } + } + + /** + * Builds an array representation of the directory structure. + * + * For instance, + * + * + * Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + * + * is transformed into + * + * + * Array + * ( + * [.] => Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * ) + * + * + * @param array $files + * + * @return array + */ + private function buildDirectoryStructure($files) + { + $result = []; + + foreach ($files as $path => $file) { + $path = \explode('/', $path); + $pointer = &$result; + $max = \count($path); + + for ($i = 0; $i < $max; $i++) { + if ($i == ($max - 1)) { + $type = '/f'; + } else { + $type = ''; + } + + $pointer = &$pointer[$path[$i] . $type]; + } + + $pointer = $file; + } + + return $result; + } + + /** + * Reduces the paths by cutting the longest common start path. + * + * For instance, + * + * + * Array + * ( + * [/home/sb/Money/Money.php] => Array + * ( + * ... + * ) + * + * [/home/sb/Money/MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + * + * is reduced to + * + * + * Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + * + * @param array $files + * + * @return string + */ + private function reducePaths(&$files) + { + if (empty($files)) { + return '.'; + } + + $commonPath = ''; + $paths = \array_keys($files); + + if (\count($files) == 1) { + $commonPath = \dirname($paths[0]) . '/'; + $files[\basename($paths[0])] = $files[$paths[0]]; + + unset($files[$paths[0]]); + + return $commonPath; + } + + $max = \count($paths); + + for ($i = 0; $i < $max; $i++) { + // strip phar:// prefixes + if (\strpos($paths[$i], 'phar://') === 0) { + $paths[$i] = \substr($paths[$i], 7); + $paths[$i] = \strtr($paths[$i], '/', DIRECTORY_SEPARATOR); + } + $paths[$i] = \explode(DIRECTORY_SEPARATOR, $paths[$i]); + + if (empty($paths[$i][0])) { + $paths[$i][0] = DIRECTORY_SEPARATOR; + } + } + + $done = false; + $max = \count($paths); + + while (!$done) { + for ($i = 0; $i < $max - 1; $i++) { + if (!isset($paths[$i][0]) || + !isset($paths[$i + 1][0]) || + $paths[$i][0] != $paths[$i + 1][0]) { + $done = true; + + break; + } + } + + if (!$done) { + $commonPath .= $paths[0][0]; + + if ($paths[0][0] != DIRECTORY_SEPARATOR) { + $commonPath .= DIRECTORY_SEPARATOR; + } + + for ($i = 0; $i < $max; $i++) { + \array_shift($paths[$i]); + } + } + } + + $original = \array_keys($files); + $max = \count($original); + + for ($i = 0; $i < $max; $i++) { + $files[\implode('/', $paths[$i])] = $files[$original[$i]]; + unset($files[$original[$i]]); + } + + \ksort($files); + + return \substr($commonPath, 0, -1); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Directory.php b/vendor/phpunit/php-code-coverage/src/Node/Directory.php new file mode 100644 index 0000000..3c95d28 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Directory.php @@ -0,0 +1,483 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\InvalidArgumentException; + +/** + * Represents a directory in the code coverage information tree. + */ +class Directory extends AbstractNode implements \IteratorAggregate +{ + /** + * @var AbstractNode[] + */ + private $children = []; + + /** + * @var Directory[] + */ + private $directories = []; + + /** + * @var File[] + */ + private $files = []; + + /** + * @var array + */ + private $classes; + + /** + * @var array + */ + private $traits; + + /** + * @var array + */ + private $functions; + + /** + * @var array + */ + private $linesOfCode = null; + + /** + * @var int + */ + private $numFiles = -1; + + /** + * @var int + */ + private $numExecutableLines = -1; + + /** + * @var int + */ + private $numExecutedLines = -1; + + /** + * @var int + */ + private $numClasses = -1; + + /** + * @var int + */ + private $numTestedClasses = -1; + + /** + * @var int + */ + private $numTraits = -1; + + /** + * @var int + */ + private $numTestedTraits = -1; + + /** + * @var int + */ + private $numMethods = -1; + + /** + * @var int + */ + private $numTestedMethods = -1; + + /** + * @var int + */ + private $numFunctions = -1; + + /** + * @var int + */ + private $numTestedFunctions = -1; + + /** + * Returns the number of files in/under this node. + * + * @return int + */ + public function count() + { + if ($this->numFiles == -1) { + $this->numFiles = 0; + + foreach ($this->children as $child) { + $this->numFiles += \count($child); + } + } + + return $this->numFiles; + } + + /** + * Returns an iterator for this node. + * + * @return \RecursiveIteratorIterator + */ + public function getIterator() + { + return new \RecursiveIteratorIterator( + new Iterator($this), + \RecursiveIteratorIterator::SELF_FIRST + ); + } + + /** + * Adds a new directory. + * + * @param string $name + * + * @return Directory + */ + public function addDirectory($name) + { + $directory = new self($name, $this); + + $this->children[] = $directory; + $this->directories[] = &$this->children[\count($this->children) - 1]; + + return $directory; + } + + /** + * Adds a new file. + * + * @param string $name + * @param array $coverageData + * @param array $testData + * @param bool $cacheTokens + * + * @return File + * + * @throws InvalidArgumentException + */ + public function addFile($name, array $coverageData, array $testData, $cacheTokens) + { + $file = new File( + $name, + $this, + $coverageData, + $testData, + $cacheTokens + ); + + $this->children[] = $file; + $this->files[] = &$this->children[\count($this->children) - 1]; + + $this->numExecutableLines = -1; + $this->numExecutedLines = -1; + + return $file; + } + + /** + * Returns the directories in this directory. + * + * @return array + */ + public function getDirectories() + { + return $this->directories; + } + + /** + * Returns the files in this directory. + * + * @return array + */ + public function getFiles() + { + return $this->files; + } + + /** + * Returns the child nodes of this node. + * + * @return array + */ + public function getChildNodes() + { + return $this->children; + } + + /** + * Returns the classes of this node. + * + * @return array + */ + public function getClasses() + { + if ($this->classes === null) { + $this->classes = []; + + foreach ($this->children as $child) { + $this->classes = \array_merge( + $this->classes, + $child->getClasses() + ); + } + } + + return $this->classes; + } + + /** + * Returns the traits of this node. + * + * @return array + */ + public function getTraits() + { + if ($this->traits === null) { + $this->traits = []; + + foreach ($this->children as $child) { + $this->traits = \array_merge( + $this->traits, + $child->getTraits() + ); + } + } + + return $this->traits; + } + + /** + * Returns the functions of this node. + * + * @return array + */ + public function getFunctions() + { + if ($this->functions === null) { + $this->functions = []; + + foreach ($this->children as $child) { + $this->functions = \array_merge( + $this->functions, + $child->getFunctions() + ); + } + } + + return $this->functions; + } + + /** + * Returns the LOC/CLOC/NCLOC of this node. + * + * @return array + */ + public function getLinesOfCode() + { + if ($this->linesOfCode === null) { + $this->linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0]; + + foreach ($this->children as $child) { + $linesOfCode = $child->getLinesOfCode(); + + $this->linesOfCode['loc'] += $linesOfCode['loc']; + $this->linesOfCode['cloc'] += $linesOfCode['cloc']; + $this->linesOfCode['ncloc'] += $linesOfCode['ncloc']; + } + } + + return $this->linesOfCode; + } + + /** + * Returns the number of executable lines. + * + * @return int + */ + public function getNumExecutableLines() + { + if ($this->numExecutableLines == -1) { + $this->numExecutableLines = 0; + + foreach ($this->children as $child) { + $this->numExecutableLines += $child->getNumExecutableLines(); + } + } + + return $this->numExecutableLines; + } + + /** + * Returns the number of executed lines. + * + * @return int + */ + public function getNumExecutedLines() + { + if ($this->numExecutedLines == -1) { + $this->numExecutedLines = 0; + + foreach ($this->children as $child) { + $this->numExecutedLines += $child->getNumExecutedLines(); + } + } + + return $this->numExecutedLines; + } + + /** + * Returns the number of classes. + * + * @return int + */ + public function getNumClasses() + { + if ($this->numClasses == -1) { + $this->numClasses = 0; + + foreach ($this->children as $child) { + $this->numClasses += $child->getNumClasses(); + } + } + + return $this->numClasses; + } + + /** + * Returns the number of tested classes. + * + * @return int + */ + public function getNumTestedClasses() + { + if ($this->numTestedClasses == -1) { + $this->numTestedClasses = 0; + + foreach ($this->children as $child) { + $this->numTestedClasses += $child->getNumTestedClasses(); + } + } + + return $this->numTestedClasses; + } + + /** + * Returns the number of traits. + * + * @return int + */ + public function getNumTraits() + { + if ($this->numTraits == -1) { + $this->numTraits = 0; + + foreach ($this->children as $child) { + $this->numTraits += $child->getNumTraits(); + } + } + + return $this->numTraits; + } + + /** + * Returns the number of tested traits. + * + * @return int + */ + public function getNumTestedTraits() + { + if ($this->numTestedTraits == -1) { + $this->numTestedTraits = 0; + + foreach ($this->children as $child) { + $this->numTestedTraits += $child->getNumTestedTraits(); + } + } + + return $this->numTestedTraits; + } + + /** + * Returns the number of methods. + * + * @return int + */ + public function getNumMethods() + { + if ($this->numMethods == -1) { + $this->numMethods = 0; + + foreach ($this->children as $child) { + $this->numMethods += $child->getNumMethods(); + } + } + + return $this->numMethods; + } + + /** + * Returns the number of tested methods. + * + * @return int + */ + public function getNumTestedMethods() + { + if ($this->numTestedMethods == -1) { + $this->numTestedMethods = 0; + + foreach ($this->children as $child) { + $this->numTestedMethods += $child->getNumTestedMethods(); + } + } + + return $this->numTestedMethods; + } + + /** + * Returns the number of functions. + * + * @return int + */ + public function getNumFunctions() + { + if ($this->numFunctions == -1) { + $this->numFunctions = 0; + + foreach ($this->children as $child) { + $this->numFunctions += $child->getNumFunctions(); + } + } + + return $this->numFunctions; + } + + /** + * Returns the number of tested functions. + * + * @return int + */ + public function getNumTestedFunctions() + { + if ($this->numTestedFunctions == -1) { + $this->numTestedFunctions = 0; + + foreach ($this->children as $child) { + $this->numTestedFunctions += $child->getNumTestedFunctions(); + } + } + + return $this->numTestedFunctions; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/File.php b/vendor/phpunit/php-code-coverage/src/Node/File.php new file mode 100644 index 0000000..7a8587f --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/File.php @@ -0,0 +1,744 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\InvalidArgumentException; + +/** + * Represents a file in the code coverage information tree. + */ +class File extends AbstractNode +{ + /** + * @var array + */ + private $coverageData; + + /** + * @var array + */ + private $testData; + + /** + * @var int + */ + private $numExecutableLines = 0; + + /** + * @var int + */ + private $numExecutedLines = 0; + + /** + * @var array + */ + private $classes = []; + + /** + * @var array + */ + private $traits = []; + + /** + * @var array + */ + private $functions = []; + + /** + * @var array + */ + private $linesOfCode = []; + + /** + * @var int + */ + private $numClasses = null; + + /** + * @var int + */ + private $numTestedClasses = 0; + + /** + * @var int + */ + private $numTraits = null; + + /** + * @var int + */ + private $numTestedTraits = 0; + + /** + * @var int + */ + private $numMethods = null; + + /** + * @var int + */ + private $numTestedMethods = null; + + /** + * @var int + */ + private $numTestedFunctions = null; + + /** + * @var array + */ + private $startLines = []; + + /** + * @var array + */ + private $endLines = []; + + /** + * @var bool + */ + private $cacheTokens; + + /** + * Constructor. + * + * @param string $name + * @param AbstractNode $parent + * @param array $coverageData + * @param array $testData + * @param bool $cacheTokens + * + * @throws InvalidArgumentException + */ + public function __construct($name, AbstractNode $parent, array $coverageData, array $testData, $cacheTokens) + { + if (!\is_bool($cacheTokens)) { + throw InvalidArgumentException::create( + 1, + 'boolean' + ); + } + + parent::__construct($name, $parent); + + $this->coverageData = $coverageData; + $this->testData = $testData; + $this->cacheTokens = $cacheTokens; + + $this->calculateStatistics(); + } + + /** + * Returns the number of files in/under this node. + * + * @return int + */ + public function count() + { + return 1; + } + + /** + * Returns the code coverage data of this node. + * + * @return array + */ + public function getCoverageData() + { + return $this->coverageData; + } + + /** + * Returns the test data of this node. + * + * @return array + */ + public function getTestData() + { + return $this->testData; + } + + /** + * Returns the classes of this node. + * + * @return array + */ + public function getClasses() + { + return $this->classes; + } + + /** + * Returns the traits of this node. + * + * @return array + */ + public function getTraits() + { + return $this->traits; + } + + /** + * Returns the functions of this node. + * + * @return array + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * Returns the LOC/CLOC/NCLOC of this node. + * + * @return array + */ + public function getLinesOfCode() + { + return $this->linesOfCode; + } + + /** + * Returns the number of executable lines. + * + * @return int + */ + public function getNumExecutableLines() + { + return $this->numExecutableLines; + } + + /** + * Returns the number of executed lines. + * + * @return int + */ + public function getNumExecutedLines() + { + return $this->numExecutedLines; + } + + /** + * Returns the number of classes. + * + * @return int + */ + public function getNumClasses() + { + if ($this->numClasses === null) { + $this->numClasses = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numClasses++; + + continue 2; + } + } + } + } + + return $this->numClasses; + } + + /** + * Returns the number of tested classes. + * + * @return int + */ + public function getNumTestedClasses() + { + return $this->numTestedClasses; + } + + /** + * Returns the number of traits. + * + * @return int + */ + public function getNumTraits() + { + if ($this->numTraits === null) { + $this->numTraits = 0; + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numTraits++; + + continue 2; + } + } + } + } + + return $this->numTraits; + } + + /** + * Returns the number of tested traits. + * + * @return int + */ + public function getNumTestedTraits() + { + return $this->numTestedTraits; + } + + /** + * Returns the number of methods. + * + * @return int + */ + public function getNumMethods() + { + if ($this->numMethods === null) { + $this->numMethods = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numMethods++; + } + } + } + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numMethods++; + } + } + } + } + + return $this->numMethods; + } + + /** + * Returns the number of tested methods. + * + * @return int + */ + public function getNumTestedMethods() + { + if ($this->numTestedMethods === null) { + $this->numTestedMethods = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0 && + $method['coverage'] == 100) { + $this->numTestedMethods++; + } + } + } + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0 && + $method['coverage'] == 100) { + $this->numTestedMethods++; + } + } + } + } + + return $this->numTestedMethods; + } + + /** + * Returns the number of functions. + * + * @return int + */ + public function getNumFunctions() + { + return \count($this->functions); + } + + /** + * Returns the number of tested functions. + * + * @return int + */ + public function getNumTestedFunctions() + { + if ($this->numTestedFunctions === null) { + $this->numTestedFunctions = 0; + + foreach ($this->functions as $function) { + if ($function['executableLines'] > 0 && + $function['coverage'] == 100) { + $this->numTestedFunctions++; + } + } + } + + return $this->numTestedFunctions; + } + + /** + * Calculates coverage statistics for the file. + */ + protected function calculateStatistics() + { + $classStack = $functionStack = []; + + if ($this->cacheTokens) { + $tokens = \PHP_Token_Stream_CachingFactory::get($this->getPath()); + } else { + $tokens = new \PHP_Token_Stream($this->getPath()); + } + + $this->processClasses($tokens); + $this->processTraits($tokens); + $this->processFunctions($tokens); + $this->linesOfCode = $tokens->getLinesOfCode(); + unset($tokens); + + for ($lineNumber = 1; $lineNumber <= $this->linesOfCode['loc']; $lineNumber++) { + if (isset($this->startLines[$lineNumber])) { + // Start line of a class. + if (isset($this->startLines[$lineNumber]['className'])) { + if (isset($currentClass)) { + $classStack[] = &$currentClass; + } + + $currentClass = &$this->startLines[$lineNumber]; + } // Start line of a trait. + elseif (isset($this->startLines[$lineNumber]['traitName'])) { + $currentTrait = &$this->startLines[$lineNumber]; + } // Start line of a method. + elseif (isset($this->startLines[$lineNumber]['methodName'])) { + $currentMethod = &$this->startLines[$lineNumber]; + } // Start line of a function. + elseif (isset($this->startLines[$lineNumber]['functionName'])) { + if (isset($currentFunction)) { + $functionStack[] = &$currentFunction; + } + + $currentFunction = &$this->startLines[$lineNumber]; + } + } + + if (isset($this->coverageData[$lineNumber])) { + if (isset($currentClass)) { + $currentClass['executableLines']++; + } + + if (isset($currentTrait)) { + $currentTrait['executableLines']++; + } + + if (isset($currentMethod)) { + $currentMethod['executableLines']++; + } + + if (isset($currentFunction)) { + $currentFunction['executableLines']++; + } + + $this->numExecutableLines++; + + if (\count($this->coverageData[$lineNumber]) > 0) { + if (isset($currentClass)) { + $currentClass['executedLines']++; + } + + if (isset($currentTrait)) { + $currentTrait['executedLines']++; + } + + if (isset($currentMethod)) { + $currentMethod['executedLines']++; + } + + if (isset($currentFunction)) { + $currentFunction['executedLines']++; + } + + $this->numExecutedLines++; + } + } + + if (isset($this->endLines[$lineNumber])) { + // End line of a class. + if (isset($this->endLines[$lineNumber]['className'])) { + unset($currentClass); + + if ($classStack) { + \end($classStack); + $key = \key($classStack); + $currentClass = &$classStack[$key]; + unset($classStack[$key]); + } + } // End line of a trait. + elseif (isset($this->endLines[$lineNumber]['traitName'])) { + unset($currentTrait); + } // End line of a method. + elseif (isset($this->endLines[$lineNumber]['methodName'])) { + unset($currentMethod); + } // End line of a function. + elseif (isset($this->endLines[$lineNumber]['functionName'])) { + unset($currentFunction); + + if ($functionStack) { + \end($functionStack); + $key = \key($functionStack); + $currentFunction = &$functionStack[$key]; + unset($functionStack[$key]); + } + } + } + } + + foreach ($this->traits as &$trait) { + foreach ($trait['methods'] as &$method) { + if ($method['executableLines'] > 0) { + $method['coverage'] = ($method['executedLines'] / + $method['executableLines']) * 100; + } else { + $method['coverage'] = 100; + } + + $method['crap'] = $this->crap( + $method['ccn'], + $method['coverage'] + ); + + $trait['ccn'] += $method['ccn']; + } + + if ($trait['executableLines'] > 0) { + $trait['coverage'] = ($trait['executedLines'] / + $trait['executableLines']) * 100; + + if ($trait['coverage'] == 100) { + $this->numTestedClasses++; + } + } else { + $trait['coverage'] = 100; + } + + $trait['crap'] = $this->crap( + $trait['ccn'], + $trait['coverage'] + ); + } + + foreach ($this->classes as &$class) { + foreach ($class['methods'] as &$method) { + if ($method['executableLines'] > 0) { + $method['coverage'] = ($method['executedLines'] / + $method['executableLines']) * 100; + } else { + $method['coverage'] = 100; + } + + $method['crap'] = $this->crap( + $method['ccn'], + $method['coverage'] + ); + + $class['ccn'] += $method['ccn']; + } + + if ($class['executableLines'] > 0) { + $class['coverage'] = ($class['executedLines'] / + $class['executableLines']) * 100; + + if ($class['coverage'] == 100) { + $this->numTestedClasses++; + } + } else { + $class['coverage'] = 100; + } + + $class['crap'] = $this->crap( + $class['ccn'], + $class['coverage'] + ); + } + + foreach ($this->functions as &$function) { + if ($function['executableLines'] > 0) { + $function['coverage'] = ($function['executedLines'] / + $function['executableLines']) * 100; + } else { + $function['coverage'] = 100; + } + + if ($function['coverage'] == 100) { + $this->numTestedFunctions++; + } + + $function['crap'] = $this->crap( + $function['ccn'], + $function['coverage'] + ); + } + } + + /** + * @param \PHP_Token_Stream $tokens + */ + protected function processClasses(\PHP_Token_Stream $tokens) + { + $classes = $tokens->getClasses(); + unset($tokens); + + $link = $this->getId() . '.html#'; + + foreach ($classes as $className => $class) { + if (!empty($class['package']['namespace'])) { + $className = $class['package']['namespace'] . '\\' . $className; + } + + $this->classes[$className] = [ + 'className' => $className, + 'methods' => [], + 'startLine' => $class['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => 0, + 'coverage' => 0, + 'crap' => 0, + 'package' => $class['package'], + 'link' => $link . $class['startLine'] + ]; + + $this->startLines[$class['startLine']] = &$this->classes[$className]; + $this->endLines[$class['endLine']] = &$this->classes[$className]; + + foreach ($class['methods'] as $methodName => $method) { + $this->classes[$className]['methods'][$methodName] = $this->newMethod($methodName, $method, $link); + + $this->startLines[$method['startLine']] = &$this->classes[$className]['methods'][$methodName]; + $this->endLines[$method['endLine']] = &$this->classes[$className]['methods'][$methodName]; + } + } + } + + /** + * @param \PHP_Token_Stream $tokens + */ + protected function processTraits(\PHP_Token_Stream $tokens) + { + $traits = $tokens->getTraits(); + unset($tokens); + + $link = $this->getId() . '.html#'; + + foreach ($traits as $traitName => $trait) { + $this->traits[$traitName] = [ + 'traitName' => $traitName, + 'methods' => [], + 'startLine' => $trait['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => 0, + 'coverage' => 0, + 'crap' => 0, + 'package' => $trait['package'], + 'link' => $link . $trait['startLine'] + ]; + + $this->startLines[$trait['startLine']] = &$this->traits[$traitName]; + $this->endLines[$trait['endLine']] = &$this->traits[$traitName]; + + foreach ($trait['methods'] as $methodName => $method) { + $this->traits[$traitName]['methods'][$methodName] = $this->newMethod($methodName, $method, $link); + + $this->startLines[$method['startLine']] = &$this->traits[$traitName]['methods'][$methodName]; + $this->endLines[$method['endLine']] = &$this->traits[$traitName]['methods'][$methodName]; + } + } + } + + /** + * @param \PHP_Token_Stream $tokens + */ + protected function processFunctions(\PHP_Token_Stream $tokens) + { + $functions = $tokens->getFunctions(); + unset($tokens); + + $link = $this->getId() . '.html#'; + + foreach ($functions as $functionName => $function) { + $this->functions[$functionName] = [ + 'functionName' => $functionName, + 'signature' => $function['signature'], + 'startLine' => $function['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => $function['ccn'], + 'coverage' => 0, + 'crap' => 0, + 'link' => $link . $function['startLine'] + ]; + + $this->startLines[$function['startLine']] = &$this->functions[$functionName]; + $this->endLines[$function['endLine']] = &$this->functions[$functionName]; + } + } + + /** + * Calculates the Change Risk Anti-Patterns (CRAP) index for a unit of code + * based on its cyclomatic complexity and percentage of code coverage. + * + * @param int $ccn + * @param float $coverage + * + * @return string + */ + protected function crap($ccn, $coverage) + { + if ($coverage == 0) { + return (string) (\pow($ccn, 2) + $ccn); + } + + if ($coverage >= 95) { + return (string) $ccn; + } + + return \sprintf( + '%01.2F', + \pow($ccn, 2) * \pow(1 - $coverage / 100, 3) + $ccn + ); + } + + /** + * @param string $methodName + * @param array $method + * @param string $link + * + * @return array + */ + private function newMethod($methodName, array $method, $link) + { + return [ + 'methodName' => $methodName, + 'visibility' => $method['visibility'], + 'signature' => $method['signature'], + 'startLine' => $method['startLine'], + 'endLine' => $method['endLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => $method['ccn'], + 'coverage' => 0, + 'crap' => 0, + 'link' => $link . $method['startLine'], + ]; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Iterator.php b/vendor/phpunit/php-code-coverage/src/Node/Iterator.php new file mode 100644 index 0000000..2a2aa6b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Iterator.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Node; + +/** + * Recursive iterator for node object graphs. + */ +class Iterator implements \RecursiveIterator +{ + /** + * @var int + */ + private $position; + + /** + * @var AbstractNode[] + */ + private $nodes; + + /** + * @param Directory $node + */ + public function __construct(Directory $node) + { + $this->nodes = $node->getChildNodes(); + } + + /** + * Rewinds the Iterator to the first element. + */ + public function rewind() + { + $this->position = 0; + } + + /** + * Checks if there is a current element after calls to rewind() or next(). + * + * @return bool + */ + public function valid() + { + return $this->position < \count($this->nodes); + } + + /** + * Returns the key of the current element. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Returns the current element. + * + * @return \PHPUnit_Framework_Test + */ + public function current() + { + return $this->valid() ? $this->nodes[$this->position] : null; + } + + /** + * Moves forward to next element. + */ + public function next() + { + $this->position++; + } + + /** + * Returns the sub iterator for the current element. + * + * @return Iterator + */ + public function getChildren() + { + return new self( + $this->nodes[$this->position] + ); + } + + /** + * Checks whether the current element has children. + * + * @return bool + */ + public function hasChildren() + { + return $this->nodes[$this->position] instanceof Directory; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Clover.php b/vendor/phpunit/php-code-coverage/src/Report/Clover.php new file mode 100644 index 0000000..2758d90 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Clover.php @@ -0,0 +1,261 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\File; +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Generates a Clover XML logfile from a code coverage object. + */ +class Clover +{ + /** + * @param CodeCoverage $coverage + * @param string $target + * @param string $name + * + * @return string + * + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + */ + public function process(CodeCoverage $coverage, $target = null, $name = null) + { + $xmlDocument = new \DOMDocument('1.0', 'UTF-8'); + $xmlDocument->formatOutput = true; + + $xmlCoverage = $xmlDocument->createElement('coverage'); + $xmlCoverage->setAttribute('generated', (int) $_SERVER['REQUEST_TIME']); + $xmlDocument->appendChild($xmlCoverage); + + $xmlProject = $xmlDocument->createElement('project'); + $xmlProject->setAttribute('timestamp', (int) $_SERVER['REQUEST_TIME']); + + if (\is_string($name)) { + $xmlProject->setAttribute('name', $name); + } + + $xmlCoverage->appendChild($xmlProject); + + $packages = []; + $report = $coverage->getReport(); + unset($coverage); + + foreach ($report as $item) { + if (!$item instanceof File) { + continue; + } + + /* @var File $item */ + + $xmlFile = $xmlDocument->createElement('file'); + $xmlFile->setAttribute('name', $item->getPath()); + + $classes = $item->getClassesAndTraits(); + $coverage = $item->getCoverageData(); + $lines = []; + $namespace = 'global'; + + foreach ($classes as $className => $class) { + $classStatements = 0; + $coveredClassStatements = 0; + $coveredMethods = 0; + $classMethods = 0; + + foreach ($class['methods'] as $methodName => $method) { + if ($method['executableLines'] == 0) { + continue; + } + + $classMethods++; + $classStatements += $method['executableLines']; + $coveredClassStatements += $method['executedLines']; + + if ($method['coverage'] == 100) { + $coveredMethods++; + } + + $methodCount = 0; + + foreach (\range($method['startLine'], $method['endLine']) as $line) { + if (isset($coverage[$line]) && ($coverage[$line] !== null)) { + $methodCount = \max($methodCount, \count($coverage[$line])); + } + } + + $lines[$method['startLine']] = [ + 'ccn' => $method['ccn'], + 'count' => $methodCount, + 'crap' => $method['crap'], + 'type' => 'method', + 'visibility' => $method['visibility'], + 'name' => $methodName + ]; + } + + if (!empty($class['package']['namespace'])) { + $namespace = $class['package']['namespace']; + } + + $xmlClass = $xmlDocument->createElement('class'); + $xmlClass->setAttribute('name', $className); + $xmlClass->setAttribute('namespace', $namespace); + + if (!empty($class['package']['fullPackage'])) { + $xmlClass->setAttribute( + 'fullPackage', + $class['package']['fullPackage'] + ); + } + + if (!empty($class['package']['category'])) { + $xmlClass->setAttribute( + 'category', + $class['package']['category'] + ); + } + + if (!empty($class['package']['package'])) { + $xmlClass->setAttribute( + 'package', + $class['package']['package'] + ); + } + + if (!empty($class['package']['subpackage'])) { + $xmlClass->setAttribute( + 'subpackage', + $class['package']['subpackage'] + ); + } + + $xmlFile->appendChild($xmlClass); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('complexity', $class['ccn']); + $xmlMetrics->setAttribute('methods', $classMethods); + $xmlMetrics->setAttribute('coveredmethods', $coveredMethods); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $classStatements); + $xmlMetrics->setAttribute('coveredstatements', $coveredClassStatements); + $xmlMetrics->setAttribute('elements', $classMethods + $classStatements /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $coveredMethods + $coveredClassStatements /* + coveredconditionals */); + $xmlClass->appendChild($xmlMetrics); + } + + foreach ($coverage as $line => $data) { + if ($data === null || isset($lines[$line])) { + continue; + } + + $lines[$line] = [ + 'count' => \count($data), 'type' => 'stmt' + ]; + } + + \ksort($lines); + + foreach ($lines as $line => $data) { + $xmlLine = $xmlDocument->createElement('line'); + $xmlLine->setAttribute('num', $line); + $xmlLine->setAttribute('type', $data['type']); + + if (isset($data['name'])) { + $xmlLine->setAttribute('name', $data['name']); + } + + if (isset($data['visibility'])) { + $xmlLine->setAttribute('visibility', $data['visibility']); + } + + if (isset($data['ccn'])) { + $xmlLine->setAttribute('complexity', $data['ccn']); + } + + if (isset($data['crap'])) { + $xmlLine->setAttribute('crap', $data['crap']); + } + + $xmlLine->setAttribute('count', $data['count']); + $xmlFile->appendChild($xmlLine); + } + + $linesOfCode = $item->getLinesOfCode(); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('loc', $linesOfCode['loc']); + $xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']); + $xmlMetrics->setAttribute('classes', $item->getNumClassesAndTraits()); + $xmlMetrics->setAttribute('methods', $item->getNumMethods()); + $xmlMetrics->setAttribute('coveredmethods', $item->getNumTestedMethods()); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $item->getNumExecutableLines()); + $xmlMetrics->setAttribute('coveredstatements', $item->getNumExecutedLines()); + $xmlMetrics->setAttribute('elements', $item->getNumMethods() + $item->getNumExecutableLines() /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $item->getNumTestedMethods() + $item->getNumExecutedLines() /* + coveredconditionals */); + $xmlFile->appendChild($xmlMetrics); + + if ($namespace == 'global') { + $xmlProject->appendChild($xmlFile); + } else { + if (!isset($packages[$namespace])) { + $packages[$namespace] = $xmlDocument->createElement( + 'package' + ); + + $packages[$namespace]->setAttribute('name', $namespace); + $xmlProject->appendChild($packages[$namespace]); + } + + $packages[$namespace]->appendChild($xmlFile); + } + } + + $linesOfCode = $report->getLinesOfCode(); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('files', \count($report)); + $xmlMetrics->setAttribute('loc', $linesOfCode['loc']); + $xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']); + $xmlMetrics->setAttribute('classes', $report->getNumClassesAndTraits()); + $xmlMetrics->setAttribute('methods', $report->getNumMethods()); + $xmlMetrics->setAttribute('coveredmethods', $report->getNumTestedMethods()); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $report->getNumExecutableLines()); + $xmlMetrics->setAttribute('coveredstatements', $report->getNumExecutedLines()); + $xmlMetrics->setAttribute('elements', $report->getNumMethods() + $report->getNumExecutableLines() /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $report->getNumTestedMethods() + $report->getNumExecutedLines() /* + coveredconditionals */); + $xmlProject->appendChild($xmlMetrics); + + $buffer = $xmlDocument->saveXML(); + + if ($target !== null) { + if (!\is_dir(\dirname($target))) { + \mkdir(\dirname($target), 0777, true); + } + + if (@\file_put_contents($target, $buffer) === false) { + throw new RuntimeException( + \sprintf( + 'Could not write to "%s', + $target + ) + ); + } + } + + return $buffer; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php new file mode 100644 index 0000000..5ef11af --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\InvalidArgumentException; +use SebastianBergmann\CodeCoverage\Node\File; +use SebastianBergmann\CodeCoverage\RuntimeException; + +class Crap4j +{ + /** + * @var int + */ + private $threshold; + + /** + * @param int $threshold + */ + public function __construct($threshold = 30) + { + if (!\is_int($threshold)) { + throw InvalidArgumentException::create( + 1, + 'integer' + ); + } + + $this->threshold = $threshold; + } + + /** + * @param CodeCoverage $coverage + * @param string $target + * @param string $name + * + * @return string + * + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + */ + public function process(CodeCoverage $coverage, $target = null, $name = null) + { + $document = new \DOMDocument('1.0', 'UTF-8'); + $document->formatOutput = true; + + $root = $document->createElement('crap_result'); + $document->appendChild($root); + + $project = $document->createElement('project', \is_string($name) ? $name : ''); + $root->appendChild($project); + $root->appendChild($document->createElement('timestamp', \date('Y-m-d H:i:s', (int) $_SERVER['REQUEST_TIME']))); + + $stats = $document->createElement('stats'); + $methodsNode = $document->createElement('methods'); + + $report = $coverage->getReport(); + unset($coverage); + + $fullMethodCount = 0; + $fullCrapMethodCount = 0; + $fullCrapLoad = 0; + $fullCrap = 0; + + foreach ($report as $item) { + $namespace = 'global'; + + if (!$item instanceof File) { + continue; + } + + $file = $document->createElement('file'); + $file->setAttribute('name', $item->getPath()); + + $classes = $item->getClassesAndTraits(); + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + $crapLoad = $this->getCrapLoad($method['crap'], $method['ccn'], $method['coverage']); + + $fullCrap += $method['crap']; + $fullCrapLoad += $crapLoad; + $fullMethodCount++; + + if ($method['crap'] >= $this->threshold) { + $fullCrapMethodCount++; + } + + $methodNode = $document->createElement('method'); + + if (!empty($class['package']['namespace'])) { + $namespace = $class['package']['namespace']; + } + + $methodNode->appendChild($document->createElement('package', $namespace)); + $methodNode->appendChild($document->createElement('className', $className)); + $methodNode->appendChild($document->createElement('methodName', $methodName)); + $methodNode->appendChild($document->createElement('methodSignature', \htmlspecialchars($method['signature']))); + $methodNode->appendChild($document->createElement('fullMethod', \htmlspecialchars($method['signature']))); + $methodNode->appendChild($document->createElement('crap', $this->roundValue($method['crap']))); + $methodNode->appendChild($document->createElement('complexity', $method['ccn'])); + $methodNode->appendChild($document->createElement('coverage', $this->roundValue($method['coverage']))); + $methodNode->appendChild($document->createElement('crapLoad', \round($crapLoad))); + + $methodsNode->appendChild($methodNode); + } + } + } + + $stats->appendChild($document->createElement('name', 'Method Crap Stats')); + $stats->appendChild($document->createElement('methodCount', $fullMethodCount)); + $stats->appendChild($document->createElement('crapMethodCount', $fullCrapMethodCount)); + $stats->appendChild($document->createElement('crapLoad', \round($fullCrapLoad))); + $stats->appendChild($document->createElement('totalCrap', $fullCrap)); + + if ($fullMethodCount > 0) { + $crapMethodPercent = $this->roundValue((100 * $fullCrapMethodCount) / $fullMethodCount); + } else { + $crapMethodPercent = 0; + } + + $stats->appendChild($document->createElement('crapMethodPercent', $crapMethodPercent)); + + $root->appendChild($stats); + $root->appendChild($methodsNode); + + $buffer = $document->saveXML(); + + if ($target !== null) { + if (!\is_dir(\dirname($target))) { + \mkdir(\dirname($target), 0777, true); + } + + if (@\file_put_contents($target, $buffer) === false) { + throw new RuntimeException( + \sprintf( + 'Could not write to "%s', + $target + ) + ); + } + } + + return $buffer; + } + + /** + * @param float $crapValue + * @param int $cyclomaticComplexity + * @param float $coveragePercent + * + * @return float + */ + private function getCrapLoad($crapValue, $cyclomaticComplexity, $coveragePercent) + { + $crapLoad = 0; + + if ($crapValue >= $this->threshold) { + $crapLoad += $cyclomaticComplexity * (1.0 - $coveragePercent / 100); + $crapLoad += $cyclomaticComplexity / $this->threshold; + } + + return $crapLoad; + } + + /** + * @param float $value + * + * @return float + */ + private function roundValue($value) + { + return \round($value, 2); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php new file mode 100644 index 0000000..ef88041 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php @@ -0,0 +1,190 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Generates an HTML report from a code coverage object. + */ +class Facade +{ + /** + * @var string + */ + private $templatePath; + + /** + * @var string + */ + private $generator; + + /** + * @var int + */ + private $lowUpperBound; + + /** + * @var int + */ + private $highLowerBound; + + /** + * Constructor. + * + * @param int $lowUpperBound + * @param int $highLowerBound + * @param string $generator + */ + public function __construct($lowUpperBound = 50, $highLowerBound = 90, $generator = '') + { + $this->generator = $generator; + $this->highLowerBound = $highLowerBound; + $this->lowUpperBound = $lowUpperBound; + $this->templatePath = __DIR__ . '/Renderer/Template/'; + } + + /** + * @param CodeCoverage $coverage + * @param string $target + */ + public function process(CodeCoverage $coverage, $target) + { + $target = $this->getDirectory($target); + $report = $coverage->getReport(); + unset($coverage); + + if (!isset($_SERVER['REQUEST_TIME'])) { + $_SERVER['REQUEST_TIME'] = \time(); + } + + $date = \date('D M j G:i:s T Y', $_SERVER['REQUEST_TIME']); + + $dashboard = new Dashboard( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $directory = new Directory( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $file = new File( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $directory->render($report, $target . 'index.html'); + $dashboard->render($report, $target . 'dashboard.html'); + + foreach ($report as $node) { + $id = $node->getId(); + + if ($node instanceof DirectoryNode) { + if (!\file_exists($target . $id)) { + \mkdir($target . $id, 0777, true); + } + + $directory->render($node, $target . $id . '/index.html'); + $dashboard->render($node, $target . $id . '/dashboard.html'); + } else { + $dir = \dirname($target . $id); + + if (!\file_exists($dir)) { + \mkdir($dir, 0777, true); + } + + $file->render($node, $target . $id . '.html'); + } + } + + $this->copyFiles($target); + } + + /** + * @param string $target + */ + private function copyFiles($target) + { + $dir = $this->getDirectory($target . '.css'); + + \file_put_contents( + $dir . 'bootstrap.min.css', + \str_replace( + 'url(../fonts/', + 'url(../.fonts/', + \file_get_contents($this->templatePath . 'css/bootstrap.min.css') + ) + + ); + + \copy($this->templatePath . 'css/nv.d3.min.css', $dir . 'nv.d3.min.css'); + \copy($this->templatePath . 'css/style.css', $dir . 'style.css'); + + $dir = $this->getDirectory($target . '.fonts'); + \copy($this->templatePath . 'fonts/glyphicons-halflings-regular.eot', $dir . 'glyphicons-halflings-regular.eot'); + \copy($this->templatePath . 'fonts/glyphicons-halflings-regular.svg', $dir . 'glyphicons-halflings-regular.svg'); + \copy($this->templatePath . 'fonts/glyphicons-halflings-regular.ttf', $dir . 'glyphicons-halflings-regular.ttf'); + \copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff', $dir . 'glyphicons-halflings-regular.woff'); + \copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff2', $dir . 'glyphicons-halflings-regular.woff2'); + + $dir = $this->getDirectory($target . '.js'); + \copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js'); + \copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js'); + \copy($this->templatePath . 'js/holder.min.js', $dir . 'holder.min.js'); + \copy($this->templatePath . 'js/html5shiv.min.js', $dir . 'html5shiv.min.js'); + \copy($this->templatePath . 'js/jquery.min.js', $dir . 'jquery.min.js'); + \copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js'); + \copy($this->templatePath . 'js/respond.min.js', $dir . 'respond.min.js'); + \copy($this->templatePath . 'js/file.js', $dir . 'file.js'); + } + + /** + * @param string $directory + * + * @return string + * + * @throws RuntimeException + */ + private function getDirectory($directory) + { + if (\substr($directory, -1, 1) != DIRECTORY_SEPARATOR) { + $directory .= DIRECTORY_SEPARATOR; + } + + if (\is_dir($directory)) { + return $directory; + } + + if (@\mkdir($directory, 0777, true)) { + return $directory; + } + + throw new RuntimeException( + \sprintf( + 'Directory "%s" does not exist.', + $directory + ) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php new file mode 100644 index 0000000..1732161 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php @@ -0,0 +1,296 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use SebastianBergmann\CodeCoverage\Node\File as FileNode; +use SebastianBergmann\CodeCoverage\Version; +use SebastianBergmann\Environment\Runtime; + +/** + * Base class for node renderers. + */ +abstract class Renderer +{ + /** + * @var string + */ + protected $templatePath; + + /** + * @var string + */ + protected $generator; + + /** + * @var string + */ + protected $date; + + /** + * @var int + */ + protected $lowUpperBound; + + /** + * @var int + */ + protected $highLowerBound; + + /** + * @var string + */ + protected $version; + + /** + * Constructor. + * + * @param string $templatePath + * @param string $generator + * @param string $date + * @param int $lowUpperBound + * @param int $highLowerBound + */ + public function __construct($templatePath, $generator, $date, $lowUpperBound, $highLowerBound) + { + $this->templatePath = $templatePath; + $this->generator = $generator; + $this->date = $date; + $this->lowUpperBound = $lowUpperBound; + $this->highLowerBound = $highLowerBound; + $this->version = Version::id(); + } + + /** + * @param \Text_Template $template + * @param array $data + * + * @return string + */ + protected function renderItemTemplate(\Text_Template $template, array $data) + { + $numSeparator = ' / '; + + if (isset($data['numClasses']) && $data['numClasses'] > 0) { + $classesLevel = $this->getColorLevel($data['testedClassesPercent']); + + $classesNumber = $data['numTestedClasses'] . $numSeparator . + $data['numClasses']; + + $classesBar = $this->getCoverageBar( + $data['testedClassesPercent'] + ); + } else { + $classesLevel = ''; + $classesNumber = '0' . $numSeparator . '0'; + $classesBar = ''; + $data['testedClassesPercentAsString'] = 'n/a'; + } + + if ($data['numMethods'] > 0) { + $methodsLevel = $this->getColorLevel($data['testedMethodsPercent']); + + $methodsNumber = $data['numTestedMethods'] . $numSeparator . + $data['numMethods']; + + $methodsBar = $this->getCoverageBar( + $data['testedMethodsPercent'] + ); + } else { + $methodsLevel = ''; + $methodsNumber = '0' . $numSeparator . '0'; + $methodsBar = ''; + $data['testedMethodsPercentAsString'] = 'n/a'; + } + + if ($data['numExecutableLines'] > 0) { + $linesLevel = $this->getColorLevel($data['linesExecutedPercent']); + + $linesNumber = $data['numExecutedLines'] . $numSeparator . + $data['numExecutableLines']; + + $linesBar = $this->getCoverageBar( + $data['linesExecutedPercent'] + ); + } else { + $linesLevel = ''; + $linesNumber = '0' . $numSeparator . '0'; + $linesBar = ''; + $data['linesExecutedPercentAsString'] = 'n/a'; + } + + $template->setVar( + [ + 'icon' => isset($data['icon']) ? $data['icon'] : '', + 'crap' => isset($data['crap']) ? $data['crap'] : '', + 'name' => $data['name'], + 'lines_bar' => $linesBar, + 'lines_executed_percent' => $data['linesExecutedPercentAsString'], + 'lines_level' => $linesLevel, + 'lines_number' => $linesNumber, + 'methods_bar' => $methodsBar, + 'methods_tested_percent' => $data['testedMethodsPercentAsString'], + 'methods_level' => $methodsLevel, + 'methods_number' => $methodsNumber, + 'classes_bar' => $classesBar, + 'classes_tested_percent' => isset($data['testedClassesPercentAsString']) ? $data['testedClassesPercentAsString'] : '', + 'classes_level' => $classesLevel, + 'classes_number' => $classesNumber + ] + ); + + return $template->render(); + } + + /** + * @param \Text_Template $template + * @param AbstractNode $node + */ + protected function setCommonTemplateVariables(\Text_Template $template, AbstractNode $node) + { + $template->setVar( + [ + 'id' => $node->getId(), + 'full_path' => $node->getPath(), + 'path_to_root' => $this->getPathToRoot($node), + 'breadcrumbs' => $this->getBreadcrumbs($node), + 'date' => $this->date, + 'version' => $this->version, + 'runtime' => $this->getRuntimeString(), + 'generator' => $this->generator, + 'low_upper_bound' => $this->lowUpperBound, + 'high_lower_bound' => $this->highLowerBound + ] + ); + } + + protected function getBreadcrumbs(AbstractNode $node) + { + $breadcrumbs = ''; + $path = $node->getPathAsArray(); + $pathToRoot = []; + $max = \count($path); + + if ($node instanceof FileNode) { + $max--; + } + + for ($i = 0; $i < $max; $i++) { + $pathToRoot[] = \str_repeat('../', $i); + } + + foreach ($path as $step) { + if ($step !== $node) { + $breadcrumbs .= $this->getInactiveBreadcrumb( + $step, + \array_pop($pathToRoot) + ); + } else { + $breadcrumbs .= $this->getActiveBreadcrumb($step); + } + } + + return $breadcrumbs; + } + + protected function getActiveBreadcrumb(AbstractNode $node) + { + $buffer = \sprintf( + '
  • %s
  • ' . "\n", + $node->getName() + ); + + if ($node instanceof DirectoryNode) { + $buffer .= '
  • (Dashboard)
  • ' . "\n"; + } + + return $buffer; + } + + protected function getInactiveBreadcrumb(AbstractNode $node, $pathToRoot) + { + return \sprintf( + '
  • %s
  • ' . "\n", + $pathToRoot, + $node->getName() + ); + } + + protected function getPathToRoot(AbstractNode $node) + { + $id = $node->getId(); + $depth = \substr_count($id, '/'); + + if ($id != 'index' && + $node instanceof DirectoryNode) { + $depth++; + } + + return \str_repeat('../', $depth); + } + + protected function getCoverageBar($percent) + { + $level = $this->getColorLevel($percent); + + $template = new \Text_Template( + $this->templatePath . 'coverage_bar.html', + '{{', + '}}' + ); + + $template->setVar(['level' => $level, 'percent' => \sprintf('%.2F', $percent)]); + + return $template->render(); + } + + /** + * @param int $percent + * + * @return string + */ + protected function getColorLevel($percent) + { + if ($percent <= $this->lowUpperBound) { + return 'danger'; + } elseif ($percent > $this->lowUpperBound && + $percent < $this->highLowerBound) { + return 'warning'; + } else { + return 'success'; + } + } + + /** + * @return string + */ + private function getRuntimeString() + { + $runtime = new Runtime; + + $buffer = \sprintf( + '%s %s', + $runtime->getVendorUrl(), + $runtime->getName(), + $runtime->getVersion() + ); + + if ($runtime->hasXdebug() && !$runtime->hasPHPDBGCodeCoverage()) { + $buffer .= \sprintf( + ' with Xdebug %s', + \phpversion('xdebug') + ); + } + + return $buffer; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php new file mode 100644 index 0000000..0ca7b42 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php @@ -0,0 +1,304 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; + +/** + * Renders the dashboard for a directory node. + */ +class Dashboard extends Renderer +{ + /** + * @param DirectoryNode $node + * @param string $file + * + * @throws \InvalidArgumentException + */ + public function render(DirectoryNode $node, $file) + { + $classes = $node->getClassesAndTraits(); + $template = new \Text_Template( + $this->templatePath . 'dashboard.html', + '{{', + '}}' + ); + + $this->setCommonTemplateVariables($template, $node); + + $baseLink = $node->getId() . '/'; + $complexity = $this->complexity($classes, $baseLink); + $coverageDistribution = $this->coverageDistribution($classes); + $insufficientCoverage = $this->insufficientCoverage($classes, $baseLink); + $projectRisks = $this->projectRisks($classes, $baseLink); + + $template->setVar( + [ + 'insufficient_coverage_classes' => $insufficientCoverage['class'], + 'insufficient_coverage_methods' => $insufficientCoverage['method'], + 'project_risks_classes' => $projectRisks['class'], + 'project_risks_methods' => $projectRisks['method'], + 'complexity_class' => $complexity['class'], + 'complexity_method' => $complexity['method'], + 'class_coverage_distribution' => $coverageDistribution['class'], + 'method_coverage_distribution' => $coverageDistribution['method'] + ] + ); + + $template->renderTo($file); + } + + /** + * Returns the data for the Class/Method Complexity charts. + * + * @param array $classes + * @param string $baseLink + * + * @return array + */ + protected function complexity(array $classes, $baseLink) + { + $result = ['class' => [], 'method' => []]; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($className !== '*') { + $methodName = $className . '::' . $methodName; + } + + $result['method'][] = [ + $method['coverage'], + $method['ccn'], + \sprintf( + '%s', + \str_replace($baseLink, '', $method['link']), + $methodName + ) + ]; + } + + $result['class'][] = [ + $class['coverage'], + $class['ccn'], + \sprintf( + '%s', + \str_replace($baseLink, '', $class['link']), + $className + ) + ]; + } + + return [ + 'class' => \json_encode($result['class']), + 'method' => \json_encode($result['method']) + ]; + } + + /** + * Returns the data for the Class / Method Coverage Distribution chart. + * + * @param array $classes + * + * @return array + */ + protected function coverageDistribution(array $classes) + { + $result = [ + 'class' => [ + '0%' => 0, + '0-10%' => 0, + '10-20%' => 0, + '20-30%' => 0, + '30-40%' => 0, + '40-50%' => 0, + '50-60%' => 0, + '60-70%' => 0, + '70-80%' => 0, + '80-90%' => 0, + '90-100%' => 0, + '100%' => 0 + ], + 'method' => [ + '0%' => 0, + '0-10%' => 0, + '10-20%' => 0, + '20-30%' => 0, + '30-40%' => 0, + '40-50%' => 0, + '50-60%' => 0, + '60-70%' => 0, + '70-80%' => 0, + '80-90%' => 0, + '90-100%' => 0, + '100%' => 0 + ] + ]; + + foreach ($classes as $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] === 0) { + $result['method']['0%']++; + } elseif ($method['coverage'] === 100) { + $result['method']['100%']++; + } else { + $key = \floor($method['coverage'] / 10) * 10; + $key = $key . '-' . ($key + 10) . '%'; + $result['method'][$key]++; + } + } + + if ($class['coverage'] === 0) { + $result['class']['0%']++; + } elseif ($class['coverage'] === 100) { + $result['class']['100%']++; + } else { + $key = \floor($class['coverage'] / 10) * 10; + $key = $key . '-' . ($key + 10) . '%'; + $result['class'][$key]++; + } + } + + return [ + 'class' => \json_encode(\array_values($result['class'])), + 'method' => \json_encode(\array_values($result['method'])) + ]; + } + + /** + * Returns the classes / methods with insufficient coverage. + * + * @param array $classes + * @param string $baseLink + * + * @return array + */ + protected function insufficientCoverage(array $classes, $baseLink) + { + $leastTestedClasses = []; + $leastTestedMethods = []; + $result = ['class' => '', 'method' => '']; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] < $this->highLowerBound) { + $key = $methodName; + + if ($className !== '*') { + $key = $className . '::' . $methodName; + } + + $leastTestedMethods[$key] = $method['coverage']; + } + } + + if ($class['coverage'] < $this->highLowerBound) { + $leastTestedClasses[$className] = $class['coverage']; + } + } + + \asort($leastTestedClasses); + \asort($leastTestedMethods); + + foreach ($leastTestedClasses as $className => $coverage) { + $result['class'] .= \sprintf( + ' %s%d%%' . "\n", + \str_replace($baseLink, '', $classes[$className]['link']), + $className, + $coverage + ); + } + + foreach ($leastTestedMethods as $methodName => $coverage) { + list($class, $method) = \explode('::', $methodName); + + $result['method'] .= \sprintf( + ' %s%d%%' . "\n", + \str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), + $methodName, + $method, + $coverage + ); + } + + return $result; + } + + /** + * Returns the project risks according to the CRAP index. + * + * @param array $classes + * @param string $baseLink + * + * @return array + */ + protected function projectRisks(array $classes, $baseLink) + { + $classRisks = []; + $methodRisks = []; + $result = ['class' => '', 'method' => '']; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] < $this->highLowerBound && + $method['ccn'] > 1) { + if ($className !== '*') { + $key = $className . '::' . $methodName; + } else { + $key = $methodName; + } + + $methodRisks[$key] = $method['crap']; + } + } + + if ($class['coverage'] < $this->highLowerBound && + $class['ccn'] > \count($class['methods'])) { + $classRisks[$className] = $class['crap']; + } + } + + \arsort($classRisks); + \arsort($methodRisks); + + foreach ($classRisks as $className => $crap) { + $result['class'] .= \sprintf( + ' %s%d' . "\n", + \str_replace($baseLink, '', $classes[$className]['link']), + $className, + $crap + ); + } + + foreach ($methodRisks as $methodName => $crap) { + list($class, $method) = \explode('::', $methodName); + + $result['method'] .= \sprintf( + ' %s%d' . "\n", + \str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), + $methodName, + $method, + $crap + ); + } + + return $result; + } + + protected function getActiveBreadcrumb(AbstractNode $node) + { + return \sprintf( + '
  • %s
  • ' . "\n" . + '
  • (Dashboard)
  • ' . "\n", + $node->getName() + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php new file mode 100644 index 0000000..59e5a3b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode as Node; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; + +/** + * Renders a directory node. + */ +class Directory extends Renderer +{ + /** + * @param DirectoryNode $node + * @param string $file + */ + public function render(DirectoryNode $node, $file) + { + $template = new \Text_Template($this->templatePath . 'directory.html', '{{', '}}'); + + $this->setCommonTemplateVariables($template, $node); + + $items = $this->renderItem($node, true); + + foreach ($node->getDirectories() as $item) { + $items .= $this->renderItem($item); + } + + foreach ($node->getFiles() as $item) { + $items .= $this->renderItem($item); + } + + $template->setVar( + [ + 'id' => $node->getId(), + 'items' => $items + ] + ); + + $template->renderTo($file); + } + + /** + * @param Node $node + * @param bool $total + * + * @return string + */ + protected function renderItem(Node $node, $total = false) + { + $data = [ + 'numClasses' => $node->getNumClassesAndTraits(), + 'numTestedClasses' => $node->getNumTestedClassesAndTraits(), + 'numMethods' => $node->getNumFunctionsAndMethods(), + 'numTestedMethods' => $node->getNumTestedFunctionsAndMethods(), + 'linesExecutedPercent' => $node->getLineExecutedPercent(false), + 'linesExecutedPercentAsString' => $node->getLineExecutedPercent(), + 'numExecutedLines' => $node->getNumExecutedLines(), + 'numExecutableLines' => $node->getNumExecutableLines(), + 'testedMethodsPercent' => $node->getTestedFunctionsAndMethodsPercent(false), + 'testedMethodsPercentAsString' => $node->getTestedFunctionsAndMethodsPercent(), + 'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false), + 'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent() + ]; + + if ($total) { + $data['name'] = 'Total'; + } else { + if ($node instanceof DirectoryNode) { + $data['name'] = \sprintf( + '%s', + $node->getName(), + $node->getName() + ); + + $data['icon'] = ' '; + } else { + $data['name'] = \sprintf( + '%s', + $node->getName(), + $node->getName() + ); + + $data['icon'] = ' '; + } + } + + return $this->renderItemTemplate( + new \Text_Template($this->templatePath . 'directory_item.html', '{{', '}}'), + $data + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php new file mode 100644 index 0000000..d2016b3 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php @@ -0,0 +1,574 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\File as FileNode; +use SebastianBergmann\CodeCoverage\Util; + +/** + * Renders a file node. + */ +class File extends Renderer +{ + /** + * @var int + */ + private $htmlspecialcharsFlags; + + /** + * Constructor. + * + * @param string $templatePath + * @param string $generator + * @param string $date + * @param int $lowUpperBound + * @param int $highLowerBound + */ + public function __construct($templatePath, $generator, $date, $lowUpperBound, $highLowerBound) + { + parent::__construct( + $templatePath, + $generator, + $date, + $lowUpperBound, + $highLowerBound + ); + + $this->htmlspecialcharsFlags = ENT_COMPAT; + + $this->htmlspecialcharsFlags = $this->htmlspecialcharsFlags | ENT_HTML401 | ENT_SUBSTITUTE; + } + + /** + * @param FileNode $node + * @param string $file + */ + public function render(FileNode $node, $file) + { + $template = new \Text_Template($this->templatePath . 'file.html', '{{', '}}'); + + $template->setVar( + [ + 'items' => $this->renderItems($node), + 'lines' => $this->renderSource($node) + ] + ); + + $this->setCommonTemplateVariables($template, $node); + + $template->renderTo($file); + } + + /** + * @param FileNode $node + * + * @return string + */ + protected function renderItems(FileNode $node) + { + $template = new \Text_Template($this->templatePath . 'file_item.html', '{{', '}}'); + + $methodItemTemplate = new \Text_Template( + $this->templatePath . 'method_item.html', + '{{', + '}}' + ); + + $items = $this->renderItemTemplate( + $template, + [ + 'name' => 'Total', + 'numClasses' => $node->getNumClassesAndTraits(), + 'numTestedClasses' => $node->getNumTestedClassesAndTraits(), + 'numMethods' => $node->getNumFunctionsAndMethods(), + 'numTestedMethods' => $node->getNumTestedFunctionsAndMethods(), + 'linesExecutedPercent' => $node->getLineExecutedPercent(false), + 'linesExecutedPercentAsString' => $node->getLineExecutedPercent(), + 'numExecutedLines' => $node->getNumExecutedLines(), + 'numExecutableLines' => $node->getNumExecutableLines(), + 'testedMethodsPercent' => $node->getTestedFunctionsAndMethodsPercent(false), + 'testedMethodsPercentAsString' => $node->getTestedFunctionsAndMethodsPercent(), + 'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false), + 'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent(), + 'crap' => 'CRAP' + ] + ); + + $items .= $this->renderFunctionItems( + $node->getFunctions(), + $methodItemTemplate + ); + + $items .= $this->renderTraitOrClassItems( + $node->getTraits(), + $template, + $methodItemTemplate + ); + + $items .= $this->renderTraitOrClassItems( + $node->getClasses(), + $template, + $methodItemTemplate + ); + + return $items; + } + + /** + * @param array $items + * @param \Text_Template $template + * @param \Text_Template $methodItemTemplate + * + * @return string + */ + protected function renderTraitOrClassItems(array $items, \Text_Template $template, \Text_Template $methodItemTemplate) + { + $buffer = ''; + + if (empty($items)) { + return $buffer; + } + + foreach ($items as $name => $item) { + $numMethods = 0; + $numTestedMethods = 0; + + foreach ($item['methods'] as $method) { + if ($method['executableLines'] > 0) { + $numMethods++; + + if ($method['executedLines'] === $method['executableLines']) { + $numTestedMethods++; + } + } + } + + if ($item['executableLines'] > 0) { + $numClasses = 1; + $numTestedClasses = $numTestedMethods == $numMethods ? 1 : 0; + $linesExecutedPercentAsString = Util::percent( + $item['executedLines'], + $item['executableLines'], + true + ); + } else { + $numClasses = 'n/a'; + $numTestedClasses = 'n/a'; + $linesExecutedPercentAsString = 'n/a'; + } + + $buffer .= $this->renderItemTemplate( + $template, + [ + 'name' => $name, + 'numClasses' => $numClasses, + 'numTestedClasses' => $numTestedClasses, + 'numMethods' => $numMethods, + 'numTestedMethods' => $numTestedMethods, + 'linesExecutedPercent' => Util::percent( + $item['executedLines'], + $item['executableLines'], + false + ), + 'linesExecutedPercentAsString' => $linesExecutedPercentAsString, + 'numExecutedLines' => $item['executedLines'], + 'numExecutableLines' => $item['executableLines'], + 'testedMethodsPercent' => Util::percent( + $numTestedMethods, + $numMethods, + false + ), + 'testedMethodsPercentAsString' => Util::percent( + $numTestedMethods, + $numMethods, + true + ), + 'testedClassesPercent' => Util::percent( + $numTestedMethods == $numMethods ? 1 : 0, + 1, + false + ), + 'testedClassesPercentAsString' => Util::percent( + $numTestedMethods == $numMethods ? 1 : 0, + 1, + true + ), + 'crap' => $item['crap'] + ] + ); + + foreach ($item['methods'] as $method) { + $buffer .= $this->renderFunctionOrMethodItem( + $methodItemTemplate, + $method, + ' ' + ); + } + } + + return $buffer; + } + + /** + * @param array $functions + * @param \Text_Template $template + * + * @return string + */ + protected function renderFunctionItems(array $functions, \Text_Template $template) + { + if (empty($functions)) { + return ''; + } + + $buffer = ''; + + foreach ($functions as $function) { + $buffer .= $this->renderFunctionOrMethodItem( + $template, + $function + ); + } + + return $buffer; + } + + /** + * @param \Text_Template $template + * + * @return string + */ + protected function renderFunctionOrMethodItem(\Text_Template $template, array $item, $indent = '') + { + $numMethods = 0; + $numTestedMethods = 0; + + if ($item['executableLines'] > 0) { + $numMethods = 1; + + if ($item['executedLines'] === $item['executableLines']) { + $numTestedMethods = 1; + } + } + + return $this->renderItemTemplate( + $template, + [ + 'name' => \sprintf( + '%s%s', + $indent, + $item['startLine'], + \htmlspecialchars($item['signature']), + isset($item['functionName']) ? $item['functionName'] : $item['methodName'] + ), + 'numMethods' => $numMethods, + 'numTestedMethods' => $numTestedMethods, + 'linesExecutedPercent' => Util::percent( + $item['executedLines'], + $item['executableLines'], + false + ), + 'linesExecutedPercentAsString' => Util::percent( + $item['executedLines'], + $item['executableLines'], + true + ), + 'numExecutedLines' => $item['executedLines'], + 'numExecutableLines' => $item['executableLines'], + 'testedMethodsPercent' => Util::percent( + $numTestedMethods, + 1, + false + ), + 'testedMethodsPercentAsString' => Util::percent( + $numTestedMethods, + 1, + true + ), + 'crap' => $item['crap'] + ] + ); + } + + /** + * @param FileNode $node + * + * @return string + */ + protected function renderSource(FileNode $node) + { + $coverageData = $node->getCoverageData(); + $testData = $node->getTestData(); + $codeLines = $this->loadFile($node->getPath()); + $lines = ''; + $i = 1; + + foreach ($codeLines as $line) { + $trClass = ''; + $popoverContent = ''; + $popoverTitle = ''; + + if (\array_key_exists($i, $coverageData)) { + $numTests = ($coverageData[$i] ? \count($coverageData[$i]) : 0); + + if ($coverageData[$i] === null) { + $trClass = ' class="warning"'; + } elseif ($numTests == 0) { + $trClass = ' class="danger"'; + } else { + $lineCss = 'covered-by-large-tests'; + $popoverContent = '
      '; + + if ($numTests > 1) { + $popoverTitle = $numTests . ' tests cover line ' . $i; + } else { + $popoverTitle = '1 test covers line ' . $i; + } + + foreach ($coverageData[$i] as $test) { + if ($lineCss == 'covered-by-large-tests' && $testData[$test]['size'] == 'medium') { + $lineCss = 'covered-by-medium-tests'; + } elseif ($testData[$test]['size'] == 'small') { + $lineCss = 'covered-by-small-tests'; + } + + switch ($testData[$test]['status']) { + case 0: + switch ($testData[$test]['size']) { + case 'small': + $testCSS = ' class="covered-by-small-tests"'; + + break; + + case 'medium': + $testCSS = ' class="covered-by-medium-tests"'; + + break; + + default: + $testCSS = ' class="covered-by-large-tests"'; + + break; + } + + break; + + case 1: + case 2: + $testCSS = ' class="warning"'; + + break; + + case 3: + $testCSS = ' class="danger"'; + + break; + + case 4: + $testCSS = ' class="danger"'; + + break; + + default: + $testCSS = ''; + } + + $popoverContent .= \sprintf( + '%s', + $testCSS, + \htmlspecialchars($test) + ); + } + + $popoverContent .= '
    '; + $trClass = ' class="' . $lineCss . ' popin"'; + } + } + + if (!empty($popoverTitle)) { + $popover = \sprintf( + ' data-title="%s" data-content="%s" data-placement="bottom" data-html="true"', + $popoverTitle, + \htmlspecialchars($popoverContent) + ); + } else { + $popover = ''; + } + + $lines .= \sprintf( + ' %s' . "\n", + $trClass, + $popover, + $i, + $i, + $i, + $line + ); + + $i++; + } + + return $lines; + } + + /** + * @param string $file + * + * @return array + */ + protected function loadFile($file) + { + $buffer = \file_get_contents($file); + $tokens = \token_get_all($buffer); + $result = ['']; + $i = 0; + $stringFlag = false; + $fileEndsWithNewLine = \substr($buffer, -1) == "\n"; + + unset($buffer); + + foreach ($tokens as $j => $token) { + if (\is_string($token)) { + if ($token === '"' && $tokens[$j - 1] !== '\\') { + $result[$i] .= \sprintf( + '%s', + \htmlspecialchars($token) + ); + + $stringFlag = !$stringFlag; + } else { + $result[$i] .= \sprintf( + '%s', + \htmlspecialchars($token) + ); + } + + continue; + } + + list($token, $value) = $token; + + $value = \str_replace( + ["\t", ' '], + ['    ', ' '], + \htmlspecialchars($value, $this->htmlspecialcharsFlags) + ); + + if ($value === "\n") { + $result[++$i] = ''; + } else { + $lines = \explode("\n", $value); + + foreach ($lines as $jj => $line) { + $line = \trim($line); + + if ($line !== '') { + if ($stringFlag) { + $colour = 'string'; + } else { + switch ($token) { + case T_INLINE_HTML: + $colour = 'html'; + + break; + + case T_COMMENT: + case T_DOC_COMMENT: + $colour = 'comment'; + + break; + + case T_ABSTRACT: + case T_ARRAY: + case T_AS: + case T_BREAK: + case T_CALLABLE: + case T_CASE: + case T_CATCH: + case T_CLASS: + case T_CLONE: + case T_CONTINUE: + case T_DEFAULT: + case T_ECHO: + case T_ELSE: + case T_ELSEIF: + case T_EMPTY: + case T_ENDDECLARE: + case T_ENDFOR: + case T_ENDFOREACH: + case T_ENDIF: + case T_ENDSWITCH: + case T_ENDWHILE: + case T_EXIT: + case T_EXTENDS: + case T_FINAL: + case T_FINALLY: + case T_FOREACH: + case T_FUNCTION: + case T_GLOBAL: + case T_IF: + case T_IMPLEMENTS: + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_INSTANCEOF: + case T_INSTEADOF: + case T_INTERFACE: + case T_ISSET: + case T_LOGICAL_AND: + case T_LOGICAL_OR: + case T_LOGICAL_XOR: + case T_NAMESPACE: + case T_NEW: + case T_PRIVATE: + case T_PROTECTED: + case T_PUBLIC: + case T_REQUIRE: + case T_REQUIRE_ONCE: + case T_RETURN: + case T_STATIC: + case T_THROW: + case T_TRAIT: + case T_TRY: + case T_UNSET: + case T_USE: + case T_VAR: + case T_WHILE: + case T_YIELD: + $colour = 'keyword'; + + break; + + default: + $colour = 'default'; + } + } + + $result[$i] .= \sprintf( + '%s', + $colour, + $line + ); + } + + if (isset($lines[$jj + 1])) { + $result[++$i] = ''; + } + } + } + } + + if ($fileEndsWithNewLine) { + unset($result[\count($result) - 1]); + } + + return $result; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist new file mode 100644 index 0000000..5a09c35 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist @@ -0,0 +1,5 @@ +
    +
    + {{percent}}% covered ({{level}}) +
    +
    diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css new file mode 100644 index 0000000..ed3905e --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css @@ -0,0 +1,6 @@ +/*! + * Bootstrap v3.3.7 (http://getbootstrap.com) + * Copyright 2011-2016 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} +/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css new file mode 100644 index 0000000..7a6f7fe --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css @@ -0,0 +1 @@ +.nvd3 .nv-axis{pointer-events:none;opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:rgba(0,0,0,0)}.nvd3 .nv-bars .hover text{fill:rgba(0,0,0,1)}.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect,.nvd3 .nv-discretebar .nv-groups rect{stroke-opacity:0;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:rgba(0,0,0,1);stroke:rgba(0,0,0,0)}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover{fill-opacity:1}.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nvd3 .nv-legend .nv-disabled rect{}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-scatter .nv-groups .nv-point.hover,.nvd3 .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-ms-user-select:none;-moz-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nvd3 text{font:400 12px Arial}.nvd3 .title{font:700 14px Arial}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#EEE;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:rgba(19,196,249,.59)}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{stroke:#fff;stroke-width:1px;stroke-opacity:1}.nvd3.nv-pie .hover path{fill-opacity:.7}.nvd3.nv-pie .nv-label{pointer-events:none}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nv-noninteractive{pointer-events:none}.nv-distx,.nv-disty{pointer-events:none}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:rgba(255,255,255,1);color:rgba(0,0,0,1);padding:1px;border:1px solid rgba(0,0,0,.2);z-index:10000;display:block;font-family:Arial;font-size:13px;text-align:left;pointer-events:none;white-space:nowrap;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.nvtooltip{background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;-moz-transition:opacity 50ms linear;-webkit-transition:opacity 50ms linear;transition-delay:200ms;-moz-transition-delay:200ms;-webkit-transition-delay:200ms}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{margin:0;padding:4px 14px;line-height:18px;font-weight:400;background-color:rgba(247,247,247,.75);color:rgba(0,0,0,1);text-align:center;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.nvtooltip p{margin:0;padding:5px 14px;text-align:center}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key{font-weight:400}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{width:8px;height:8px;vertical-align:middle}.nvtooltip table td.legend-color-guide div{width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 .nv-interactiveGuideLine{pointer-events:none}.nvd3 line.nv-guideline{stroke:#ccc} \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css new file mode 100644 index 0000000..824fb31 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css @@ -0,0 +1,122 @@ +body { + padding-top: 10px; +} + +.popover { + max-width: none; +} + +.glyphicon { + margin-right:.25em; +} + +.table-bordered>thead>tr>td { + border-bottom-width: 1px; +} + +.table tbody>tr>td, .table thead>tr>td { + padding-top: 3px; + padding-bottom: 3px; +} + +.table-condensed tbody>tr>td { + padding-top: 0; + padding-bottom: 0; +} + +.table .progress { + margin-bottom: inherit; +} + +.table-borderless th, .table-borderless td { + border: 0 !important; +} + +.table tbody tr.covered-by-large-tests, li.covered-by-large-tests, tr.success, td.success, li.success, span.success { + background-color: #dff0d8; +} + +.table tbody tr.covered-by-medium-tests, li.covered-by-medium-tests { + background-color: #c3e3b5; +} + +.table tbody tr.covered-by-small-tests, li.covered-by-small-tests { + background-color: #99cb84; +} + +.table tbody tr.danger, .table tbody td.danger, li.danger, span.danger { + background-color: #f2dede; +} + +.table tbody td.warning, li.warning, span.warning { + background-color: #fcf8e3; +} + +.table tbody td.info { + background-color: #d9edf7; +} + +td.big { + width: 117px; +} + +td.small { +} + +td.codeLine { + font-family: monospace; + white-space: pre; +} + +td span.comment { + color: #888a85; +} + +td span.default { + color: #2e3436; +} + +td span.html { + color: #888a85; +} + +td span.keyword { + color: #2e3436; + font-weight: bold; +} + +pre span.string { + color: #2e3436; +} + +span.success, span.warning, span.danger { + margin-right: 2px; + padding-left: 10px; + padding-right: 10px; + text-align: center; +} + +#classCoverageDistribution, #classComplexity { + height: 200px; + width: 475px; +} + +#toplink { + position: fixed; + left: 5px; + bottom: 5px; + outline: 0; +} + +svg text { + font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #666; + fill: #666; +} + +.scrollbox { + height:245px; + overflow-x:hidden; + overflow-y:scroll; +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist new file mode 100644 index 0000000..f45eb57 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist @@ -0,0 +1,284 @@ + + + + + Dashboard for {{full_path}} + + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +
    +
    +

    Coverage Distribution

    +
    + +
    +
    +
    +

    Complexity

    +
    + +
    +
    +
    +
    +
    +

    Insufficient Coverage

    +
    + + + + + + + + +{{insufficient_coverage_classes}} + +
    ClassCoverage
    +
    +
    +
    +

    Project Risks

    +
    + + + + + + + + +{{project_risks_classes}} + +
    ClassCRAP
    +
    +
    +
    +
    +
    +

    Methods

    +
    +
    +
    +
    +

    Coverage Distribution

    +
    + +
    +
    +
    +

    Complexity

    +
    + +
    +
    +
    +
    +
    +

    Insufficient Coverage

    +
    + + + + + + + + +{{insufficient_coverage_methods}} + +
    MethodCoverage
    +
    +
    +
    +

    Project Risks

    +
    + + + + + + + + +{{project_risks_methods}} + +
    MethodCRAP
    +
    +
    +
    + +
    + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist new file mode 100644 index 0000000..7c07924 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist @@ -0,0 +1,61 @@ + + + + + Code Coverage for {{full_path}} + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + +{{items}} + +
     
    Code Coverage
     
    Lines
    Functions and Methods
    Classes and Traits
    +
    +
    +

    Legend

    +

    + Low: 0% to {{low_upper_bound}}% + Medium: {{low_upper_bound}}% to {{high_lower_bound}}% + High: {{high_lower_bound}}% to 100% +

    +

    + Generated by php-code-coverage {{version}} using {{runtime}}{{generator}} at {{date}}. +

    +
    +
    + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist new file mode 100644 index 0000000..78dbb35 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist @@ -0,0 +1,13 @@ + + {{icon}}{{name}} + {{lines_bar}} +
    {{lines_executed_percent}}
    +
    {{lines_number}}
    + {{methods_bar}} +
    {{methods_tested_percent}}
    +
    {{methods_number}}
    + {{classes_bar}} +
    {{classes_tested_percent}}
    +
    {{classes_number}}
    + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist new file mode 100644 index 0000000..ba03f0e --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist @@ -0,0 +1,68 @@ + + + + + Code Coverage for {{full_path}} + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + +{{items}} + +
     
    Code Coverage
     
    Classes and Traits
    Functions and Methods
    Lines
    + + +{{lines}} + +
    +
    +
    +

    Legend

    +

    + Executed + Not Executed + Dead Code +

    +

    + Generated by php-code-coverage {{version}} using {{runtime}}{{generator}} at {{date}}. +

    + +
    +
    + + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist new file mode 100644 index 0000000..756fdd6 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist @@ -0,0 +1,14 @@ + + {{name}} + {{classes_bar}} +
    {{classes_tested_percent}}
    +
    {{classes_number}}
    + {{methods_bar}} +
    {{methods_tested_percent}}
    +
    {{methods_number}}
    + {{crap}} + {{lines_bar}} +
    {{lines_executed_percent}}
    +
    {{lines_number}}
    + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.eot b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.eot differ diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.svg b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..94fb549 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.ttf b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 Binary files /dev/null and b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.ttf differ diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 Binary files /dev/null and b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff differ diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff2 b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 Binary files /dev/null and b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js new file mode 100644 index 0000000..9bcd2fc --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v3.3.7 (http://getbootstrap.com) + * Copyright 2011-2016 Twitter, Inc. + * Licensed under the MIT license + */ +if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
    ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/d3.min.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/d3.min.js new file mode 100644 index 0000000..1664873 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/d3.min.js @@ -0,0 +1,5 @@ +!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function i(n){return!isNaN(n)}function u(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)<0?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)>0?i=u:r=u+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function f(n){return(n+="")===bo||n[0]===_o?_o+n:n}function s(n){return(n+="")[0]===_o?n.slice(1):n}function h(n){return f(n)in this._}function p(n){return(n=f(n))in this._&&delete this._[n]}function g(){var n=[];for(var t in this._)n.push(s(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function y(){this._=Object.create(null)}function m(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=wo.length;r>e;++e){var i=wo[e]+t;if(i in n)return i}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,i=-1,u=r.length;++ie;e++)for(var i,u=n[e],o=0,a=u.length;a>o;o++)(i=u[o])&&t(i,o,e);return n}function Z(n){return ko(n,qo),n}function V(n){var t,e;return function(r,i,u){var o,a=n[u].update,l=a.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(o=a[t])&&++t0&&(n=n.slice(0,a));var c=To.get(n);return c&&(n=c,l=B),a?t?i:r:t?b:u}function $(n,t){return function(e){var r=ao.event;ao.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ao.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Do,i="click"+r,u=ao.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==Ro&&(Ro="onselectstart"in e?!1:x(e.style,"userSelect")),Ro){var o=n(e).style,a=o[Ro];o[Ro]="none"}return function(n){if(u.on(r,null),Ro&&(o[Ro]=a),n){var t=function(){u.on(i,null)};u.on(i,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>Po){var u=t(n);if(u.scrollX||u.scrollY){r=ao.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Po=!(o.f||o.e),r.remove()}}return Po?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}function G(){return ao.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nn(n){return n>1?0:-1>n?Fo:Math.acos(n)}function tn(n){return n>1?Io:-1>n?-Io:Math.asin(n)}function en(n){return((n=Math.exp(n))-1/n)/2}function rn(n){return((n=Math.exp(n))+1/n)/2}function un(n){return((n=Math.exp(2*n))-1)/(n+1)}function on(n){return(n=Math.sin(n/2))*n}function an(){}function ln(n,t,e){return this instanceof ln?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ln?new ln(n.h,n.s,n.l):_n(""+n,wn,ln):new ln(n,t,e)}function cn(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(o-u)*n/60:180>n?o:240>n?u+(o-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,u=2*e-o,new mn(i(n+120),i(n),i(n-120))}function fn(n,t,e){return this instanceof fn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof fn?new fn(n.h,n.c,n.l):n instanceof hn?gn(n.l,n.a,n.b):gn((n=Sn((n=ao.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new fn(n,t,e)}function sn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new hn(e,Math.cos(n*=Yo)*t,Math.sin(n)*t)}function hn(n,t,e){return this instanceof hn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof hn?new hn(n.l,n.a,n.b):n instanceof fn?sn(n.h,n.c,n.l):Sn((n=mn(n)).r,n.g,n.b):new hn(n,t,e)}function pn(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=vn(i)*na,r=vn(r)*ta,u=vn(u)*ea,new mn(yn(3.2404542*i-1.5371385*r-.4985314*u),yn(-.969266*i+1.8760108*r+.041556*u),yn(.0556434*i-.2040259*r+1.0572252*u))}function gn(n,t,e){return n>0?new fn(Math.atan2(e,t)*Zo,Math.sqrt(t*t+e*e),n):new fn(NaN,NaN,n)}function vn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function yn(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mn(n,t,e){return this instanceof mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mn?new mn(n.r,n.g,n.b):_n(""+n,mn,cn):new mn(n,t,e)}function Mn(n){return new mn(n>>16,n>>8&255,255&n)}function xn(n){return Mn(n)+""}function bn(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _n(n,t,e){var r,i,u,o=0,a=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(Nn(i[0]),Nn(i[1]),Nn(i[2]))}return(u=ua.get(n))?t(u.r,u.g,u.b):(null==n||"#"!==n.charAt(0)||isNaN(u=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&u)>>4,o=o>>4|o,a=240&u,a=a>>4|a,l=15&u,l=l<<4|l):7===n.length&&(o=(16711680&u)>>16,a=(65280&u)>>8,l=255&u)),t(o,a,l))}function wn(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,l=(o+u)/2;return a?(i=.5>l?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new ln(r,i,l)}function Sn(n,t,e){n=kn(n),t=kn(t),e=kn(e);var r=dn((.4124564*n+.3575761*t+.1804375*e)/na),i=dn((.2126729*n+.7151522*t+.072175*e)/ta),u=dn((.0193339*n+.119192*t+.9503041*e)/ea);return hn(116*i-16,500*(r-i),200*(i-u))}function kn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Nn(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function En(n){return"function"==typeof n?n:function(){return n}}function An(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Cn(t,e,n,r)}}function Cn(n,t,e,r){function i(){var n,t=l.status;if(!t&&Ln(l)||t>=200&&300>t||304===t){try{n=e.call(u,l)}catch(r){return void o.error.call(u,r)}o.load.call(u,n)}else o.error.call(u,l)}var u={},o=ao.dispatch("beforesend","progress","load","error"),a={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(n)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(n){var t=ao.event;ao.event=n;try{o.progress.call(u,l)}finally{ao.event=t}},u.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",u):t},u.responseType=function(n){return arguments.length?(c=n,u):c},u.response=function(n){return e=n,u},["get","post"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(co(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),l.setRequestHeader)for(var f in a)l.setRequestHeader(f,a[f]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=i&&u.on("error",i).on("load",function(n){i(null,n)}),o.beforesend.call(u,l),l.send(null==r?null:r),u},u.abort=function(){return l.abort(),u},ao.rebind(u,o,"on"),null==r?u:u.get(zn(r))}function zn(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Ln(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qn(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={c:n,t:i,n:null};return aa?aa.n=u:oa=u,aa=u,la||(ca=clearTimeout(ca),la=1,fa(Tn)),u}function Tn(){var n=Rn(),t=Dn()-n;t>24?(isFinite(t)&&(clearTimeout(ca),ca=setTimeout(Tn,t)),la=0):(la=1,fa(Tn))}function Rn(){for(var n=Date.now(),t=oa;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Dn(){for(var n,t=oa,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function jn(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,u=r&&e?function(n,t){for(var i=n.length,u=[],o=0,a=r[0],l=0;i>0&&a>0&&(l+a+1>t&&(a=Math.max(1,t-l)),u.push(n.substring(i-=a,i+a)),!((l+=a+1)>t));)a=r[o=(o+1)%r.length];return u.reverse().join(e)}:m;return function(n){var e=ha.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],s=e[7],h=e[8],p=e[9],g=1,v="",d="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===o)&&(c=r="0",o="="),p){case"n":s=!0,p="g";break;case"%":g=100,d="%",p="f";break;case"p":g=100,d="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===l&&(v=i[0],d=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=pa.get(p)||Fn;var M=c&&s;return function(n){var e=d;if(y&&n%1)return"";var i=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>g){var l=ao.formatPrefix(n,h);n=l.scale(n),e=l.symbol+d}else n*=g;n=p(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=m?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!c&&s&&(x=u(x,1/0));var S=v.length+x.length+b.length+(M?0:i.length),k=f>S?new Array(S=f-S+1).join(r):"";return M&&(x=u(k+x,k.length?f-b.length:1/0)),i+=v,n=x+b,("<"===o?i+n+k:">"===o?k+i+n:"^"===o?k.substring(0,S>>=1)+i+n+k.substring(S):i+(M?n:k+n))+e}}}function Fn(n){return n+""}function Hn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function On(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new va(e-1)),1),e}function u(n,e){return t(n=new va(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{va=Hn;var r=new Hn;return r._=n,o(r,t,e)}finally{va=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var l=n.utc=In(n);return l.floor=l,l.round=In(r),l.ceil=In(i),l.offset=In(u),l.range=a,n}function In(n){return function(t,e){try{va=Hn;var r=new Hn;return r._=t,n(r,e)._}finally{va=Date}}}function Yn(n){function t(n){function t(t){for(var e,i,u,o=[],a=-1,l=0;++aa;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(o=t.charAt(a++),u=C[o in ya?t.charAt(a++):o],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function l(n,t,r){return e(n,A.x.toString(),t,r)}function c(n,t,r){return e(n,A.X.toString(),t,r)}function f(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var s=n.dateTime,h=n.date,p=n.time,g=n.periods,v=n.days,d=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{va=Hn;var t=new va;return t._=n,r(t)}finally{va=Date}}var r=t(n);return e.parse=function(n){try{va=Hn;var t=r.parse(n);return t&&t._}finally{va=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ct;var M=ao.map(),x=Vn(v),b=Xn(v),_=Vn(d),w=Xn(d),S=Vn(y),k=Xn(y),N=Vn(m),E=Xn(m);g.forEach(function(n,t){M.set(n.toLowerCase(),t)});var A={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(s),d:function(n,t){return Zn(n.getDate(),t,2)},e:function(n,t){return Zn(n.getDate(),t,2)},H:function(n,t){return Zn(n.getHours(),t,2)},I:function(n,t){return Zn(n.getHours()%12||12,t,2)},j:function(n,t){return Zn(1+ga.dayOfYear(n),t,3)},L:function(n,t){return Zn(n.getMilliseconds(),t,3)},m:function(n,t){return Zn(n.getMonth()+1,t,2)},M:function(n,t){return Zn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Zn(n.getSeconds(),t,2)},U:function(n,t){return Zn(ga.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Zn(ga.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Zn(n.getFullYear()%100,t,2)},Y:function(n,t){return Zn(n.getFullYear()%1e4,t,4)},Z:at,"%":function(){return"%"}},C={a:r,A:i,b:u,B:o,c:a,d:tt,e:tt,H:rt,I:rt,j:et,L:ot,m:nt,M:it,p:f,S:ut,U:Bn,w:$n,W:Wn,x:l,X:c,y:Gn,Y:Jn,Z:Kn,"%":lt};return t}function Zn(n,t,e){var r=0>n?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Vn(n){return new RegExp("^(?:"+n.map(ao.requote).join("|")+")","i")}function Xn(n){for(var t=new c,e=-1,r=n.length;++e68?1900:2e3)}function nt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function tt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function et(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function rt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function it(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ut(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ot(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function at(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=xo(t)/60|0,i=xo(t)%60;return e+Zn(r,"0",2)+Zn(i,"0",2)}function lt(n,t,e){Ma.lastIndex=0;var r=Ma.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ct(n){for(var t=n.length,e=-1;++e=0?1:-1,a=o*e,l=Math.cos(t),c=Math.sin(t),f=u*c,s=i*l+f*Math.cos(a),h=f*o*Math.sin(a);ka.add(Math.atan2(h,s)),r=n,i=l,u=c}var t,e,r,i,u;Na.point=function(o,a){Na.point=n,r=(t=o)*Yo,i=Math.cos(a=(e=a)*Yo/2+Fo/4),u=Math.sin(a)},Na.lineEnd=function(){n(t,e)}}function dt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function yt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Mt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function bt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function _t(n){return[Math.atan2(n[1],n[0]),tn(n[2])]}function wt(n,t){return xo(n[0]-t[0])a;++a)i.point((e=n[a])[0],e[1]);return void i.lineEnd()}var l=new Tt(e,n,null,!0),c=new Tt(e,null,l,!1);l.o=c,u.push(l),o.push(c),l=new Tt(r,n,null,!1),c=new Tt(r,null,l,!0),l.o=c,u.push(l),o.push(c)}}),o.sort(t),qt(u),qt(o),u.length){for(var a=0,l=e,c=o.length;c>a;++a)o[a].e=l=!l;for(var f,s,h=u[0];;){for(var p=h,g=!0;p.v;)if((p=p.n)===h)return;f=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(g)for(var a=0,c=f.length;c>a;++a)i.point((s=f[a])[0],s[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(g){f=p.p.z;for(var a=f.length-1;a>=0;--a)i.point((s=f[a])[0],s[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,f=p.z,g=!g}while(!p.v);i.lineEnd()}}}function qt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(b||(u.polygonStart(),b=!0),u.lineStart();++o1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Dt))}var p,g,v,d=t(u),y=i.invert(r[0],r[1]),m={point:o,lineStart:l,lineEnd:c,polygonStart:function(){m.point=f,m.lineStart=s,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=o,m.lineStart=l,m.lineEnd=c,p=ao.merge(p);var n=Ot(y,g);p.length?(b||(u.polygonStart(),b=!0),Lt(p,Ut,n,e,u)):n&&(b||(u.polygonStart(),b=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),b&&(u.polygonEnd(),b=!1),p=g=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}},M=Pt(),x=t(M),b=!1;return m}}function Dt(n){return n.length>1}function Pt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ut(n,t){return((n=n.x)[0]<0?n[1]-Io-Uo:Io-n[1])-((t=t.x)[0]<0?t[1]-Io-Uo:Io-t[1])}function jt(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(u,o){var a=u>0?Fo:-Fo,l=xo(u-e);xo(l-Fo)0?Io:-Io),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(u,r),t=0):i!==a&&l>=Fo&&(xo(e-i)Uo?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*o)):(t+r)/2}function Ht(n,t,e,r){var i;if(null==n)i=e*Io,r.point(-Fo,i),r.point(0,i),r.point(Fo,i),r.point(Fo,0),r.point(Fo,-i),r.point(0,-i),r.point(-Fo,-i),r.point(-Fo,0),r.point(-Fo,i);else if(xo(n[0]-t[0])>Uo){var u=n[0]a;++a){var c=t[a],f=c.length;if(f)for(var s=c[0],h=s[0],p=s[1]/2+Fo/4,g=Math.sin(p),v=Math.cos(p),d=1;;){d===f&&(d=0),n=c[d];var y=n[0],m=n[1]/2+Fo/4,M=Math.sin(m),x=Math.cos(m),b=y-h,_=b>=0?1:-1,w=_*b,S=w>Fo,k=g*M;if(ka.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),u+=S?b+_*Ho:b,S^h>=e^y>=e){var N=mt(dt(s),dt(n));bt(N);var E=mt(i,N);bt(E);var A=(S^b>=0?-1:1)*tn(E[2]);(r>A||r===A&&(N[0]||N[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=y,g=M,v=x,s=n}}return(-Uo>u||Uo>u&&-Uo>ka)^1&o}function It(n){function t(n,t){return Math.cos(n)*Math.cos(t)>u}function e(n){var e,u,l,c,f;return{lineStart:function(){c=l=!1,f=1},point:function(s,h){var p,g=[s,h],v=t(s,h),d=o?v?0:i(s,h):v?i(s+(0>s?Fo:-Fo),h):0;if(!e&&(c=l=v)&&n.lineStart(),v!==l&&(p=r(e,g),(wt(e,p)||wt(g,p))&&(g[0]+=Uo,g[1]+=Uo,v=t(g[0],g[1]))),v!==l)f=0,v?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&o^v){var y;d&u||!(y=r(g,e,!0))||(f=0,o?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!v||e&&wt(e,g)||n.point(g[0],g[1]),e=g,l=v,u=d},lineEnd:function(){l&&n.lineEnd(),e=null},clean:function(){return f|(c&&l)<<1}}}function r(n,t,e){var r=dt(n),i=dt(t),o=[1,0,0],a=mt(r,i),l=yt(a,a),c=a[0],f=l-c*c;if(!f)return!e&&n;var s=u*l/f,h=-u*c/f,p=mt(o,a),g=xt(o,s),v=xt(a,h);Mt(g,v);var d=p,y=yt(g,d),m=yt(d,d),M=y*y-m*(yt(g,g)-1);if(!(0>M)){var x=Math.sqrt(M),b=xt(d,(-y-x)/m);if(Mt(b,g),b=_t(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],N=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,A=xo(E-Fo)E;if(!A&&k>N&&(_=k,k=N,N=_),C?A?k+N>0^b[1]<(xo(b[0]-w)Fo^(w<=b[0]&&b[0]<=S)){var z=xt(d,(-y+x)/m);return Mt(z,g),[b,_t(z)]}}}function i(t,e){var r=o?n:Fo-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var u=Math.cos(n),o=u>0,a=xo(u)>Uo,l=ve(n,6*Yo);return Rt(t,e,l,o?[0,-n]:[-Fo,n-Fo])}function Yt(n,t,e,r){return function(i){var u,o=i.a,a=i.b,l=o.x,c=o.y,f=a.x,s=a.y,h=0,p=1,g=f-l,v=s-c;if(u=n-l,g||!(u>0)){if(u/=g,0>g){if(h>u)return;p>u&&(p=u)}else if(g>0){if(u>p)return;u>h&&(h=u)}if(u=e-l,g||!(0>u)){if(u/=g,0>g){if(u>p)return;u>h&&(h=u)}else if(g>0){if(h>u)return;p>u&&(p=u)}if(u=t-c,v||!(u>0)){if(u/=v,0>v){if(h>u)return;p>u&&(p=u)}else if(v>0){if(u>p)return;u>h&&(h=u)}if(u=r-c,v||!(0>u)){if(u/=v,0>v){if(u>p)return;u>h&&(h=u)}else if(v>0){if(h>u)return;p>u&&(p=u)}return h>0&&(i.a={x:l+h*g,y:c+h*v}),1>p&&(i.b={x:l+p*g,y:c+p*v}),i}}}}}}function Zt(n,t,e,r){function i(r,i){return xo(r[0]-n)0?0:3:xo(r[0]-e)0?2:1:xo(r[1]-t)0?1:0:i>0?3:2}function u(n,t){return o(n.x,t.x)}function o(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function l(n){for(var t=0,e=d.length,r=n[1],i=0;e>i;++i)for(var u,o=1,a=d[i],l=a.length,c=a[0];l>o;++o)u=a[o],c[1]<=r?u[1]>r&&Q(c,u,n)>0&&++t:u[1]<=r&&Q(c,u,n)<0&&--t,c=u;return 0!==t}function c(u,a,l,c){var f=0,s=0;if(null==u||(f=i(u,l))!==(s=i(a,l))||o(u,a)<0^l>0){do c.point(0===f||3===f?n:e,f>1?r:t);while((f=(f+l+4)%4)!==s)}else c.point(a[0],a[1])}function f(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function s(n,t){f(n,t)&&a.point(n,t)}function h(){C.point=g,d&&d.push(y=[]),S=!0,w=!1,b=_=NaN}function p(){v&&(g(m,M),x&&w&&E.rejoin(),v.push(E.buffer())),C.point=s,w&&a.lineEnd()}function g(n,t){n=Math.max(-Ha,Math.min(Ha,n)),t=Math.max(-Ha,Math.min(Ha,t));var e=f(n,t);if(d&&y.push([n,t]),S)m=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};A(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,y,m,M,x,b,_,w,S,k,N=a,E=Pt(),A=Yt(n,t,e,r),C={point:s,lineStart:h,lineEnd:p,polygonStart:function(){a=E,v=[],d=[],k=!0},polygonEnd:function(){a=N,v=ao.merge(v);var t=l([n,r]),e=k&&t,i=v.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),c(null,null,1,a),a.lineEnd()),i&&Lt(v,u,t,c,a),a.polygonEnd()),v=d=y=null}};return C}}function Vt(n){var t=0,e=Fo/3,r=ae(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fo/180,e=n[1]*Fo/180):[t/Fo*180,e/Fo*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),o-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),o=Math.sqrt(u)/i;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/i,tn((u-(n*n+e*e)*i*i)/(2*i))]},e}function $t(){function n(n,t){Ia+=i*n-r*t,r=n,i=t}var t,e,r,i;$a.point=function(u,o){$a.point=n,t=r=u,e=i=o},$a.lineEnd=function(){n(t,e)}}function Bt(n,t){Ya>n&&(Ya=n),n>Va&&(Va=n),Za>t&&(Za=t),t>Xa&&(Xa=t)}function Wt(){function n(n,t){o.push("M",n,",",t,u)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function i(){o.push("Z")}var u=Jt(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return u=Jt(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Jt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Gt(n,t){Ca+=n,za+=t,++La}function Kt(){function n(n,r){var i=n-t,u=r-e,o=Math.sqrt(i*i+u*u);qa+=o*(t+n)/2,Ta+=o*(e+r)/2,Ra+=o,Gt(t=n,e=r)}var t,e;Wa.point=function(r,i){Wa.point=n,Gt(t=r,e=i)}}function Qt(){Wa.point=Gt}function ne(){function n(n,t){var e=n-r,u=t-i,o=Math.sqrt(e*e+u*u);qa+=o*(r+n)/2,Ta+=o*(i+t)/2,Ra+=o,o=i*n-r*t,Da+=o*(r+n),Pa+=o*(i+t),Ua+=3*o,Gt(r=n,i=t)}var t,e,r,i;Wa.point=function(u,o){Wa.point=n,Gt(t=r=u,e=i=o)},Wa.lineEnd=function(){n(t,e)}}function te(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Ho)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function u(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return o=n,a},result:b};return a}function ee(n){function t(n){return(a?r:e)(n)}function e(t){return ue(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=NaN,S.point=u,t.lineStart()}function u(e,r){var u=dt([e,r]),o=n(e,r);i(M,x,m,b,_,w,M=o[0],x=o[1],m=e,b=u[0],_=u[1],w=u[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function l(){ +r(),S.point=c,S.lineEnd=f}function c(n,t){u(s=n,h=t),p=M,g=x,v=b,d=_,y=w,S.point=u}function f(){i(M,x,m,b,_,w,p,g,s,v,d,y,a,t),S.lineEnd=o,o()}var s,h,p,g,v,d,y,m,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=l},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function i(t,e,r,a,l,c,f,s,h,p,g,v,d,y){var m=f-t,M=s-e,x=m*m+M*M;if(x>4*u&&d--){var b=a+p,_=l+g,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),N=xo(xo(w)-1)u||xo((m*z+M*L)/x-.5)>.3||o>a*p+l*g+c*v)&&(i(t,e,r,a,l,c,A,C,N,b/=S,_/=S,w,d,y),y.point(A,C),i(A,C,N,b,_,w,f,s,h,p,g,v,d,y))}}var u=.5,o=Math.cos(30*Yo),a=16;return t.precision=function(n){return arguments.length?(a=(u=n*n)>0&&16,t):Math.sqrt(u)},t}function re(n){var t=ee(function(t,e){return n([t*Zo,e*Zo])});return function(n){return le(t(n))}}function ie(n){this.stream=n}function ue(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function oe(n){return ae(function(){return n})()}function ae(n){function t(n){return n=a(n[0]*Yo,n[1]*Yo),[n[0]*h+l,c-n[1]*h]}function e(n){return n=a.invert((n[0]-l)/h,(c-n[1])/h),n&&[n[0]*Zo,n[1]*Zo]}function r(){a=Ct(o=se(y,M,x),u);var n=u(v,d);return l=p-n[0]*h,c=g+n[1]*h,i()}function i(){return f&&(f.valid=!1,f=null),t}var u,o,a,l,c,f,s=ee(function(n,t){return n=u(n,t),[n[0]*h+l,c-n[1]*h]}),h=150,p=480,g=250,v=0,d=0,y=0,M=0,x=0,b=Fa,_=m,w=null,S=null;return t.stream=function(n){return f&&(f.valid=!1),f=le(b(o,s(_(n)))),f.valid=!0,f},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Fa):It((w=+n)*Yo),i()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Zt(n[0][0],n[0][1],n[1][0],n[1][1]):m,i()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(v=n[0]%360*Yo,d=n[1]%360*Yo,r()):[v*Zo,d*Zo]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yo,M=n[1]%360*Yo,x=n.length>2?n[2]%360*Yo:0,r()):[y*Zo,M*Zo,x*Zo]},ao.rebind(t,s,"precision"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function le(n){return ue(n,function(t,e){n.point(t*Yo,e*Yo)})}function ce(n,t){return[n,t]}function fe(n,t){return[n>Fo?n-Ho:-Fo>n?n+Ho:n,t]}function se(n,t,e){return n?t||e?Ct(pe(n),ge(t,e)):pe(n):t||e?ge(t,e):fe}function he(n){return function(t,e){return t+=n,[t>Fo?t-Ho:-Fo>t?t+Ho:t,e]}}function pe(n){var t=he(n);return t.invert=he(-n),t}function ge(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*r+a*i;return[Math.atan2(l*u-f*o,a*r-c*i),tn(f*u+l*o)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*u-l*o;return[Math.atan2(l*u+c*o,a*r+f*i),tn(f*r-a*i)]},e}function ve(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,o,a){var l=o*t;null!=i?(i=de(e,i),u=de(e,u),(o>0?u>i:i>u)&&(i+=o*Ho)):(i=n+o*Ho,u=n-.5*l);for(var c,f=i;o>0?f>u:u>f;f-=l)a.point((c=_t([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function de(n,t){var e=dt(t);e[0]-=n,bt(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Uo)%(2*Math.PI)}function ye(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function me(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function Me(n){return n.source}function xe(n){return n.target}function be(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),o=Math.cos(r),a=Math.sin(r),l=i*Math.cos(n),c=i*Math.sin(n),f=o*Math.cos(e),s=o*Math.sin(e),h=2*Math.asin(Math.sqrt(on(r-t)+i*o*on(e-n))),p=1/Math.sin(h),g=h?function(n){var t=Math.sin(n*=h)*p,e=Math.sin(h-n)*p,r=e*l+t*f,i=e*c+t*s,o=e*u+t*a;return[Math.atan2(i,r)*Zo,Math.atan2(o,Math.sqrt(r*r+i*i))*Zo]}:function(){return[n*Zo,t*Zo]};return g.distance=h,g}function _e(){function n(n,i){var u=Math.sin(i*=Yo),o=Math.cos(i),a=xo((n*=Yo)-t),l=Math.cos(a);Ja+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*u-e*o*l)*a),e*u+r*o*l),t=n,e=u,r=o}var t,e,r;Ga.point=function(i,u){t=i*Yo,e=Math.sin(u*=Yo),r=Math.cos(u),Ga.point=n},Ga.lineEnd=function(){Ga.point=Ga.lineEnd=b}}function we(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),o=Math.cos(i);return[Math.atan2(n*u,r*o),Math.asin(r&&e*u/r)]},e}function Se(n,t){function e(n,t){o>0?-Io+Uo>t&&(t=-Io+Uo):t>Io-Uo&&(t=Io-Uo);var e=o/Math.pow(i(t),u);return[e*Math.sin(u*n),o-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fo/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),o=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=o-t,r=K(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(o/r,1/u))-Io]},e):Ne}function ke(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return xo(i)i;i++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function qe(n,t){return n[0]-t[0]||n[1]-t[1]}function Te(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Re(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,l=n[1],c=e[1],f=t[1]-l,s=r[1]-c,h=(a*(l-c)-s*(i-u))/(s*o-a*f);return[i+h*o,l+h*f]}function De(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Pe(){rr(this),this.edge=this.site=this.circle=null}function Ue(n){var t=cl.pop()||new Pe;return t.site=n,t}function je(n){Be(n),ol.remove(n),cl.push(n),rr(n)}function Fe(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},u=n.P,o=n.N,a=[n];je(n);for(var l=u;l.circle&&xo(e-l.circle.x)f;++f)c=a[f],l=a[f-1],nr(c.edge,l.site,c.site,i);l=a[0],c=a[s-1],c.edge=Ke(l.site,c.site,null,i),$e(l),$e(c)}function He(n){for(var t,e,r,i,u=n.x,o=n.y,a=ol._;a;)if(r=Oe(a,o)-u,r>Uo)a=a.L;else{if(i=u-Ie(a,o),!(i>Uo)){r>-Uo?(t=a.P,e=a):i>-Uo?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var l=Ue(n);if(ol.insert(t,l),t||e){if(t===e)return Be(t),e=Ue(t.site),ol.insert(l,e),l.edge=e.edge=Ke(t.site,l.site),$e(t),void $e(e);if(!e)return void(l.edge=Ke(t.site,l.site));Be(t),Be(e);var c=t.site,f=c.x,s=c.y,h=n.x-f,p=n.y-s,g=e.site,v=g.x-f,d=g.y-s,y=2*(h*d-p*v),m=h*h+p*p,M=v*v+d*d,x={x:(d*m-p*M)/y+f,y:(h*M-v*m)/y+s};nr(e.edge,c,g,x),l.edge=Ke(c,n,null,x),e.edge=Ke(n,g,null,x),$e(t),$e(e)}}function Oe(n,t){var e=n.site,r=e.x,i=e.y,u=i-t;if(!u)return r;var o=n.P;if(!o)return-(1/0);e=o.site;var a=e.x,l=e.y,c=l-t;if(!c)return a;var f=a-r,s=1/u-1/c,h=f/c;return s?(-h+Math.sqrt(h*h-2*s*(f*f/(-2*c)-l+c/2+i-u/2)))/s+r:(r+a)/2}function Ie(n,t){var e=n.N;if(e)return Oe(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ye(n){this.site=n,this.edges=[]}function Ze(n){for(var t,e,r,i,u,o,a,l,c,f,s=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],v=ul,d=v.length;d--;)if(u=v[d],u&&u.prepare())for(a=u.edges,l=a.length,o=0;l>o;)f=a[o].end(),r=f.x,i=f.y,c=a[++o%l].start(),t=c.x,e=c.y,(xo(r-t)>Uo||xo(i-e)>Uo)&&(a.splice(o,0,new tr(Qe(u.site,f,xo(r-s)Uo?{x:s,y:xo(t-s)Uo?{x:xo(e-g)Uo?{x:h,y:xo(t-h)Uo?{x:xo(e-p)=-jo)){var p=l*l+c*c,g=f*f+s*s,v=(s*p-c*g)/h,d=(l*g-f*p)/h,s=d+a,y=fl.pop()||new Xe;y.arc=n,y.site=i,y.x=v+o,y.y=s+Math.sqrt(v*v+d*d),y.cy=s,n.circle=y;for(var m=null,M=ll._;M;)if(y.yd||d>=a)return;if(h>g){if(u){if(u.y>=c)return}else u={x:d,y:l};e={x:d,y:c}}else{if(u){if(u.yr||r>1)if(h>g){if(u){if(u.y>=c)return}else u={x:(l-i)/r,y:l};e={x:(c-i)/r,y:c}}else{if(u){if(u.yp){if(u){if(u.x>=a)return}else u={x:o,y:r*o+i};e={x:a,y:r*a+i}}else{if(u){if(u.xu||s>o||r>h||i>p)){if(g=n.point){var g,v=t-n.x,d=e-n.y,y=v*v+d*d;if(l>y){var m=Math.sqrt(l=y);r=t-m,i=e-m,u=t+m,o=e+m,a=g}}for(var M=n.nodes,x=.5*(f+h),b=.5*(s+p),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:c(n,f,s,x,b);break;case 1:c(n,x,s,h,b);break;case 2:c(n,f,b,x,p);break;case 3:c(n,x,b,h,p)}}}(n,r,i,u,o),a}function vr(n,t){n=ao.rgb(n),t=ao.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+bn(Math.round(e+u*n))+bn(Math.round(r+o*n))+bn(Math.round(i+a*n))}}function dr(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Mr(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function yr(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mr(n,t){var e,r,i,u=hl.lastIndex=pl.lastIndex=0,o=-1,a=[],l=[];for(n+="",t+="";(e=hl.exec(n))&&(r=pl.exec(t));)(i=r.index)>u&&(i=t.slice(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:yr(e,r)})),u=pl.lastIndex;return ur;++r)a[(e=l[r]).i]=e.x(n);return a.join("")})}function Mr(n,t){for(var e,r=ao.interpolators.length;--r>=0&&!(e=ao.interpolators[r](n,t)););return e}function xr(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(Mr(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function br(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function _r(n){return function(t){return 1-n(1-t)}}function wr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function kr(n){return n*n*n}function Nr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function Ar(n){return 1-Math.cos(n*Io)}function Cr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ho*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ho/t)}}function qr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Tr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=ao.hcl(n),t=ao.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return sn(e+u*n,r+o*n,i+a*n)+""}}function Dr(n,t){n=ao.hsl(n),t=ao.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return cn(e+u*n,r+o*n,i+a*n)+""}}function Pr(n,t){n=ao.lab(n),t=ao.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return pn(e+u*n,r+o*n,i+a*n)+""}}function Ur(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function jr(n){var t=[n.a,n.b],e=[n.c,n.d],r=Hr(t),i=Fr(t,e),u=Hr(Or(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Ir(e)+"rotate(",null,")")-2,x:yr(n,t)})):t&&e.push(Ir(e)+"rotate("+t+")")}function Vr(n,t,e,r){n!==t?r.push({i:e.push(Ir(e)+"skewX(",null,")")-2,x:yr(n,t)}):t&&e.push(Ir(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Ir(e)+"scale(",null,",",null,")");r.push({i:i-4,x:yr(n[0],t[0])},{i:i-2,x:yr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Ir(e)+"scale("+t+")")}function $r(n,t){var e=[],r=[];return n=ao.transform(n),t=ao.transform(t),Yr(n.translate,t.translate,e,r),Zr(n.rotate,t.rotate,e,r),Vr(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,u=r.length;++i=0;)e.push(i[r])}function oi(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(u=n.children)&&(i=u.length))for(var i,u,o=-1;++oe;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function yi(n){return n.reduce(mi,0)}function mi(n,t){return n+t[1]}function Mi(n,t){return xi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function bi(n){return[ao.min(n),ao.max(n)]}function _i(n,t){return n.value-t.value}function wi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Si(n,t){n._pack_next=t,t._pack_prev=n}function ki(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ni(n){function t(n){f=Math.min(n.x-n.r,f),s=Math.max(n.x+n.r,s),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(c=e.length)){var e,r,i,u,o,a,l,c,f=1/0,s=-(1/0),h=1/0,p=-(1/0);if(e.forEach(Ei),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(i=e[1],i.x=i.r,i.y=0,t(i),c>2))for(u=e[2],zi(r,i,u),t(u),wi(r,u),r._pack_prev=u,wi(u,i),i=r._pack_next,o=3;c>o;o++){zi(r,i,u=e[o]);var g=0,v=1,d=1;for(a=i._pack_next;a!==i;a=a._pack_next,v++)if(ki(a,u)){g=1;break}if(1==g)for(l=r._pack_prev;l!==a._pack_prev&&!ki(l,u);l=l._pack_prev,d++);g?(d>v||v==d&&i.ro;o++)u=e[o],u.x-=y,u.y-=m,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Ai)}}function Ei(n){n._pack_next=n._pack_prev=n}function Ai(n){delete n._pack_next,delete n._pack_prev}function Ci(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;++u=0;)t=i[u],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Pi(n,t,e){return n.a.parent===t.parent?n.a:e}function Ui(n){return 1+ao.max(n,function(n){return n.y})}function ji(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Fi(n){var t=n.children;return t&&t.length?Fi(t[0]):n}function Hi(n){var t,e=n.children;return e&&(t=e.length)?Hi(e[t-1]):n}function Oi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Ii(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Yi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zi(n){return n.rangeExtent?n.rangeExtent():Yi(n.range())}function Vi(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Xi(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function $i(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:Sl}function Bi(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Bi:Vi,l=r?Wr:Br;return o=i(n,t,l,e),a=i(t,n,l,Mr),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Ur)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return Qi(n,t)},u.tickFormat=function(t,e){return nu(n,t,e)},u.nice=function(t){return Gi(n,t),i()},u.copy=function(){return Wi(n,t,e,r)},i()}function Ji(n,t){return ao.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Gi(n,t){return Xi(n,$i(Ki(n,t)[2])),Xi(n,$i(Ki(n,t)[2])),n}function Ki(n,t){null==t&&(t=10);var e=Yi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function Qi(n,t){return ao.range.apply(ao,Ki(n,t))}function nu(n,t,e){var r=Ki(n,t);if(e){var i=ha.exec(e);if(i.shift(),"s"===i[8]){var u=ao.formatPrefix(Math.max(xo(r[0]),xo(r[1])));return i[7]||(i[7]="."+tu(u.scale(r[2]))),i[8]="f",e=ao.format(i.join("")),function(n){return e(u.scale(n))+u.symbol}}i[7]||(i[7]="."+eu(i[8],r)),e=i.join("")}else e=",."+tu(r[2])+"f";return ao.format(e)}function tu(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function eu(n,t){var e=tu(t[2]);return n in kl?Math.abs(e-tu(Math.max(xo(t[0]),xo(t[1]))))+ +("e"!==n):e-2*("%"===n)}function ru(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Xi(r.map(i),e?Math:El);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Yi(r),o=[],a=n[0],l=n[1],c=Math.floor(i(a)),f=Math.ceil(i(l)),s=t%1?2:t;if(isFinite(f-c)){if(e){for(;f>c;c++)for(var h=1;s>h;h++)o.push(u(c)*h);o.push(u(c))}else for(o.push(u(c));c++0;h--)o.push(u(c)*h);for(c=0;o[c]l;f--);o=o.slice(c,f)}return o},o.tickFormat=function(n,e){if(!arguments.length)return Nl;arguments.length<2?e=Nl:"function"!=typeof e&&(e=ao.format(e));var r=Math.max(1,t*n/o.ticks().length);return function(n){var o=n/u(Math.round(i(n)));return t-.5>o*t&&(o*=t),r>=o?e(n):""}},o.copy=function(){return ru(n.copy(),t,e,r)},Ji(o,n)}function iu(n,t,e){function r(t){return n(i(t))}var i=uu(t),u=uu(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return Qi(e,n)},r.tickFormat=function(n,t){return nu(e,n,t)},r.nice=function(n){return r.domain(Gi(e,n))},r.exponent=function(o){return arguments.length?(i=uu(t=o),u=uu(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return iu(n.copy(),t,e)},Ji(r,n)}function uu(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ou(n,t){function e(e){return u[((i.get(e)||("range"===t.t?i.set(e,n.push(e)):NaN))-1)%u.length]}function r(t,e){return ao.range(n.length).map(function(n){return t+e*n})}var i,u,o;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new c;for(var u,o=-1,a=r.length;++oe?[NaN,NaN]:[e>0?a[e-1]:n[0],et?NaN:t/u+n,[t,t+1/u]},r.copy=function(){return lu(n,t,e)},i()}function cu(n,t){function e(e){return e>=e?t[ao.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return cu(n,t)},e}function fu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Qi(n,t)},t.tickFormat=function(t,e){return nu(n,t,e)},t.copy=function(){return fu(n)},t}function su(){return 0}function hu(n){return n.innerRadius}function pu(n){return n.outerRadius}function gu(n){return n.startAngle}function vu(n){return n.endAngle}function du(n){return n&&n.padAngle}function yu(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function mu(n,t,e,r,i){var u=n[0]-t[0],o=n[1]-t[1],a=(i?r:-r)/Math.sqrt(u*u+o*o),l=a*o,c=-a*u,f=n[0]+l,s=n[1]+c,h=t[0]+l,p=t[1]+c,g=(f+h)/2,v=(s+p)/2,d=h-f,y=p-s,m=d*d+y*y,M=e-r,x=f*p-h*s,b=(0>y?-1:1)*Math.sqrt(Math.max(0,M*M*m-x*x)),_=(x*y-d*b)/m,w=(-x*d-y*b)/m,S=(x*y+d*b)/m,k=(-x*d+y*b)/m,N=_-g,E=w-v,A=S-g,C=k-v;return N*N+E*E>A*A+C*C&&(_=S,w=k),[[_-l,w-c],[_*e/M,w*e/M]]}function Mu(n){function t(t){function o(){c.push("M",u(n(f),a))}for(var l,c=[],f=[],s=-1,h=t.length,p=En(e),g=En(r);++s1?n.join("L"):n+"Z"}function bu(n){return n.join("L")+"Z"}function _u(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function wu(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],u=n[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1];for(var c=2;c9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;++a<=l;)i=(n[Math.min(l,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function Fu(n){return n.length<3?xu(n):n[0]+Au(n,ju(n))}function Hu(n){for(var t,e,r,i=-1,u=n.length;++i=t?o(n-t):void(f.c=o)}function o(e){var i=g.active,u=g[i];u&&(u.timer.c=null,u.timer.t=NaN,--g.count,delete g[i],u.event&&u.event.interrupt.call(n,n.__data__,u.index));for(var o in g)if(r>+o){var c=g[o];c.timer.c=null,c.timer.t=NaN,--g.count,delete g[o]}f.c=a,qn(function(){return f.c&&a(e||1)&&(f.c=null,f.t=NaN),1},0,l),g.active=r,v.event&&v.event.start.call(n,n.__data__,t),p=[],v.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&p.push(r)}),h=v.ease,s=v.duration}function a(i){for(var u=i/s,o=h(u),a=p.length;a>0;)p[--a].call(n,o);return u>=1?(v.event&&v.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1):void 0}var l,f,s,h,p,g=n[e]||(n[e]={active:0,count:0}),v=g[r];v||(l=i.time,f=qn(u,0,l),v=g[r]={tween:new c,time:l,timer:f,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function no(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function to(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function eo(n){return n.toISOString()}function ro(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,u=ao.bisect(Kl,i);return u==Kl.length?[t.year,Ki(n.map(function(n){return n/31536e6}),e)[2]]:u?t[i/Kl[u-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=io(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=io(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Yi(r.domain()),u=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return u&&(n=u[0],t=u[1]),n.range(e[0],io(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return ro(n.copy(),t,e)},Ji(r,n)}function io(n){return new Date(n)}function uo(n){return JSON.parse(n.responseText)}function oo(n){var t=fo.createRange();return t.selectNode(fo.body),t.createContextualFragment(n.responseText)}var ao={version:"3.5.17"},lo=[].slice,co=function(n){return lo.call(n)},fo=this.document;if(fo)try{co(fo.documentElement.childNodes)[0].nodeType}catch(so){co=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(ho){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,yo=this.CSSStyleDeclaration.prototype,mo=yo.setProperty;po.setAttribute=function(n,t){go.call(this,n,t+"")},po.setAttributeNS=function(n,t,e){vo.call(this,n,t,e+"")},yo.setProperty=function(n,t,e){mo.call(this,n,t+"",e)}}ao.ascending=e,ao.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN},ao.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},ao.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},ao.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;++u=r){e=i=r;break}for(;++ur&&(e=r),r>i&&(i=r))}else{for(;++u=r){e=i=r;break}for(;++ur&&(e=r),r>i&&(i=r))}return[e,i]},ao.sum=function(n,t){var e,r=0,u=n.length,o=-1;if(1===arguments.length)for(;++o1?l/(f-1):void 0},ao.deviation=function(){var n=ao.variance.apply(this,arguments);return n?Math.sqrt(n):n};var Mo=u(e);ao.bisectLeft=Mo.left,ao.bisect=ao.bisectRight=Mo.right,ao.bisector=function(n){return u(1===n.length?function(t,r){return e(n(t),r)}:n)},ao.shuffle=function(n,t,e){(u=arguments.length)<3&&(e=n.length,2>u&&(t=0));for(var r,i,u=e-t;u;)i=Math.random()*u--|0,r=n[u+t],n[u+t]=n[i+t],n[i+t]=r;return n},ao.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ao.pairs=function(n){for(var t,e=0,r=n.length-1,i=n[0],u=new Array(0>r?0:r);r>e;)u[e]=[t=i,i=n[++e]];return u},ao.transpose=function(n){if(!(i=n.length))return[];for(var t=-1,e=ao.min(n,o),r=new Array(e);++t=0;)for(r=n[i],t=r.length;--t>=0;)e[--o]=r[t];return e};var xo=Math.abs;ao.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,i=[],u=a(xo(e)),o=-1;if(n*=u,t*=u,e*=u,0>e)for(;(r=n+e*++o)>t;)i.push(r/u);else for(;(r=n+e*++o)=u.length)return r?r.call(i,o):e?o.sort(e):o;for(var l,f,s,h,p=-1,g=o.length,v=u[a++],d=new c;++p=u.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},u=[],o=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(ao.map,e,0),0)},i.key=function(n){return u.push(n),i},i.sortKeys=function(n){return o[u.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},ao.set=function(n){var t=new y;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},l(y,{has:h,add:function(n){return this._[f(n+="")]=!0,n},remove:p,values:g,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,s(t))}}),ao.behavior={},ao.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ao.event=null,ao.requote=function(n){return n.replace(So,"\\$&")};var So=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},No=function(n,t){return t.querySelector(n)},Eo=function(n,t){return t.querySelectorAll(n)},Ao=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(Ao=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(No=function(n,t){return Sizzle(n,t)[0]||null},Eo=Sizzle,Ao=Sizzle.matchesSelector),ao.selection=function(){return ao.select(fo.documentElement)};var Co=ao.selection.prototype=[];Co.select=function(n){var t,e,r,i,u=[];n=A(n);for(var o=-1,a=this.length;++o=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),Lo.hasOwnProperty(e)?{space:Lo[e],local:n}:n}},Co.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ao.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},Co.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,i=-1;if(t=e.classList){for(;++ii){if("string"!=typeof n){2>i&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>i){var u=this.node();return t(u).getComputedStyle(u,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},Co.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(U(t,n[t]));return this}return this.each(U(n,t))},Co.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Co.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Co.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Co.insert=function(n,t){return n=j(n),t=A(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},Co.remove=function(){return this.each(F)},Co.data=function(n,t){function e(n,e){var r,i,u,o=n.length,s=e.length,h=Math.min(o,s),p=new Array(s),g=new Array(s),v=new Array(o);if(t){var d,y=new c,m=new Array(o);for(r=-1;++rr;++r)g[r]=H(e[r]);for(;o>r;++r)v[r]=n[r]}g.update=p,g.parentNode=p.parentNode=v.parentNode=n.parentNode,a.push(g),l.push(p),f.push(v)}var r,i,u=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++uu;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return E(i)},Co.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Co.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Co.size=function(){var n=0;return Y(this,function(){++n}),n};var qo=[];ao.selection.enter=Z,ao.selection.enter.prototype=qo,qo.append=Co.append,qo.empty=Co.empty,qo.node=Co.node,qo.call=Co.call,qo.size=Co.size,qo.select=function(n){for(var t,e,r,i,u,o=[],a=-1,l=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var To=ao.map({mouseenter:"mouseover",mouseleave:"mouseout"});fo&&To.forEach(function(n){"on"+n in fo&&To.remove(n)});var Ro,Do=0;ao.mouse=function(n){return J(n,k())};var Po=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ao.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,i=0,u=t.length;u>i;++i)if((r=t[i]).identifier===e)return J(n,r)},ao.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",o)}function e(n,t,e,u,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],g|=n|e,M=r,p({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:n,dy:e}))}function l(){t(h,v)&&(y.on(u+d,null).on(o+d,null),m(g),p({type:"dragend"}))}var c,f=this,s=ao.event.target.correspondingElement||ao.event.target,h=f.parentNode,p=r.of(f,arguments),g=0,v=n(),d=".drag"+(null==v?"":"-"+v),y=ao.select(e(s)).on(u+d,a).on(o+d,l),m=W(s),M=t(h,v);i?(c=i.apply(f,arguments),c=[c.x-M[0],c.y-M[1]]):c=[0,0],p({type:"dragstart"})}}var r=N(n,"drag","dragstart","dragend"),i=null,u=e(b,ao.mouse,t,"mousemove","mouseup"),o=e(G,ao.touch,m,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},ao.rebind(n,r,"on")},ao.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?co(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Uo=1e-6,jo=Uo*Uo,Fo=Math.PI,Ho=2*Fo,Oo=Ho-Uo,Io=Fo/2,Yo=Fo/180,Zo=180/Fo,Vo=Math.SQRT2,Xo=2,$o=4;ao.interpolateZoom=function(n,t){var e,r,i=n[0],u=n[1],o=n[2],a=t[0],l=t[1],c=t[2],f=a-i,s=l-u,h=f*f+s*s;if(jo>h)r=Math.log(c/o)/Vo,e=function(n){return[i+n*f,u+n*s,o*Math.exp(Vo*n*r)]};else{var p=Math.sqrt(h),g=(c*c-o*o+$o*h)/(2*o*Xo*p),v=(c*c-o*o-$o*h)/(2*c*Xo*p),d=Math.log(Math.sqrt(g*g+1)-g),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-d)/Vo,e=function(n){var t=n*r,e=rn(d),a=o/(Xo*p)*(e*un(Vo*t+d)-en(d));return[i+a*f,u+a*s,o*e/rn(Vo*t+d)]}}return e.duration=1e3*r,e},ao.behavior.zoom=function(){function n(n){n.on(L,s).on(Wo+".zoom",p).on("dblclick.zoom",g).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function i(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function o(t,e,r,o){t.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,o)),u(d=e,r),t=ao.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function l(n){z++||n({type:"zoomstart"})}function c(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function f(n){--z||(n({type:"zoomend"}),d=null)}function s(){function n(){a=1,u(ao.mouse(i),h),c(o)}function r(){s.on(q,null).on(T,null),p(a),f(o)}var i=this,o=D.of(i,arguments),a=0,s=ao.select(t(i)).on(q,n).on(T,r),h=e(ao.mouse(i)),p=W(i);Il.call(i),l(o)}function h(){function n(){var n=ao.touches(g);return p=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=ao.event.target;ao.select(t).on(x,r).on(b,a),_.push(t);for(var e=ao.event.changedTouches,i=0,u=e.length;u>i;++i)d[e[i].identifier]=null;var l=n(),c=Date.now();if(1===l.length){if(500>c-M){var f=l[0];o(g,f,d[f.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=c}else if(l.length>1){var f=l[0],s=l[1],h=f[0]-s[0],p=f[1]-s[1];y=h*h+p*p}}function r(){var n,t,e,r,o=ao.touches(g);Il.call(g);for(var a=0,l=o.length;l>a;++a,r=null)if(e=o[a],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var f=(f=e[0]-n[0])*f+(f=e[1]-n[1])*f,s=y&&Math.sqrt(f/y);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],i(s*p)}M=null,u(n,t),c(v)}function a(){if(ao.event.touches.length){for(var t=ao.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var i in d)return void n()}ao.selectAll(_).on(m,null),w.on(L,s).on(R,h),N(),f(v)}var p,g=this,v=D.of(g,arguments),d={},y=0,m=".zoom-"+ao.event.changedTouches[0].identifier,x="touchmove"+m,b="touchend"+m,_=[],w=ao.select(g),N=W(g);t(),l(v),w.on(L,null).on(R,t)}function p(){var n=D.of(this,arguments);m?clearTimeout(m):(Il.call(this),v=e(d=y||ao.mouse(this)),l(n)),m=setTimeout(function(){m=null,f(n)},50),S(),i(Math.pow(2,.002*Bo())*k.k),u(d,v),c(n)}function g(){var n=ao.mouse(this),t=Math.log(k.k)/Math.LN2;o(this,n,e(n),ao.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,y,m,M,x,b,_,w,k={x:0,y:0,k:1},E=[960,500],A=Jo,C=250,z=0,L="mousedown.zoom",q="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=N(n,"zoomstart","zoom","zoomend");return Wo||(Wo="onwheel"in fo?(Bo=function(){return-ao.event.deltaY*(ao.event.deltaMode?120:1)},"wheel"):"onmousewheel"in fo?(Bo=function(){return ao.event.wheelDelta},"mousewheel"):(Bo=function(){return-ao.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Hl?ao.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],i=d?d[0]:e/2,u=d?d[1]:r/2,o=ao.interpolateZoom([(i-k.x)/k.k,(u-k.y)/k.k,e/k.k],[(i-t.x)/t.k,(u-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:i-r[0]*a,y:u-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){f(n)}).each("end.zoom",function(){f(n)}):(this.__chart__=k,l(n),c(n),f(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},a(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+t),a(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Jo:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(y=t&&[+t[0],+t[1]],n):y},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},ao.rebind(n,D,"on")};var Bo,Wo,Jo=[0,1/0];ao.color=an,an.prototype.toString=function(){return this.rgb()+""},ao.hsl=ln;var Go=ln.prototype=new an;Go.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,this.l/n)},Go.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,n*this.l)},Go.rgb=function(){return cn(this.h,this.s,this.l)},ao.hcl=fn;var Ko=fn.prototype=new an;Ko.brighter=function(n){return new fn(this.h,this.c,Math.min(100,this.l+Qo*(arguments.length?n:1)))},Ko.darker=function(n){return new fn(this.h,this.c,Math.max(0,this.l-Qo*(arguments.length?n:1)))},Ko.rgb=function(){return sn(this.h,this.c,this.l).rgb()},ao.lab=hn;var Qo=18,na=.95047,ta=1,ea=1.08883,ra=hn.prototype=new an;ra.brighter=function(n){return new hn(Math.min(100,this.l+Qo*(arguments.length?n:1)),this.a,this.b)},ra.darker=function(n){return new hn(Math.max(0,this.l-Qo*(arguments.length?n:1)),this.a,this.b)},ra.rgb=function(){return pn(this.l,this.a,this.b)},ao.rgb=mn;var ia=mn.prototype=new an;ia.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),new mn(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mn(i,i,i)},ia.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mn(n*this.r,n*this.g,n*this.b)},ia.hsl=function(){return wn(this.r,this.g,this.b)},ia.toString=function(){return"#"+bn(this.r)+bn(this.g)+bn(this.b)};var ua=ao.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ua.forEach(function(n,t){ua.set(n,Mn(t))}),ao.functor=En,ao.xhr=An(m),ao.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var o=Cn(n,t,null==e?r:i(e),u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function u(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(f>=c)return o;if(i)return i=!1,u;var t=f;if(34===n.charCodeAt(t)){for(var e=t;e++f;){var r=n.charCodeAt(f++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(f)&&(++f,++a);else if(r!==l)continue;return n.slice(t,f-a)}return n.slice(t)}for(var r,i,u={},o={},a=[],c=n.length,f=0,s=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,s++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new y,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(u).join("\n")},e},ao.csv=ao.dsv(",","text/csv"),ao.tsv=ao.dsv(" ","text/tab-separated-values");var oa,aa,la,ca,fa=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ao.timer=function(){qn.apply(this,arguments)},ao.timer.flush=function(){Rn(),Dn()},ao.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var sa=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Un);ao.formatPrefix=function(n,t){var e=0;return(n=+n)&&(0>n&&(n*=-1),t&&(n=ao.round(n,Pn(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),sa[8+e/3]};var ha=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,pa=ao.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ao.round(n,Pn(n,t))).toFixed(Math.max(0,Math.min(20,Pn(n*(1+1e-15),t))))}}),ga=ao.time={},va=Date;Hn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){da.setUTCDate.apply(this._,arguments)},setDay:function(){da.setUTCDay.apply(this._,arguments)},setFullYear:function(){da.setUTCFullYear.apply(this._,arguments)},setHours:function(){da.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){da.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){da.setUTCMinutes.apply(this._,arguments)},setMonth:function(){da.setUTCMonth.apply(this._,arguments)},setSeconds:function(){da.setUTCSeconds.apply(this._,arguments)},setTime:function(){da.setTime.apply(this._,arguments)}};var da=Date.prototype;ga.year=On(function(n){return n=ga.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ga.years=ga.year.range,ga.years.utc=ga.year.utc.range,ga.day=On(function(n){var t=new va(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ga.days=ga.day.range,ga.days.utc=ga.day.utc.range,ga.dayOfYear=function(n){var t=ga.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ga[n]=On(function(n){return(n=ga.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ga[n+"s"]=e.range,ga[n+"s"].utc=e.utc.range,ga[n+"OfYear"]=function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)}}),ga.week=ga.sunday,ga.weeks=ga.sunday.range,ga.weeks.utc=ga.sunday.utc.range,ga.weekOfYear=ga.sundayOfYear;var ya={"-":"",_:" ",0:"0"},ma=/^\s*\d+/,Ma=/^%/;ao.locale=function(n){return{numberFormat:jn(n),timeFormat:Yn(n)}};var xa=ao.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], +shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ao.format=xa.numberFormat,ao.geo={},ft.prototype={s:0,t:0,add:function(n){st(n,this.t,ba),st(ba.s,this.s,this),this.s?this.t+=ba.t:this.s=ba.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ba=new ft;ao.geo.stream=function(n,t){n&&_a.hasOwnProperty(n.type)?_a[n.type](n,t):ht(n,t)};var _a={Feature:function(n,t){ht(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rn?4*Fo+n:n,Na.lineStart=Na.lineEnd=Na.point=b}};ao.geo.bounds=function(){function n(n,t){M.push(x=[f=n,h=n]),s>t&&(s=t),t>p&&(p=t)}function t(t,e){var r=dt([t*Yo,e*Yo]);if(y){var i=mt(y,r),u=[i[1],-i[0],0],o=mt(u,i);bt(o),o=_t(o);var l=t-g,c=l>0?1:-1,v=o[0]*Zo*c,d=xo(l)>180;if(d^(v>c*g&&c*t>v)){var m=o[1]*Zo;m>p&&(p=m)}else if(v=(v+360)%360-180,d^(v>c*g&&c*t>v)){var m=-o[1]*Zo;s>m&&(s=m)}else s>e&&(s=e),e>p&&(p=e);d?g>t?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t):h>=f?(f>t&&(f=t),t>h&&(h=t)):t>g?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t)}else n(t,e);y=r,g=t}function e(){b.point=t}function r(){x[0]=f,x[1]=h,b.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=xo(r)>180?r+(r>0?360:-360):r}else v=n,d=e;Na.point(n,e),t(n,e)}function u(){Na.lineStart()}function o(){i(v,d),Na.lineEnd(),xo(m)>Uo&&(f=-(h=180)),x[0]=f,x[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function l(n,t){return n[0]-t[0]}function c(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nka?(f=-(h=180),s=-(p=90)):m>Uo?p=90:-Uo>m&&(s=-90),x[0]=f,x[1]=h}};return function(n){p=h=-(f=s=1/0),M=[],ao.geo.stream(n,b);var t=M.length;if(t){M.sort(l);for(var e,r=1,i=M[0],u=[i];t>r;++r)e=M[r],c(e[0],i)||c(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,g=-(1/0),t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>g&&(g=o,f=e[0],h=i[1])}return M=x=null,f===1/0||s===1/0?[[NaN,NaN],[NaN,NaN]]:[[f,s],[h,p]]}}(),ao.geo.centroid=function(n){Ea=Aa=Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,ja);var t=Da,e=Pa,r=Ua,i=t*t+e*e+r*r;return jo>i&&(t=qa,e=Ta,r=Ra,Uo>Aa&&(t=Ca,e=za,r=La),i=t*t+e*e+r*r,jo>i)?[NaN,NaN]:[Math.atan2(e,t)*Zo,tn(r/Math.sqrt(i))*Zo]};var Ea,Aa,Ca,za,La,qa,Ta,Ra,Da,Pa,Ua,ja={sphere:b,point:St,lineStart:Nt,lineEnd:Et,polygonStart:function(){ja.lineStart=At},polygonEnd:function(){ja.lineStart=Nt}},Fa=Rt(zt,jt,Ht,[-Fo,-Fo/2]),Ha=1e9;ao.geo.clipExtent=function(){var n,t,e,r,i,u,o={stream:function(n){return i&&(i.valid=!1),i=u(n),i.valid=!0,i},extent:function(a){return arguments.length?(u=Zt(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),i&&(i.valid=!1,i=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ao.geo.conicEqualArea=function(){return Vt(Xt)}).raw=Xt,ao.geo.albers=function(){return ao.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ao.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=ao.geo.albers(),o=ao.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ao.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var c=u.scale(),f=+t[0],s=+t[1];return e=u.translate(t).clipExtent([[f-.455*c,s-.238*c],[f+.455*c,s+.238*c]]).stream(l).point,r=o.translate([f-.307*c,s+.201*c]).clipExtent([[f-.425*c+Uo,s+.12*c+Uo],[f-.214*c-Uo,s+.234*c-Uo]]).stream(l).point,i=a.translate([f-.205*c,s+.212*c]).clipExtent([[f-.214*c+Uo,s+.166*c+Uo],[f-.115*c-Uo,s+.234*c-Uo]]).stream(l).point,n},n.scale(1070)};var Oa,Ia,Ya,Za,Va,Xa,$a={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Ia=0,$a.lineStart=$t},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=b,Oa+=xo(Ia/2)}},Ba={point:Bt,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Wa={point:Gt,lineStart:Kt,lineEnd:Qt,polygonStart:function(){Wa.lineStart=ne},polygonEnd:function(){Wa.point=Gt,Wa.lineStart=Kt,Wa.lineEnd=Qt}};ao.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),ao.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return Oa=0,ao.geo.stream(n,i($a)),Oa},n.centroid=function(n){return Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,i(Wa)),Ua?[Da/Ua,Pa/Ua]:Ra?[qa/Ra,Ta/Ra]:La?[Ca/La,za/La]:[NaN,NaN]},n.bounds=function(n){return Va=Xa=-(Ya=Za=1/0),ao.geo.stream(n,i(Ba)),[[Ya,Za],[Va,Xa]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||re(n):m,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new Wt:new te(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(ao.geo.albersUsa()).context(null)},ao.geo.transform=function(n){return{stream:function(t){var e=new ie(t);for(var r in n)e[r]=n[r];return e}}},ie.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ao.geo.projection=oe,ao.geo.projectionMutator=ae,(ao.geo.equirectangular=function(){return oe(ce)}).raw=ce.invert=ce,ao.geo.rotation=function(n){function t(t){return t=n(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t}return n=se(n[0]%360*Yo,n[1]*Yo,n.length>2?n[2]*Yo:0),t.invert=function(t){return t=n.invert(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t},t},fe.invert=ce,ao.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=se(-n[0]*Yo,-n[1]*Yo,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Zo,n[1]*=Zo}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ve((t=+r)*Yo,i*Yo),n):t},n.precision=function(r){return arguments.length?(e=ve(t*Yo,(i=+r)*Yo),n):i},n.angle(90)},ao.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yo,i=n[1]*Yo,u=t[1]*Yo,o=Math.sin(r),a=Math.cos(r),l=Math.sin(i),c=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*o)*e+(e=c*f-l*s*a)*e),l*f+c*s*a)},ao.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ao.range(Math.ceil(u/d)*d,i,d).map(h).concat(ao.range(Math.ceil(c/y)*y,l,y).map(p)).concat(ao.range(Math.ceil(r/g)*g,e,g).filter(function(n){return xo(n%d)>Uo}).map(f)).concat(ao.range(Math.ceil(a/v)*v,o,v).filter(function(n){return xo(n%y)>Uo}).map(s))}var e,r,i,u,o,a,l,c,f,s,h,p,g=10,v=g,d=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(p(l).slice(1),h(i).reverse().slice(1),p(c).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],u>i&&(t=u,u=i,i=t),c>l&&(t=c,c=l,l=t),n.precision(m)):[[u,c],[i,l]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(m)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],y=+t[1],n):[d,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],n):[g,v]},n.precision=function(t){return arguments.length?(m=+t,f=ye(a,o,90),s=me(r,e,m),h=ye(c,l,90),p=me(u,i,m),n):m},n.majorExtent([[-180,-90+Uo],[180,90-Uo]]).minorExtent([[-180,-80-Uo],[180,80+Uo]])},ao.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=Me,i=xe;return n.distance=function(){return ao.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},ao.geo.interpolate=function(n,t){return be(n[0]*Yo,n[1]*Yo,t[0]*Yo,t[1]*Yo)},ao.geo.length=function(n){return Ja=0,ao.geo.stream(n,Ga),Ja};var Ja,Ga={sphere:b,point:b,lineStart:_e,lineEnd:b,polygonStart:b,polygonEnd:b},Ka=we(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ao.geo.azimuthalEqualArea=function(){return oe(Ka)}).raw=Ka;var Qa=we(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},m);(ao.geo.azimuthalEquidistant=function(){return oe(Qa)}).raw=Qa,(ao.geo.conicConformal=function(){return Vt(Se)}).raw=Se,(ao.geo.conicEquidistant=function(){return Vt(ke)}).raw=ke;var nl=we(function(n){return 1/n},Math.atan);(ao.geo.gnomonic=function(){return oe(nl)}).raw=nl,Ne.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Io]},(ao.geo.mercator=function(){return Ee(Ne)}).raw=Ne;var tl=we(function(){return 1},Math.asin);(ao.geo.orthographic=function(){return oe(tl)}).raw=tl;var el=we(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ao.geo.stereographic=function(){return oe(el)}).raw=el,Ae.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Io]},(ao.geo.transverseMercator=function(){var n=Ee(Ae),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ae,ao.geom={},ao.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=En(e),u=En(r),o=n.length,a=[],l=[];for(t=0;o>t;t++)a.push([+i.call(this,n[t],t),+u.call(this,n[t],t),t]);for(a.sort(qe),t=0;o>t;t++)l.push([a[t][0],-a[t][1]]);var c=Le(a),f=Le(l),s=f[0]===c[0],h=f[f.length-1]===c[c.length-1],p=[];for(t=c.length-1;t>=0;--t)p.push(n[a[c[t]][2]]);for(t=+s;t=r&&c.x<=u&&c.y>=i&&c.y<=o?[[r,o],[u,o],[u,i],[r,i]]:[];f.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(u(n,t)/Uo)*Uo,y:Math.round(o(n,t)/Uo)*Uo,i:t}})}var r=Ce,i=ze,u=r,o=i,a=sl;return n?t(n):(t.links=function(n){return ar(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ar(e(n)).cells.forEach(function(e,r){for(var i,u,o=e.site,a=e.edges.sort(Ve),l=-1,c=a.length,f=a[c-1].edge,s=f.l===o?f.r:f.l;++l=c,h=r>=f,p=h<<1|s;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=hr()),s?i=c:a=c,h?o=f:l=f,u(n,t,e,r,i,o,a,l)}var f,s,h,p,g,v,d,y,m,M=En(a),x=En(l);if(null!=t)v=t,d=e,y=r,m=i;else if(y=m=-(v=d=1/0),s=[],h=[],g=n.length,o)for(p=0;g>p;++p)f=n[p],f.xy&&(y=f.x),f.y>m&&(m=f.y),s.push(f.x),h.push(f.y);else for(p=0;g>p;++p){var b=+M(f=n[p],p),_=+x(f,p);v>b&&(v=b),d>_&&(d=_),b>y&&(y=b),_>m&&(m=_),s.push(b),h.push(_)}var w=y-v,S=m-d;w>S?m=d+w:y=v+S;var k=hr();if(k.add=function(n){u(k,n,+M(n,++p),+x(n,p),v,d,y,m)},k.visit=function(n){pr(n,k,v,d,y,m)},k.find=function(n){return gr(k,n[0],n[1],v,d,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=vl.get(e)||gl,r=dl.get(r)||m,br(r(e.apply(null,lo.call(arguments,1))))},ao.interpolateHcl=Rr,ao.interpolateHsl=Dr,ao.interpolateLab=Pr,ao.interpolateRound=Ur,ao.transform=function(n){var t=fo.createElementNS(ao.ns.prefix.svg,"g");return(ao.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new jr(e?e.matrix:yl)})(n)},jr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yl={a:1,b:0,c:0,d:1,e:0,f:0};ao.interpolateTransform=$r,ao.layout={},ao.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++ea*a/y){if(v>l){var c=t.charge/l;n.px-=u*c,n.py-=o*c}return!0}if(t.point&&l&&v>l){var c=t.pointCharge/l;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=ao.event.x,n.py=ao.event.y,l.resume()}var e,r,i,u,o,a,l={},c=ao.dispatch("start","tick","end"),f=[1,1],s=.9,h=ml,p=Ml,g=-30,v=xl,d=.1,y=.64,M=[],x=[];return l.tick=function(){if((i*=.99)<.005)return e=null,c.end({type:"end",alpha:i=0}),!0;var t,r,l,h,p,v,y,m,b,_=M.length,w=x.length;for(r=0;w>r;++r)l=x[r],h=l.source,p=l.target,m=p.x-h.x,b=p.y-h.y,(v=m*m+b*b)&&(v=i*o[r]*((v=Math.sqrt(v))-u[r])/v,m*=v,b*=v,p.x-=m*(y=h.weight+p.weight?h.weight/(h.weight+p.weight):.5),p.y-=b*y,h.x+=m*(y=1-y),h.y+=b*y);if((y=i*d)&&(m=f[0]/2,b=f[1]/2,r=-1,y))for(;++r<_;)l=M[r],l.x+=(m-l.x)*y,l.y+=(b-l.y)*y;if(g)for(ri(t=ao.geom.quadtree(M),i,a),r=-1;++r<_;)(l=M[r]).fixed||t.visit(n(l));for(r=-1;++r<_;)l=M[r],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*s,l.y-=(l.py-(l.py=l.y))*s);c.tick({type:"tick",alpha:i})},l.nodes=function(n){return arguments.length?(M=n,l):M},l.links=function(n){return arguments.length?(x=n,l):x},l.size=function(n){return arguments.length?(f=n,l):f},l.linkDistance=function(n){return arguments.length?(h="function"==typeof n?n:+n,l):h},l.distance=l.linkDistance,l.linkStrength=function(n){return arguments.length?(p="function"==typeof n?n:+n,l):p},l.friction=function(n){return arguments.length?(s=+n,l):s},l.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,l):g},l.chargeDistance=function(n){return arguments.length?(v=n*n,l):Math.sqrt(v)},l.gravity=function(n){return arguments.length?(d=+n,l):d},l.theta=function(n){return arguments.length?(y=n*n,l):Math.sqrt(y)},l.alpha=function(n){return arguments.length?(n=+n,i?n>0?i=n:(e.c=null,e.t=NaN,e=null,c.end({type:"end",alpha:i=0})):n>0&&(c.start({type:"start",alpha:i=n}),e=qn(l.tick)),l):i},l.start=function(){function n(n,r){if(!e){for(e=new Array(i),l=0;i>l;++l)e[l]=[];for(l=0;c>l;++l){var u=x[l];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var o,a=e[t],l=-1,f=a.length;++lt;++t)(r=M[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=x[t],"number"==typeof r.source&&(r.source=M[r.source]),"number"==typeof r.target&&(r.target=M[r.target]),++r.source.weight,++r.target.weight;for(t=0;i>t;++t)r=M[t],isNaN(r.x)&&(r.x=n("x",s)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof h)for(t=0;c>t;++t)u[t]=+h.call(this,x[t],t);else for(t=0;c>t;++t)u[t]=h;if(o=[],"function"==typeof p)for(t=0;c>t;++t)o[t]=+p.call(this,x[t],t);else for(t=0;c>t;++t)o[t]=p;if(a=[],"function"==typeof g)for(t=0;i>t;++t)a[t]=+g.call(this,M[t],t);else for(t=0;i>t;++t)a[t]=g;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=ao.behavior.drag().origin(m).on("dragstart.force",Qr).on("drag.force",t).on("dragend.force",ni)),arguments.length?void this.on("mouseover.force",ti).on("mouseout.force",ei).call(r):r},ao.rebind(l,c,"on")};var ml=20,Ml=1,xl=1/0;ao.layout.hierarchy=function(){function n(i){var u,o=[i],a=[];for(i.depth=0;null!=(u=o.pop());)if(a.push(u),(c=e.call(n,u,u.depth))&&(l=c.length)){for(var l,c,f;--l>=0;)o.push(f=c[l]),f.parent=u,f.depth=u.depth+1;r&&(u.value=0),u.children=c}else r&&(u.value=+r.call(n,u,u.depth)||0),delete u.children;return oi(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=ci,e=ai,r=li;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ui(t,function(n){n.children&&(n.value=0)}),oi(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ao.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(o=u.length)){var o,a,l,c=-1;for(r=t.value?r/t.value:0;++cs?-1:1),g=ao.sum(c),v=g?(s-l*p)/g:0,d=ao.range(l),y=[];return null!=e&&d.sort(e===bl?function(n,t){return c[t]-c[n]}:function(n,t){return e(o[n],o[t])}),d.forEach(function(n){y[n]={data:o[n],value:a=c[n],startAngle:f,endAngle:f+=a*v+p,padAngle:h}}),y}var t=Number,e=bl,r=0,i=Ho,u=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n.padAngle=function(t){return arguments.length?(u=t,n):u},n};var bl={};ao.layout.stack=function(){function n(a,l){if(!(h=a.length))return a;var c=a.map(function(e,r){return t.call(n,e,r)}),f=c.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),o.call(n,t,e)]})}),s=e.call(n,f,l);c=ao.permute(c,s),f=ao.permute(f,s);var h,p,g,v,d=r.call(n,f,l),y=c[0].length;for(g=0;y>g;++g)for(i.call(n,c[0][g],v=d[g],f[0][g][1]),p=1;h>p;++p)i.call(n,c[p][g],v+=f[p-1][g][1],f[p][g][1]);return a}var t=m,e=gi,r=vi,i=pi,u=si,o=hi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:_l.get(t)||gi,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:wl.get(t)||vi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var _l=ao.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(di),u=n.map(yi),o=ao.range(r).sort(function(n,t){return i[n]-i[t]}),a=0,l=0,c=[],f=[];for(t=0;r>t;++t)e=o[t],l>a?(a+=u[e],c.push(e)):(l+=u[e],f.push(e));return f.reverse().concat(c)},reverse:function(n){return ao.range(n.length).reverse()},"default":gi}),wl=ao.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,l=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)l[e]=(a-o[e])/2;return l},wiggle:function(n){var t,e,r,i,u,o,a,l,c,f=n.length,s=n[0],h=s.length,p=[];for(p[0]=l=c=0,e=1;h>e;++e){for(t=0,i=0;f>t;++t)i+=n[t][e][1];for(t=0,u=0,a=s[e][0]-s[e-1][0];f>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}p[e]=l-=i?u/i*a:0,c>l&&(c=l)}for(e=0;h>e;++e)p[e]-=c;return p},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:vi});ao.layout.histogram=function(){function n(n,u){for(var o,a,l=[],c=n.map(e,this),f=r.call(this,c,u),s=i.call(this,f,c,u),u=-1,h=c.length,p=s.length-1,g=t?1:1/h;++u0)for(u=-1;++u=f[0]&&a<=f[1]&&(o=l[ao.bisect(s,a,1,p)-1],o.y+=g,o.push(n[u]));return l}var t=!0,e=Number,r=bi,i=Mi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=En(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return xi(n,t)}:En(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ao.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],l=i[0],c=i[1],f=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,oi(a,function(n){n.r=+f(n.value)}),oi(a,Ni),r){var s=r*(t?1:Math.max(2*a.r/l,2*a.r/c))/2;oi(a,function(n){n.r+=s}),oi(a,Ni),oi(a,function(n){n.r-=s})}return Ci(a,l/2,c/2,t?1:1/Math.max(2*a.r/l,2*a.r/c)),o}var t,e=ao.layout.hierarchy().sort(_i),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ii(n,e)},ao.layout.tree=function(){function n(n,i){var f=o.call(this,n,i),s=f[0],h=t(s);if(oi(h,e),h.parent.m=-h.z,ui(h,r),c)ui(s,u);else{var p=s,g=s,v=s;ui(s,function(n){n.xg.x&&(g=n),n.depth>v.depth&&(v=n)});var d=a(p,g)/2-p.x,y=l[0]/(g.x+a(g,p)/2+d),m=l[1]/(v.depth||1);ui(s,function(n){n.x=(n.x+d)*y,n.y=n.depth*m})}return f}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,u=t.children,o=0,a=u.length;a>o;++o)r.push((u[o]=i={_:u[o],parent:t,children:(i=u[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Di(n);var u=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-u):n.z=u}else r&&(n.z=r.z+a(n._,r._));n.parent.A=i(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function i(n,t,e){if(t){for(var r,i=n,u=n,o=t,l=i.parent.children[0],c=i.m,f=u.m,s=o.m,h=l.m;o=Ti(o),i=qi(i),o&&i;)l=qi(l),u=Ti(u),u.a=n,r=o.z+s-i.z-c+a(o._,i._),r>0&&(Ri(Pi(o,n,e),n,r),c+=r,f+=r),s+=o.m,c+=i.m,h+=l.m,f+=u.m;o&&!Ti(u)&&(u.t=o,u.m+=s-f),i&&!qi(l)&&(l.t=i,l.m+=c-h,e=n)}return e}function u(n){n.x*=l[0],n.y=n.depth*l[1]}var o=ao.layout.hierarchy().sort(null).value(null),a=Li,l=[1,1],c=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(c=null==(l=t)?u:null,n):c?null:l},n.nodeSize=function(t){return arguments.length?(c=null==(l=t)?null:u,n):c?l:null},ii(n,o)},ao.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),l=a[0],c=0;oi(l,function(n){var t=n.children;t&&t.length?(n.x=ji(t),n.y=Ui(t)):(n.x=o?c+=e(n,o):0,n.y=0,o=n)});var f=Fi(l),s=Hi(l),h=f.x-e(f,s)/2,p=s.x+e(s,f)/2;return oi(l,i?function(n){n.x=(n.x-l.x)*r[0],n.y=(l.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(l.y?n.y/l.y:1))*r[1]}),a}var t=ao.layout.hierarchy().sort(null).value(null),e=Li,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},ao.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++it?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,l,c=s(e),f=[],h=u.slice(),g=1/0,v="slice"===p?c.dx:"dice"===p?c.dy:"slice-dice"===p?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(n(h,c.dx*c.dy/e.value),f.area=0;(l=h.length)>0;)f.push(o=h[l-1]),f.area+=o.area,"squarify"!==p||(a=r(f,v))<=g?(h.pop(),g=a):(f.area-=f.pop().area,i(f,v,c,!1),v=Math.min(c.dx,c.dy),f.length=f.area=0,g=1/0);f.length&&(i(f,v,c,!0),f.length=f.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=s(t),a=r.slice(),l=[];for(n(a,o.dx*o.dy/t.value),l.area=0;u=a.pop();)l.push(u),l.area+=u.area,null!=u.z&&(i(l,u.z?o.dx:o.dy,o,!a.length),l.length=l.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++oe&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*u*g)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,c=e.y,f=t?l(n.area/t):0; +if(t==e.dx){for((r||f>e.dy)&&(f=e.dy);++ue.dx)&&(f=e.dx);++ue&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=ao.random.normal.apply(ao,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ao.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ao.scale={};var Sl={floor:m,ceil:m};ao.scale.linear=function(){return Wi([0,1],[0,1],Mr,!1)};var kl={s:1,g:1,p:1,r:1,e:1};ao.scale.log=function(){return ru(ao.scale.linear().domain([0,1]),10,!0,[1,10])};var Nl=ao.format(".0e"),El={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ao.scale.pow=function(){return iu(ao.scale.linear(),1,[0,1])},ao.scale.sqrt=function(){return ao.scale.pow().exponent(.5)},ao.scale.ordinal=function(){return ou([],{t:"range",a:[[]]})},ao.scale.category10=function(){return ao.scale.ordinal().range(Al)},ao.scale.category20=function(){return ao.scale.ordinal().range(Cl)},ao.scale.category20b=function(){return ao.scale.ordinal().range(zl)},ao.scale.category20c=function(){return ao.scale.ordinal().range(Ll)};var Al=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xn),Cl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xn),zl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xn),Ll=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xn);ao.scale.quantile=function(){return au([],[])},ao.scale.quantize=function(){return lu(0,1,[0,1])},ao.scale.threshold=function(){return cu([.5],[0,1])},ao.scale.identity=function(){return fu([0,1])},ao.svg={},ao.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),f=o.apply(this,arguments)-Io,s=a.apply(this,arguments)-Io,h=Math.abs(s-f),p=f>s?0:1;if(n>c&&(g=c,c=n,n=g),h>=Oo)return t(c,p)+(n?t(n,1-p):"")+"Z";var g,v,d,y,m,M,x,b,_,w,S,k,N=0,E=0,A=[];if((y=(+l.apply(this,arguments)||0)/2)&&(d=u===ql?Math.sqrt(n*n+c*c):+u.apply(this,arguments),p||(E*=-1),c&&(E=tn(d/c*Math.sin(y))),n&&(N=tn(d/n*Math.sin(y)))),c){m=c*Math.cos(f+E),M=c*Math.sin(f+E),x=c*Math.cos(s-E),b=c*Math.sin(s-E);var C=Math.abs(s-f-2*E)<=Fo?0:1;if(E&&yu(m,M,x,b)===p^C){var z=(f+s)/2;m=c*Math.cos(z),M=c*Math.sin(z),x=b=null}}else m=M=0;if(n){_=n*Math.cos(s-N),w=n*Math.sin(s-N),S=n*Math.cos(f+N),k=n*Math.sin(f+N);var L=Math.abs(f-s+2*N)<=Fo?0:1;if(N&&yu(_,w,S,k)===1-p^L){var q=(f+s)/2;_=n*Math.cos(q),w=n*Math.sin(q),S=k=null}}else _=w=0;if(h>Uo&&(g=Math.min(Math.abs(c-n)/2,+i.apply(this,arguments)))>.001){v=c>n^p?0:1;var T=g,R=g;if(Fo>h){var D=null==S?[_,w]:null==x?[m,M]:Re([m,M],[S,k],[x,b],[_,w]),P=m-D[0],U=M-D[1],j=x-D[0],F=b-D[1],H=1/Math.sin(Math.acos((P*j+U*F)/(Math.sqrt(P*P+U*U)*Math.sqrt(j*j+F*F)))/2),O=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(g,(n-O)/(H-1)),T=Math.min(g,(c-O)/(H+1))}if(null!=x){var I=mu(null==S?[_,w]:[S,k],[m,M],c,T,p),Y=mu([x,b],[_,w],c,T,p);g===T?A.push("M",I[0],"A",T,",",T," 0 0,",v," ",I[1],"A",c,",",c," 0 ",1-p^yu(I[1][0],I[1][1],Y[1][0],Y[1][1]),",",p," ",Y[1],"A",T,",",T," 0 0,",v," ",Y[0]):A.push("M",I[0],"A",T,",",T," 0 1,",v," ",Y[0])}else A.push("M",m,",",M);if(null!=S){var Z=mu([m,M],[S,k],n,-R,p),V=mu([_,w],null==x?[m,M]:[x,b],n,-R,p);g===R?A.push("L",V[0],"A",R,",",R," 0 0,",v," ",V[1],"A",n,",",n," 0 ",p^yu(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-p," ",Z[1],"A",R,",",R," 0 0,",v," ",Z[0]):A.push("L",V[0],"A",R,",",R," 0 0,",v," ",Z[0])}else A.push("L",_,",",w)}else A.push("M",m,",",M),null!=x&&A.push("A",c,",",c," 0 ",C,",",p," ",x,",",b),A.push("L",_,",",w),null!=S&&A.push("A",n,",",n," 0 ",L,",",1-p," ",S,",",k);return A.push("Z"),A.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=hu,r=pu,i=su,u=ql,o=gu,a=vu,l=du;return n.innerRadius=function(t){return arguments.length?(e=En(t),n):e},n.outerRadius=function(t){return arguments.length?(r=En(t),n):r},n.cornerRadius=function(t){return arguments.length?(i=En(t),n):i},n.padRadius=function(t){return arguments.length?(u=t==ql?ql:En(t),n):u},n.startAngle=function(t){return arguments.length?(o=En(t),n):o},n.endAngle=function(t){return arguments.length?(a=En(t),n):a},n.padAngle=function(t){return arguments.length?(l=En(t),n):l},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Io;return[Math.cos(t)*n,Math.sin(t)*n]},n};var ql="auto";ao.svg.line=function(){return Mu(m)};var Tl=ao.map({linear:xu,"linear-closed":bu,step:_u,"step-before":wu,"step-after":Su,basis:zu,"basis-open":Lu,"basis-closed":qu,bundle:Tu,cardinal:Eu,"cardinal-open":ku,"cardinal-closed":Nu,monotone:Fu});Tl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Rl=[0,2/3,1/3,0],Dl=[0,1/3,2/3,0],Pl=[0,1/6,2/3,1/6];ao.svg.line.radial=function(){var n=Mu(Hu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},wu.reverse=Su,Su.reverse=wu,ao.svg.area=function(){return Ou(m)},ao.svg.area.radial=function(){var n=Ou(Hu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ao.svg.chord=function(){function n(n,a){var l=t(this,u,n,a),c=t(this,o,n,a);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(e(l,c)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+i(c.r,c.p1,l.r,l.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=l.call(n,i,r)-Io,f=c.call(n,i,r)-Io;return{r:u,a0:o,a1:f,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(f),u*Math.sin(f)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Fo)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=Me,o=xe,a=Iu,l=gu,c=vu;return n.radius=function(t){return arguments.length?(a=En(t),n):a},n.source=function(t){return arguments.length?(u=En(t),n):u},n.target=function(t){return arguments.length?(o=En(t),n):o},n.startAngle=function(t){return arguments.length?(l=En(t),n):l},n.endAngle=function(t){return arguments.length?(c=En(t),n):c},n},ao.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,l=[u,{x:u.x,y:a},{x:o.x,y:a},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=Me,e=xe,r=Yu;return n.source=function(e){return arguments.length?(t=En(e),n):t},n.target=function(t){return arguments.length?(e=En(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ao.svg.diagonal.radial=function(){var n=ao.svg.diagonal(),t=Yu,e=n.projection;return n.projection=function(n){return arguments.length?e(Zu(t=n)):t},n},ao.svg.symbol=function(){function n(n,r){return(Ul.get(t.call(this,n,r))||$u)(e.call(this,n,r))}var t=Xu,e=Vu;return n.type=function(e){return arguments.length?(t=En(e),n):t},n.size=function(t){return arguments.length?(e=En(t),n):e},n};var Ul=ao.map({circle:$u,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Fl)),e=t*Fl;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ao.svg.symbolTypes=Ul.keys();var jl=Math.sqrt(3),Fl=Math.tan(30*Yo);Co.transition=function(n){for(var t,e,r=Hl||++Zl,i=Ku(n),u=[],o=Ol||{time:Date.now(),ease:Nr,delay:0,duration:250},a=-1,l=this.length;++au;u++){i.push(t=[]);for(var e=this[u],a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return Wu(i,this.namespace,this.id)},Yl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(i){i[r][e].tween.set(n,t)})},Yl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?$r:Mr,a=ao.ns.qualify(n);return Ju(this,"attr."+n,t,a.local?u:i)},Yl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=ao.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Yl.style=function(n,e,r){function i(){this.style.removeProperty(n)}function u(e){return null==e?i:(e+="",function(){var i,u=t(this).getComputedStyle(this,null).getPropertyValue(n);return u!==e&&(i=Mr(u,e),function(t){this.style.setProperty(n,i(t),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof n){2>o&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Ju(this,"style."+n,e,u)},Yl.styleTween=function(n,e,r){function i(i,u){var o=e.call(this,i,u,t(this).getComputedStyle(this,null).getPropertyValue(n));return o&&function(t){this.style.setProperty(n,o(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,i)},Yl.text=function(n){return Ju(this,"text",n,Gu)},Yl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Yl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ao.ease.apply(ao,arguments)),Y(this,function(r){r[e][t].ease=n}))},Yl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,i,u){r[e][t].delay=+n.call(r,r.__data__,i,u)}:(n=+n,function(r){r[e][t].delay=n}))},Yl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,i,u){r[e][t].duration=Math.max(1,n.call(r,r.__data__,i,u))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Yl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var i=Ol,u=Hl;try{Hl=e,Y(this,function(t,i,u){Ol=t[r][e],n.call(t,t.__data__,i,u)})}finally{Ol=i,Hl=u}}else Y(this,function(i){var u=i[r][e];(u.event||(u.event=ao.dispatch("start","end","interrupt"))).on(n,t)});return this},Yl.transition=function(){for(var n,t,e,r,i=this.id,u=++Zl,o=this.namespace,a=[],l=0,c=this.length;c>l;l++){a.push(n=[]);for(var t=this[l],f=0,s=t.length;s>f;f++)(e=t[f])&&(r=e[o][i],Qu(e,f,o,u,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Wu(a,o,u)},ao.svg.axis=function(){function n(n){n.each(function(){var n,c=ao.select(this),f=this.__chart__||e,s=this.__chart__=e.copy(),h=null==l?s.ticks?s.ticks.apply(s,a):s.domain():l,p=null==t?s.tickFormat?s.tickFormat.apply(s,a):m:t,g=c.selectAll(".tick").data(h,s),v=g.enter().insert("g",".domain").attr("class","tick").style("opacity",Uo),d=ao.transition(g.exit()).style("opacity",Uo).remove(),y=ao.transition(g.order()).style("opacity",1),M=Math.max(i,0)+o,x=Zi(s),b=c.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),ao.transition(b));v.append("line"),v.append("text");var w,S,k,N,E=v.select("line"),A=y.select("line"),C=g.select("text").text(p),z=v.select("text"),L=y.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=no,w="x",k="y",S="x2",N="y2",C.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+q*u+"V0H"+x[1]+"V"+q*u)):(n=to,w="y",k="x",S="y2",N="x2",C.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),_.attr("d","M"+q*u+","+x[0]+"H0V"+x[1]+"H"+q*u)),E.attr(N,q*i),z.attr(k,q*M),A.attr(S,0).attr(N,q*i),L.attr(w,0).attr(k,q*M),s.rangeBand){var T=s,R=T.rangeBand()/2;f=s=function(n){return T(n)+R}}else f.rangeBand?f=s:d.call(n,s,f);v.call(n,f,s),y.call(n,s,s)})}var t,e=ao.scale.linear(),r=Vl,i=6,u=6,o=3,a=[10],l=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Xl?t+"":Vl,n):r},n.ticks=function(){return arguments.length?(a=co(arguments),n):a},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Vl="bottom",Xl={top:1,right:1,bottom:1,left:1};ao.svg.brush=function(){function n(t){t.each(function(){var t=ao.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=t.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=t.selectAll(".resize").data(v,m);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return $l[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,s=ao.transition(t),h=ao.transition(o);c&&(l=Zi(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),r(s)),f&&(l=Zi(f),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(s)),e(s)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function u(){function u(){32==ao.event.keyCode&&(C||(M=null,L[0]-=s[1],L[1]-=h[1],C=2),S())}function v(){32==ao.event.keyCode&&2==C&&(L[0]+=s[1],L[1]+=h[1],C=0,S())}function d(){var n=ao.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(ao.event.altKey?(M||(M=[(s[0]+s[1])/2,(h[0]+h[1])/2]),L[0]=s[+(n[0]f?(i=r,r=f):i=f),v[0]!=r||v[1]!=i?(e?a=null:o=null,v[0]=r,v[1]=i,!0):void 0}function m(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ao.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=ao.select(ao.event.target),w=l.of(b,arguments),k=ao.select(b),N=_.datum(),E=!/^(n|s)$/.test(N)&&c,A=!/^(e|w)$/.test(N)&&f,C=_.classed("extent"),z=W(b),L=ao.mouse(b),q=ao.select(t(b)).on("keydown.brush",u).on("keyup.brush",v);if(ao.event.changedTouches?q.on("touchmove.brush",d).on("touchend.brush",m):q.on("mousemove.brush",d).on("mouseup.brush",m),k.interrupt().selectAll("*").interrupt(),C)L[0]=s[0]-L[0],L[1]=h[0]-L[1];else if(N){var T=+/w$/.test(N),R=+/^n/.test(N);x=[s[1-T]-L[0],h[1-R]-L[1]],L[0]=s[T],L[1]=h[R]}else ao.event.altKey&&(M=L.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ao.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var o,a,l=N(n,"brushstart","brush","brushend"),c=null,f=null,s=[0,0],h=[0,0],p=!0,g=!0,v=Bl[0];return n.event=function(n){n.each(function(){var n=l.of(this,arguments),t={x:s,y:h,i:o,j:a},e=this.__chart__||t;this.__chart__=t,Hl?ao.select(this).transition().each("start.brush",function(){o=e.i,a=e.j,s=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=xr(s,t.x),r=xr(h,t.y);return o=a=null,function(i){s=t.x=e(i),h=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,v=Bl[!c<<1|!f],n):c},n.y=function(t){return arguments.length?(f=t,v=Bl[!c<<1|!f],n):f},n.clamp=function(t){return arguments.length?(c&&f?(p=!!t[0],g=!!t[1]):c?p=!!t:f&&(g=!!t),n):c&&f?[p,g]:c?p:f?g:null},n.extent=function(t){var e,r,i,u,l;return arguments.length?(c&&(e=t[0],r=t[1],f&&(e=e[0],r=r[0]),o=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(l=e,e=r,r=l),e==s[0]&&r==s[1]||(s=[e,r])),f&&(i=t[0],u=t[1],c&&(i=i[1],u=u[1]),a=[i,u],f.invert&&(i=f(i),u=f(u)),i>u&&(l=i,i=u,u=l),i==h[0]&&u==h[1]||(h=[i,u])),n):(c&&(o?(e=o[0],r=o[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(l=e,e=r,r=l))),f&&(a?(i=a[0],u=a[1]):(i=h[0],u=h[1],f.invert&&(i=f.invert(i),u=f.invert(u)),i>u&&(l=i,i=u,u=l))),c&&f?[[e,i],[r,u]]:c?[e,r]:f&&[i,u])},n.clear=function(){return n.empty()||(s=[0,0],h=[0,0],o=a=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!f&&h[0]==h[1]},ao.rebind(n,l,"on")};var $l={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Bl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Wl=ga.format=xa.timeFormat,Jl=Wl.utc,Gl=Jl("%Y-%m-%dT%H:%M:%S.%LZ");Wl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?eo:Gl,eo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},eo.toString=Gl.toString,ga.second=On(function(n){return new va(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ga.seconds=ga.second.range,ga.seconds.utc=ga.second.utc.range,ga.minute=On(function(n){return new va(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ga.minutes=ga.minute.range,ga.minutes.utc=ga.minute.utc.range,ga.hour=On(function(n){var t=n.getTimezoneOffset()/60;return new va(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ga.hours=ga.hour.range,ga.hours.utc=ga.hour.utc.range,ga.month=On(function(n){return n=ga.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ga.months=ga.month.range,ga.months.utc=ga.month.utc.range;var Kl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ql=[[ga.second,1],[ga.second,5],[ga.second,15],[ga.second,30],[ga.minute,1],[ga.minute,5],[ga.minute,15],[ga.minute,30],[ga.hour,1],[ga.hour,3],[ga.hour,6],[ga.hour,12],[ga.day,1],[ga.day,2],[ga.week,1],[ga.month,1],[ga.month,3],[ga.year,1]],nc=Wl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",zt]]),tc={range:function(n,t,e){return ao.range(Math.ceil(n/e)*e,+t,e).map(io)},floor:m,ceil:m};Ql.year=ga.year,ga.scale=function(){return ro(ao.scale.linear(),Ql,nc)};var ec=Ql.map(function(n){return[n[0].utc,n[1]]}),rc=Jl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",zt]]);ec.year=ga.year.utc,ga.scale.utc=function(){return ro(ao.scale.linear(),ec,rc)},ao.text=An(function(n){return n.responseText}),ao.json=function(n,t){return Cn(n,"application/json",uo,t)},ao.html=function(n,t){return Cn(n,"text/html",oo,t)},ao.xml=An(function(n){return n.responseXML}),"function"==typeof define&&define.amd?(this.d3=ao,define(ao)):"object"==typeof module&&module.exports?module.exports=ao:this.d3=ao}(); \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js new file mode 100644 index 0000000..756cc08 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js @@ -0,0 +1,61 @@ + $(function() { + var $window = $(window) + , $top_link = $('#toplink') + , $body = $('body, html') + , offset = $('#code').offset().top + , hidePopover = function ($target) { + $target.data('popover-hover', false); + + setTimeout(function () { + if (!$target.data('popover-hover')) { + $target.popover('hide'); + } + }, 300); + }; + + $top_link.hide().click(function(event) { + event.preventDefault(); + $body.animate({scrollTop:0}, 800); + }); + + $window.scroll(function() { + if($window.scrollTop() > offset) { + $top_link.fadeIn(); + } else { + $top_link.fadeOut(); + } + }).scroll(); + + $('.popin') + .popover({trigger: 'manual'}) + .on({ + 'mouseenter.popover': function () { + var $target = $(this); + + $target.data('popover-hover', true); + + // popover already displayed + if ($target.next('.popover').length) { + return; + } + + // show the popover + $target.popover('show'); + + // register mouse events on the popover + $target.next('.popover:not(.popover-initialized)') + .on({ + 'mouseenter': function () { + $target.data('popover-hover', true); + }, + 'mouseleave': function () { + hidePopover($target); + } + }) + .addClass('popover-initialized'); + }, + 'mouseleave.popover': function () { + hidePopover($(this)); + } + }); + }); diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/holder.min.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/holder.min.js new file mode 100644 index 0000000..6bfc844 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/holder.min.js @@ -0,0 +1,12 @@ +/*! + +Holder - client side image placeholders +Version 2.7.1+6hydf +© 2015 Ivan Malopinsky - http://imsky.co + +Site: http://holderjs.com +Issues: https://github.com/imsky/holder/issues +License: http://opensource.org/licenses/MIT + +*/ +!function(a){if(a.document){var b=a.document;b.querySelectorAll||(b.querySelectorAll=function(c){var d,e=b.createElement("style"),f=[];for(b.documentElement.firstChild.appendChild(e),b._qsa=[],e.styleSheet.cssText=c+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",a.scrollBy(0,0),e.parentNode.removeChild(e);b._qsa.length;)d=b._qsa.shift(),d.style.removeAttribute("x-qsa"),f.push(d);return b._qsa=null,f}),b.querySelector||(b.querySelector=function(a){var c=b.querySelectorAll(a);return c.length?c[0]:null}),b.getElementsByClassName||(b.getElementsByClassName=function(a){return a=String(a).replace(/^|\s+/g,"."),b.querySelectorAll(a)}),Object.keys||(Object.keys=function(a){if(a!==Object(a))throw TypeError("Object.keys called on non-object");var b,c=[];for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&c.push(b);return c}),function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.atob=a.atob||function(a){a=String(a);var c,d=0,e=[],f=0,g=0;if(a=a.replace(/\s/g,""),a.length%4===0&&(a=a.replace(/=+$/,"")),a.length%4===1)throw Error("InvalidCharacterError");if(/[^+/0-9A-Za-z]/.test(a))throw Error("InvalidCharacterError");for(;d>16&255)),e.push(String.fromCharCode(f>>8&255)),e.push(String.fromCharCode(255&f)),g=0,f=0),d+=1;return 12===g?(f>>=4,e.push(String.fromCharCode(255&f))):18===g&&(f>>=2,e.push(String.fromCharCode(f>>8&255)),e.push(String.fromCharCode(255&f))),e.join("")},a.btoa=a.btoa||function(a){a=String(a);var c,d,e,f,g,h,i,j=0,k=[];if(/[^\x00-\xFF]/.test(a))throw Error("InvalidCharacterError");for(;j>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,j===a.length+2?(h=64,i=64):j===a.length+1&&(i=64),k.push(b.charAt(f),b.charAt(g),b.charAt(h),b.charAt(i));return k.join("")}}(a),Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(a){var b=this.__proto__||this.constructor.prototype;return a in this&&(!(a in b)||b[a]!==this[a])}),function(){if("performance"in a==!1&&(a.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in a.performance==!1){var b=Date.now();performance.timing&&performance.timing.navigationStart&&(b=performance.timing.navigationStart),a.performance.now=function(){return Date.now()-b}}}(),a.requestAnimationFrame||(a.webkitRequestAnimationFrame?!function(a){a.requestAnimationFrame=function(b){return webkitRequestAnimationFrame(function(){b(a.performance.now())})},a.cancelAnimationFrame=webkitCancelAnimationFrame}(a):a.mozRequestAnimationFrame?!function(a){a.requestAnimationFrame=function(b){return mozRequestAnimationFrame(function(){b(a.performance.now())})},a.cancelAnimationFrame=mozCancelAnimationFrame}(a):!function(a){a.requestAnimationFrame=function(b){return a.setTimeout(b,1e3/60)},a.cancelAnimationFrame=a.clearTimeout}(a))}}(this),function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.Holder=b():a.Holder=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){(function(b){function d(a,b,c,d){var f=e(c.substr(c.lastIndexOf(a.domain)),a);f&&h({mode:null,el:d,flags:f,engineSettings:b})}function e(a,b){var c={theme:B(J.settings.themes.gray,null),stylesheets:b.stylesheets,instanceOptions:b};return a.match(/([\d]+p?)x([\d]+p?)(?:\?|$)/)?f(a,c):g(a,c)}function f(a,b){var c=a.split("?"),d=c[0].split("/");b.holderURL=a;var e=d[1],f=e.match(/([\d]+p?)x([\d]+p?)/);if(!f)return!1;if(b.fluid=-1!==e.indexOf("p"),b.dimensions={width:f[1].replace("p","%"),height:f[2].replace("p","%")},2===c.length){var g=A.parse(c[1]);if(g.bg&&(b.theme.background=(-1===g.bg.indexOf("#")?"#":"")+g.bg),g.fg&&(b.theme.foreground=(-1===g.fg.indexOf("#")?"#":"")+g.fg),g.theme&&b.instanceOptions.themes.hasOwnProperty(g.theme)&&(b.theme=B(b.instanceOptions.themes[g.theme],null)),g.text&&(b.text=g.text),g.textmode&&(b.textmode=g.textmode),g.size&&(b.size=g.size),g.font&&(b.font=g.font),g.align&&(b.align=g.align),b.nowrap=z.truthy(g.nowrap),b.auto=z.truthy(g.auto),z.truthy(g.random)){J.vars.cache.themeKeys=J.vars.cache.themeKeys||Object.keys(b.instanceOptions.themes);var h=J.vars.cache.themeKeys[0|Math.random()*J.vars.cache.themeKeys.length];b.theme=B(b.instanceOptions.themes[h],null)}}return b}function g(a,b){var c=!1,d=String.fromCharCode(11),e=a.replace(/([^\\])\//g,"$1"+d).split(d),f=/%[0-9a-f]{2}/gi,g=b.instanceOptions;b.holderURL=[];for(var h=e.length,i=0;h>i;i++){var j=e[i];if(j.match(f))try{j=decodeURIComponent(j)}catch(k){j=e[i]}var l=!1;if(J.flags.dimensions.match(j))c=!0,b.dimensions=J.flags.dimensions.output(j),l=!0;else if(J.flags.fluid.match(j))c=!0,b.dimensions=J.flags.fluid.output(j),b.fluid=!0,l=!0;else if(J.flags.textmode.match(j))b.textmode=J.flags.textmode.output(j),l=!0;else if(J.flags.colors.match(j)){var m=J.flags.colors.output(j);b.theme=B(b.theme,m),l=!0}else if(g.themes[j])g.themes.hasOwnProperty(j)&&(b.theme=B(g.themes[j],null)),l=!0;else if(J.flags.font.match(j))b.font=J.flags.font.output(j),l=!0;else if(J.flags.auto.match(j))b.auto=!0,l=!0;else if(J.flags.text.match(j))b.text=J.flags.text.output(j),l=!0;else if(J.flags.size.match(j))b.size=J.flags.size.output(j),l=!0;else if(J.flags.random.match(j)){null==J.vars.cache.themeKeys&&(J.vars.cache.themeKeys=Object.keys(g.themes));var n=J.vars.cache.themeKeys[0|Math.random()*J.vars.cache.themeKeys.length];b.theme=B(g.themes[n],null),l=!0}l&&b.holderURL.push(j)}return b.holderURL.unshift(g.domain),b.holderURL=b.holderURL.join("/"),c?b:!1}function h(a){var b=a.mode,c=a.el,d=a.flags,e=a.engineSettings,f=d.dimensions,g=d.theme,h=f.width+"x"+f.height;if(b=null==b?d.fluid?"fluid":"image":b,null!=d.text&&(g.text=d.text,"object"===c.nodeName.toLowerCase())){for(var j=g.text.split("\\n"),k=0;k1){var n,o=0,p=0,q=0;j=new e.Group("line"+q),("left"===a.align||"right"===a.align)&&(m=a.width*(1-2*(1-J.setup.lineWrapRatio)));for(var r=0;r=m||t===!0)&&(b(g,j,o,g.properties.leading),g.add(j),o=0,p+=g.properties.leading,q+=1,j=new e.Group("line"+q),j.y=p),t!==!0&&(i.moveTo(o,0),o+=h.spaceWidth+s.width,j.add(i))}if(b(g,j,o,g.properties.leading),g.add(j),"left"===a.align)g.moveTo(a.width-l,null,null);else if("right"===a.align){for(n in g.children)j=g.children[n],j.moveTo(a.width-j.width,null,null);g.moveTo(0-(a.width-l),null,null)}else{for(n in g.children)j=g.children[n],j.moveTo((g.width-j.width)/2,null,null);g.moveTo((a.width-g.width)/2,null,null)}g.moveTo(null,(a.height-g.height)/2,null),(a.height-g.height)/2<0&&g.moveTo(null,0,null)}else i=new e.Text(a.text),j=new e.Group("line0"),j.add(i),g.add(j),"left"===a.align?g.moveTo(a.width-l,null,null):"right"===a.align?g.moveTo(0-(a.width-l),null,null):g.moveTo((a.width-h.boundingBox.width)/2,null,null),g.moveTo(null,(a.height-h.boundingBox.height)/2,null);return d}function k(a,b,c){var d=parseInt(a,10),e=parseInt(b,10),f=Math.max(d,e),g=Math.min(d,e),h=.8*Math.min(g,f*J.defaults.scale);return Math.round(Math.max(c,h))}function l(a){var b;b=null==a||null==a.nodeType?J.vars.resizableImages:[a];for(var c=0,d=b.length;d>c;c++){var e=b[c];if(e.holderData){var f=e.holderData.flags,g=D(e);if(g){if(!e.holderData.resizeUpdate)continue;if(f.fluid&&f.auto){var h=e.holderData.fluidConfig;switch(h.mode){case"width":g.height=g.width/h.ratio;break;case"height":g.width=g.height*h.ratio}}var j={mode:"image",holderSettings:{dimensions:g,theme:f.theme,flags:f},el:e,engineSettings:e.holderData.engineSettings};"exact"==f.textmode&&(f.exactDimensions=g,j.holderSettings.dimensions=f.dimensions),i(j)}else p(e)}}}function m(a){if(a.holderData){var b=D(a);if(b){var c=a.holderData.flags,d={fluidHeight:"%"==c.dimensions.height.slice(-1),fluidWidth:"%"==c.dimensions.width.slice(-1),mode:null,initialDimensions:b};d.fluidWidth&&!d.fluidHeight?(d.mode="width",d.ratio=d.initialDimensions.width/parseFloat(c.dimensions.height)):!d.fluidWidth&&d.fluidHeight&&(d.mode="height",d.ratio=parseFloat(c.dimensions.width)/d.initialDimensions.height),a.holderData.fluidConfig=d}else p(a)}}function n(){for(var a,c=[],d=Object.keys(J.vars.invisibleImages),e=0,f=d.length;f>e;e++)a=J.vars.invisibleImages[d[e]],D(a)&&"img"==a.nodeName.toLowerCase()&&(c.push(a),delete J.vars.invisibleImages[d[e]]);c.length&&I.run({images:c}),b.requestAnimationFrame(n)}function o(){J.vars.visibilityCheckStarted||(b.requestAnimationFrame(n),J.vars.visibilityCheckStarted=!0)}function p(a){a.holderData.invisibleId||(J.vars.invisibleId+=1,J.vars.invisibleImages["i"+J.vars.invisibleId]=a,a.holderData.invisibleId=J.vars.invisibleId)}function q(a,b){return null==b?document.createElement(a):document.createElementNS(b,a)}function r(a,b){for(var c in b)a.setAttribute(c,b[c])}function s(a,b,c){var d,e;null==a?(a=q("svg",E),d=q("defs",E),e=q("style",E),r(e,{type:"text/css"}),d.appendChild(e),a.appendChild(d)):e=a.querySelector("style"),a.webkitMatchesSelector&&a.setAttribute("xmlns",E);for(var f=0;f=0;h--){var i=g.createProcessingInstruction("xml-stylesheet",'href="'+f[h]+'" rel="stylesheet"');g.insertBefore(i,g.firstChild)}g.removeChild(g.documentElement),e=d.serializeToString(g)}var j=d.serializeToString(a);return j=j.replace(/\&(\#[0-9]{2,}\;)/g,"&$1"),e+j}}function u(){return b.DOMParser?(new DOMParser).parseFromString("","application/xml"):void 0}function v(a){J.vars.debounceTimer||a.call(this),J.vars.debounceTimer&&b.clearTimeout(J.vars.debounceTimer),J.vars.debounceTimer=b.setTimeout(function(){J.vars.debounceTimer=null,a.call(this)},J.setup.debounce)}function w(){v(function(){l(null)})}var x=c(1),y=c(2),z=c(3),A=c(4),B=z.extend,C=z.getNodeArray,D=z.dimensionCheck,E="http://www.w3.org/2000/svg",F=8,G="2.7.1",H="\nCreated with Holder.js "+G+".\nLearn more at http://holderjs.com\n(c) 2012-2015 Ivan Malopinsky - http://imsky.co\n",I={version:G,addTheme:function(a,b){return null!=a&&null!=b&&(J.settings.themes[a]=b),delete J.vars.cache.themeKeys,this},addImage:function(a,b){var c=document.querySelectorAll(b);if(c.length)for(var d=0,e=c.length;e>d;d++){var f=q("img"),g={};g[J.vars.dataAttr]=a,r(f,g),c[d].appendChild(f)}return this},setResizeUpdate:function(a,b){a.holderData&&(a.holderData.resizeUpdate=!!b,a.holderData.resizeUpdate&&l(a))},run:function(a){a=a||{};var c={},f=B(J.settings,a);J.vars.preempted=!0,J.vars.dataAttr=f.dataAttr||J.vars.dataAttr,c.renderer=f.renderer?f.renderer:J.setup.renderer,-1===J.setup.renderers.join(",").indexOf(c.renderer)&&(c.renderer=J.setup.supportsSVG?"svg":J.setup.supportsCanvas?"canvas":"html");var g=C(f.images),i=C(f.bgnodes),j=C(f.stylenodes),k=C(f.objects);c.stylesheets=[],c.svgXMLStylesheet=!0,c.noFontFallback=f.noFontFallback?f.noFontFallback:!1;for(var l=0;l1){c.nodeValue="";for(var u=0;u=0?b:1)}function f(a){v?e(a):w.push(a)}null==document.readyState&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",function y(){document.removeEventListener("DOMContentLoaded",y,!1),document.readyState="complete"},!1),document.readyState="loading");var g=a.document,h=g.documentElement,i="load",j=!1,k="on"+i,l="complete",m="readyState",n="attachEvent",o="detachEvent",p="addEventListener",q="DOMContentLoaded",r="onreadystatechange",s="removeEventListener",t=p in g,u=j,v=j,w=[];if(g[m]===l)e(b);else if(t)g[p](q,c,j),a[p](i,c,j);else{g[n](r,c),a[n](k,c);try{u=null==a.frameElement&&h}catch(x){}u&&u.doScroll&&!function z(){if(!v){try{u.doScroll("left")}catch(a){return e(z,50)}d(),b()}}()}return f.version="1.4.0",f.isReady=function(){return v},f}a.exports="undefined"!=typeof window&&b(window)},function(a,b,c){var d=c(5),e=function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}var c=1,e=d.defclass({constructor:function(a){c++,this.parent=null,this.children={},this.id=c,this.name="n"+c,null!=a&&(this.name=a),this.x=0,this.y=0,this.z=0,this.width=0,this.height=0},resize:function(a,b){null!=a&&(this.width=a),null!=b&&(this.height=b)},moveTo:function(a,b,c){this.x=null!=a?a:this.x,this.y=null!=b?b:this.y,this.z=null!=c?c:this.z},add:function(a){var b=a.name;if(null!=this.children[b])throw"SceneGraph: child with that name already exists: "+b;this.children[b]=a,a.parent=this}}),f=d(e,function(b){this.constructor=function(){b.constructor.call(this,"root"),this.properties=a}}),g=d(e,function(a){function c(c,d){if(a.constructor.call(this,c),this.properties={fill:"#000"},null!=d)b(this.properties,d);else if(null!=c&&"string"!=typeof c)throw"SceneGraph: invalid node name"}this.Group=d.extend(this,{constructor:c,type:"group"}),this.Rect=d.extend(this,{constructor:c,type:"rect"}),this.Text=d.extend(this,{constructor:function(a){c.call(this),this.properties.text=a},type:"text"})}),h=new f;return this.Shape=g,this.root=h,this};a.exports=e},function(a,b){(function(a){b.extend=function(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);if(null!=b)for(var e in b)b.hasOwnProperty(e)&&(c[e]=b[e]);return c},b.cssProps=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c+":"+a[c]);return b.join(";")},b.encodeHtmlEntity=function(a){for(var b=[],c=0,d=a.length-1;d>=0;d--)c=a.charCodeAt(d),b.unshift(c>128?["&#",c,";"].join(""):a[d]);return b.join("")},b.getNodeArray=function(b){var c=null;return"string"==typeof b?c=document.querySelectorAll(b):a.NodeList&&b instanceof a.NodeList?c=b:a.Node&&b instanceof a.Node?c=[b]:a.HTMLCollection&&b instanceof a.HTMLCollection?c=b:b instanceof Array?c=b:null===b&&(c=[]),c},b.imageExists=function(a,b){var c=new Image;c.onerror=function(){b.call(this,!1)},c.onload=function(){b.call(this,!0)},c.src=a},b.decodeHtmlEntity=function(a){return a.replace(/&#(\d+);/g,function(a,b){return String.fromCharCode(b)})},b.dimensionCheck=function(a){var b={height:a.clientHeight,width:a.clientWidth};return b.height&&b.width?b:!1},b.truthy=function(a){return"string"==typeof a?"true"===a||"yes"===a||"1"===a||"on"===a||"✓"===a:!!a}}).call(b,function(){return this}())},function(a,b,c){var d=encodeURIComponent,e=decodeURIComponent,f=c(6),g=c(7),h=/(\w+)\[(\d+)\]/,i=/\w+\.\w+/;b.parse=function(a){if("string"!=typeof a)return{};if(a=f(a),""===a)return{};"?"===a.charAt(0)&&(a=a.slice(1));for(var b={},c=a.split("&"),d=0;d