diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b5cf4da --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,86 @@ +# This file is a template, and might need editing before it works on your project. +# Official framework image. Look for the different tagged releases at: +# https://hub.docker.com/r/library/php +image: registry.waf.or.id/ywa/sarpras:latest + +# Pick zero or more services to be used on all builds. +# Only needed when using a docker container to run your tests in. +# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service +services: + # - mysql:latest + +variables: + # MYSQL_DATABASE: laraland + # MYSQL_ROOT_PASSWORD: secret + +# This folder is cached between builds +# http://docs.gitlab.com/ce/ci/yaml/README.html#cache +cache: + paths: + - vendor/ + # - node_modules/ + +# This is a basic example for a gem or script which doesn't use +# services such as redis or postgres +before_script: + # Update packages + # - apt-get update -yqq + + # Upgrade to Node 7 + # - curl -sL https://deb.nodesource.com/setup_7.x | bash - + + # Install dependencies + # - apt-get install git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq + + # Install php extensions + # - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache + + # Install & enable Xdebug for code coverage reports + # - pecl install xdebug + # - docker-php-ext-enable xdebug + + # Install Composer and project dependencies. + - curl -sS https://getcomposer.org/installer | php + - php composer.phar install + + # Install Node dependencies. + # comment this out if you don't have a node dependency + # - npm install + + # Copy over testing configuration. + # Don't forget to set the database config in .env.testing correctly + # DB_HOST=mysql + # DB_DATABASE=project_name + # DB_USERNAME=root + # DB_PASSWORD=secret + - cp .env.testing .env + + # Run npm build + # comment this out if you don't have a frontend build + # you can change this to to your frontend building script like + # npm run build + # - npm run dev + + # Generate an application key. Re-cache. + - php artisan key:generate + - php artisan config:cache + + # Run database migrations. + - php artisan migrate + + # Run database seed + - php artisan db:seed + +test: + script: + # run laravel tests + # - php vendor/bin/phpunit --coverage-text --colors=never + - php vendor/bin/codeception run acceptance + - php vendor/bin/codeception run functional + - php vendor/bin/codeception run functional -c Modules/Karyawaf + + # run frontend tests + # if you have any task for testing frontend + # set it in your package.json script + # comment this out if you don't have a frontend test + # - npm test diff --git a/Modules/Karyawaf/Config/.gitkeep b/Modules/Karyawaf/Config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Config/config.php b/Modules/Karyawaf/Config/config.php new file mode 100644 index 0000000..1990a0c --- /dev/null +++ b/Modules/Karyawaf/Config/config.php @@ -0,0 +1,5 @@ + 'Karyawaf' +]; diff --git a/Modules/Karyawaf/Console/.gitkeep b/Modules/Karyawaf/Console/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Database/Migrations/.gitkeep b/Modules/Karyawaf/Database/Migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Database/Migrations/2018_07_24_030655_create_karyawans_table.php b/Modules/Karyawaf/Database/Migrations/2018_07_24_030655_create_karyawans_table.php new file mode 100644 index 0000000..1484937 --- /dev/null +++ b/Modules/Karyawaf/Database/Migrations/2018_07_24_030655_create_karyawans_table.php @@ -0,0 +1,46 @@ +increments('id'); + $table->string('nama', 50); + $table->string('posisi', 50); + $table->string('tempat_lahir', 20); + $table->datetime('tanggal_lahir'); + $table->datetime('rekrut'); + $table->boolean('status'); + $table->unsignedInteger('created_by'); + + $table->timestamps(); + $table->softDeletes(); + + $table->foreign('created_by') + ->references('id') + ->on('users') + ->onUpdate('cascade') + ->onDelete('restrict'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('karyawans'); + } +} diff --git a/Modules/Karyawaf/Database/Seeders/.gitkeep b/Modules/Karyawaf/Database/Seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Database/Seeders/KaryawafDatabaseSeeder.php b/Modules/Karyawaf/Database/Seeders/KaryawafDatabaseSeeder.php new file mode 100644 index 0000000..b9fc535 --- /dev/null +++ b/Modules/Karyawaf/Database/Seeders/KaryawafDatabaseSeeder.php @@ -0,0 +1,21 @@ +call(KaryawansTableSeeder::class); + } +} diff --git a/Modules/Karyawaf/Database/Seeders/KaryawansTableSeeder.php b/Modules/Karyawaf/Database/Seeders/KaryawansTableSeeder.php new file mode 100644 index 0000000..e6f501a --- /dev/null +++ b/Modules/Karyawaf/Database/Seeders/KaryawansTableSeeder.php @@ -0,0 +1,21 @@ +create(); + } +} diff --git a/Modules/Karyawaf/Database/factories/.gitkeep b/Modules/Karyawaf/Database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Database/factories/KaryawansFactory.php b/Modules/Karyawaf/Database/factories/KaryawansFactory.php new file mode 100644 index 0000000..f4c2f2e --- /dev/null +++ b/Modules/Karyawaf/Database/factories/KaryawansFactory.php @@ -0,0 +1,15 @@ +define(Modules\Karyawaf\Entities\Karyawan::class, function (Faker $faker) { + return [ + 'nama' => $faker->name(), + 'posisi' => $faker->jobTitle(), + 'tempat_lahir' => $faker->city(), + 'tanggal_lahir' => Carbon\Carbon::instance($faker->dateTimeBetween('-50 years', '-19 years', 'Asia/Jakarta')), + 'rekrut' => Carbon\Carbon::instance($faker->dateTimeBetween('-10 years', '-1 year', 'Asia/Jakarta')), + 'status' => 1, + 'created_by' => App\User::find(1)->id + ]; +}); diff --git a/Modules/Karyawaf/Entities/.gitkeep b/Modules/Karyawaf/Entities/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Entities/Karyawan.php b/Modules/Karyawaf/Entities/Karyawan.php new file mode 100644 index 0000000..32a2bcc --- /dev/null +++ b/Modules/Karyawaf/Entities/Karyawan.php @@ -0,0 +1,38 @@ + 'required|string|min:5', + 'posisi' => 'required|string|min:3', + 'tempat_lahir' => 'required|string|min:3', + 'tanggal_lahir' => 'required|date', + 'rekrut' => 'required|date', + 'status' => 'required|integer' + ]; + + public function creator() + { + return $this->belongsTo(\App\User::class, 'created_by'); + } +} diff --git a/Modules/Karyawaf/Http/Controllers/.gitkeep b/Modules/Karyawaf/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Http/Controllers/KaryawafController.php b/Modules/Karyawaf/Http/Controllers/KaryawafController.php new file mode 100644 index 0000000..fd595f4 --- /dev/null +++ b/Modules/Karyawaf/Http/Controllers/KaryawafController.php @@ -0,0 +1,72 @@ +json([ + 'data' => $response + ]); + } + + /** + * Show the form for creating a new resource. + * @return Response + */ + public function create() + { + return view('karyawaf::create'); + } + + /** + * Store a newly created resource in storage. + * @param StoreKaryawafKaryawan $request + * @return Response + */ + public function store(StoreKaryawafKaryawan $request) + { + $validated = $request->validated(); + + $response = Auth::user()->karyawans()->create($validated); // Auth::user()->karyawan->create() + + return response()->json([ + 'data' => $response + ]); + } + + /** + * Show the specified resource. + * @param $id + * @return Response + */ + public function show($id) + { + $response = Karyawan::find($id); + + return response()->json([ + 'data' => $response + ]); + } + + /** + * Show the form for editing the specified resource. + * @return Response + */ + public function edit() + { + return view('karyawaf::edit'); + } + + /** + * Update the specified resource in storage. + * @param UpdateKaryawafKaryawan $request + * @return Response + */ + public function update(UpdateKaryawafKaryawan $request, $id) + { + $karyawan = Karyawan::findOrFail($id); + + $validated = $request->validated(); + + $karyawan->update($validated); + + return response()->json([ + 'data' => $karyawan + ]); + } + + /** + * Remove the specified resource from storage. + * @param $id + * @return Response + */ + public function destroy($id) + { + $karyawan = Karyawan::findOrFail($id); + + $karyawan->delete(); + + return response()->json([ + 'message' => 'The data has been deleted' + ]); + } +} diff --git a/Modules/Karyawaf/Http/Middleware/.gitkeep b/Modules/Karyawaf/Http/Middleware/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Http/Requests/.gitkeep b/Modules/Karyawaf/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Http/Requests/StoreKaryawafKaryawan.php b/Modules/Karyawaf/Http/Requests/StoreKaryawafKaryawan.php new file mode 100644 index 0000000..20a8b6d --- /dev/null +++ b/Modules/Karyawaf/Http/Requests/StoreKaryawafKaryawan.php @@ -0,0 +1,30 @@ +can('create-karyawan'); + } +} diff --git a/Modules/Karyawaf/Http/Requests/UpdateKaryawafKaryawan.php b/Modules/Karyawaf/Http/Requests/UpdateKaryawafKaryawan.php new file mode 100644 index 0000000..574db4a --- /dev/null +++ b/Modules/Karyawaf/Http/Requests/UpdateKaryawafKaryawan.php @@ -0,0 +1,32 @@ +karyawan; + + return Karyawan::getUpdateRulesForId($id); + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return Auth::user()->can('update-karyawan'); + } +} diff --git a/Modules/Karyawaf/Http/routes.php b/Modules/Karyawaf/Http/routes.php new file mode 100644 index 0000000..a15a4cf --- /dev/null +++ b/Modules/Karyawaf/Http/routes.php @@ -0,0 +1,18 @@ + 'web', 'prefix' => 'karyawaf', 'namespace' => 'Modules\Karyawaf\Http\Controllers'], function() +{ + Route::get('/', 'KaryawafController@index'); +}); + +Route::group(['middleware' => ['api', 'auth:api'], 'prefix' => 'api/karyawaf', 'namespace' => 'Modules\Karyawaf\Http\Controllers'], function() +{ + Route::group(['prefix' => 'karyawans'], function() + { + Route::get('/', 'KaryawanController@index'); + Route::post('/', 'KaryawanController@store'); + Route::get('/{karyawan}', 'KaryawanController@show'); + Route::put('/{karyawan}', 'KaryawanController@update'); + Route::delete('/{karyawan}', 'KaryawanController@destroy'); + }); +}); diff --git a/Modules/Karyawaf/Providers/.gitkeep b/Modules/Karyawaf/Providers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Providers/KaryawafServiceProvider.php b/Modules/Karyawaf/Providers/KaryawafServiceProvider.php new file mode 100644 index 0000000..4d1203a --- /dev/null +++ b/Modules/Karyawaf/Providers/KaryawafServiceProvider.php @@ -0,0 +1,113 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->registerFactories(); + $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations'); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../Config/config.php' => config_path('karyawaf.php'), + ], 'config'); + $this->mergeConfigFrom( + __DIR__.'/../Config/config.php', 'karyawaf' + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/karyawaf'); + + $sourcePath = __DIR__.'/../Resources/views'; + + $this->publishes([ + $sourcePath => $viewPath + ],'views'); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/karyawaf'; + }, \Config::get('view.paths')), [$sourcePath]), 'karyawaf'); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/karyawaf'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, 'karyawaf'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'karyawaf'); + } + } + + /** + * Register an additional directory of factories. + * + * @return void + */ + public function registerFactories() + { + if (! app()->environment('production')) { + app(Factory::class)->load(__DIR__ . '/../Database/factories'); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } +} diff --git a/Modules/Karyawaf/Resources/assets/.gitkeep b/Modules/Karyawaf/Resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Resources/assets/js/app.js b/Modules/Karyawaf/Resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Resources/assets/sass/app.scss b/Modules/Karyawaf/Resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Resources/lang/.gitkeep b/Modules/Karyawaf/Resources/lang/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Resources/views/.gitkeep b/Modules/Karyawaf/Resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Karyawaf/Resources/views/index.blade.php b/Modules/Karyawaf/Resources/views/index.blade.php new file mode 100644 index 0000000..efd385a --- /dev/null +++ b/Modules/Karyawaf/Resources/views/index.blade.php @@ -0,0 +1,9 @@ +@extends('karyawaf::layouts.master') + +@section('content') +
+ This view is loaded from module: {!! config('karyawaf.name') !!} +
+@stop diff --git a/Modules/Karyawaf/Resources/views/layouts/master.blade.php b/Modules/Karyawaf/Resources/views/layouts/master.blade.php new file mode 100644 index 0000000..f77e7b1 --- /dev/null +++ b/Modules/Karyawaf/Resources/views/layouts/master.blade.php @@ -0,0 +1,19 @@ + + + + + + ++ /** + * Show the form for creating a new resource. + * @return Response + */ + public function create() + { + return view('karyawaf::create'); + } + + /** + * Store a newly created resource in storage. + * @param StoreKaryawafKaryawan $request + * @return Response + */ + public function store(StoreKaryawafKaryawan $request) + { + $validated = $request->validated(); + + $response = Auth::user()->karyawans()->create($validated); // Auth::user()->karyawan->create() + + return response()->json([ + 'data' => $response + ]); + } + + /** + * Show the specified resource. + * @param $id + * @return Response + */ + public function show($id) + { + $response = Karyawan::find($id); + + return response()->json([ + 'data' => $response + ]); + } ++ + +
"Class 'Modules\Karyawaf\Http\Controllers\Auth' not found"
+
+Key | +Value | +
LANG | +"en_US.UTF-8"
+
+ |
+
LESS | +"-F -g -i -M -R -S -w -X -z-4"
+
+ |
+
DISPLAY | +":0"
+
+ |
+
OLDPWD | +"/home/gregorio"
+
+ |
+
INVOCATION_ID | +"0a5aa167da604be2acc343c14c76b187"
+
+ |
+
EDITOR | +"vim"
+
+ |
+
GPG_TTY | +"/dev/pts/0"
+
+ |
+
MOZ_PLUGIN_PATH | +"/usr/lib/mozilla/plugins"
+
+ |
+
XDG_VTNR | +"1"
+
+ |
+
GIT_EDITOR | +"/home/gregorio/.bin/git_editor"
+
+ |
+
SSH_AUTH_SOCK | +"/run/user/1000/gnupg/S.gpg-agent.ssh"
+
+ |
+
XDG_SESSION_ID | +"c1"
+
+ |
+
USER | +"gregorio"
+
+ |
+
PAGER | +"less"
+
+ |
+
LSCOLORS | +"Gxfxcxdxbxegedabagacad"
+
+ |
+
PWD | +"/home/gregorio/Documents/codes/laraland"
+
+ |
+
HOME | +"/home/gregorio"
+
+ |
+
JOURNAL_STREAM | +"9:15868"
+
+ |
+
GTK_MODULES | +"canberra-gtk-module"
+
+ |
+
"/var/spool/mail/gregorio"
+
+ |
+ |
VISUAL | +"vim"
+
+ |
+
WINDOWPATH | +"1"
+
+ |
+
SHELL | +"/bin/zsh"
+
+ |
+
TERM | +"rxvt-256color"
+
+ |
+
SHLVL | +"3"
+
+ |
+
XDG_SEAT | +"seat0"
+
+ |
+
LOGNAME | +"gregorio"
+
+ |
+
DBUS_SESSION_BUS_ADDRESS | +"unix:path=/run/user/1000/bus"
+
+ |
+
XDG_RUNTIME_DIR | +"/run/user/1000"
+
+ |
+
XAUTHORITY | +"/home/gregorio/.Xauthority"
+
+ |
+
PATH | +"/home/gregorio/etc/joshd-dotfiles/bin.symlink:/home/gregorio/.bin/diff-highlight:/home/gregorio/etc/joshd-dotfiles/bin.symlink:/home/gregorio/.bin/diff-highlight:/home/gregorio/.local/bin:/home/gregorio/.npm-packages/bin:/home/gregorio/.npm-packages/bin:/home/gregorio/.config/composer/vendor/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/gregorio/.npm-packages/bin:/home/gregorio/.fzf/bin:/home/gregorio/.scripts"
+
+ |
+
WINDOWID | +"10485770"
+
+ |
+
COLORFGBG | +"default;default"
+
+ |
+
COLORTERM | +"rxvt"
+
+ |
+
_ | +"/usr/bin/php"
+
+ |
+
PHP_SELF | +"vendor/bin/codecept"
+
+ |
+
SCRIPT_NAME | +"vendor/bin/codecept"
+
+ |
+
SCRIPT_FILENAME | +"vendor/bin/codecept"
+
+ |
+
PATH_TRANSLATED | +"vendor/bin/codecept"
+
+ |
+
DOCUMENT_ROOT | +"" ++ |
+
REQUEST_TIME_FLOAT | +1532744825.1475
+
+ |
+
REQUEST_TIME | +1532744825
+
+ |
+
argv | +array:5 [ + 0 => "vendor/bin/codecept" + 1 => "run" + 2 => "functional" + 3 => "-c" + 4 => "Modules/Karyawaf" +] ++ |
+
argc | +5
+
+ |
+
SHELL_VERBOSITY | +0
+
+ |
+
APP_ENV | +"testing"
+
+ |
+
APP_KEY | +"base64:0qzWgXyeH+Eje5Ta3NEh/pZnyJeJo2GW/gCKK+0FVkU="
+
+ |
+
APP_DEBUG | +"true"
+
+ |
+
DB_CONNECTION | +"sqlite"
+
+ |
+
DB_HOST | +"sqlite"
+
+ |
+
DB_DATABASE | +":memory:"
+
+ |
+
DB_USERNAME | +"" ++ |
+
DB_PASSWORD | +"" ++ |
+
Key | +Value | +
SHELL_VERBOSITY | +0
+
+ |
+
APP_ENV | +"testing"
+
+ |
+
APP_KEY | +"base64:0qzWgXyeH+Eje5Ta3NEh/pZnyJeJo2GW/gCKK+0FVkU="
+
+ |
+
APP_DEBUG | +"true"
+
+ |
+
DB_CONNECTION | +"sqlite"
+
+ |
+
DB_HOST | +"sqlite"
+
+ |
+
DB_DATABASE | +":memory:"
+
+ |
+
DB_USERNAME | +"" ++ |
+
DB_PASSWORD | +"" ++ |
+
return $this->convertValidationExceptionToResponse($e, $request); + } + + return $request->expectsJson() + ? $this->prepareJsonResponse($request, $e) + : $this->prepareResponse($request, $e); + } + + /** + * Prepare exception for rendering. + * + * @param \Exception $e + * @return \Exception + */ + protected function prepareException(Exception $e) + { + if ($e instanceof ModelNotFoundException) { + $e = new NotFoundHttpException($e->getMessage(), $e); + } elseif ($e instanceof AuthorizationException) { + $e = new AccessDeniedHttpException($e->getMessage(), $e); + } elseif ($e instanceof TokenMismatchException) { + $e = new HttpException(419, $e->getMessage(), $e); + } + + return $e; + } + + /** + * Convert an authentication exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * @return \Illuminate\Http\Response + */ + protected function unauthenticated($request, AuthenticationException $exception) + { + return $request->expectsJson() + ? response()->json(['message' => $exception->getMessage()], 401) + : redirect()->guest(route('login')); + }+ + +
"This action is unauthorized."
+
+return []; + } + } + + /** + * Render an exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + public function render($request, Exception $e) + { + if (method_exists($e, 'render') && $response = $e->render($request)) { + return Router::toResponse($request, $response); + } elseif ($e instanceof Responsable) { + return $e->toResponse($request); + } + + $e = $this->prepareException($e); + + if ($e instanceof HttpResponseException) { + return $e->getResponse(); + } elseif ($e instanceof AuthenticationException) { + return $this->unauthenticated($request, $e); + } elseif ($e instanceof ValidationException) { + return $this->convertValidationExceptionToResponse($e, $request); + } + + return $request->expectsJson() + ? $this->prepareJsonResponse($request, $e) + : $this->prepareResponse($request, $e); + } + + /** + * Prepare exception for rendering. + * + * @param \Exception $e + * @return \Exception + */+ + +
AuthorizationException {#5215 + #message: "This action is unauthorized." + #code: 0 + #file: "/home/gregorio/Documents/codes/laraland/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php" + #line: 165 +} ++
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. + * + * @param \Exception $exception + * @return void + */ + public function report(Exception $exception) + { + parent::report($exception); + } + + /** + * Render an exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $exception + * @return \Illuminate\Http\Response + */ + public function render($request, Exception $exception) + { + return parent::render($request, $exception); + } +} ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
AuthorizationException {#5215 + #message: "This action is unauthorized." + #code: 0 + #file: "/home/gregorio/Documents/codes/laraland/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php" + #line: 165 +} ++
/** + * Report or log an exception. + * + * @param \Exception $e + * @return void + */ + public function report(Exception $e) + { + $this->laravelExceptionHandler->report($e); + } + + /** + * @param $request + * @param Exception $e + * @return \Symfony\Component\HttpFoundation\Response + * @throws Exception + */ + public function render($request, Exception $e) + { + $response = $this->laravelExceptionHandler->render($request, $e); + + if ($this->exceptionHandlingDisabled && $this->isSymfonyExceptionHandlerOutput($response->getContent())) { + // If content was generated by the \Symfony\Component\Debug\ExceptionHandler class + // the Laravel application could not handle the exception, + // so re-throw this exception if the Codeception user disabled Laravel's exception handling. + throw $e; + } + + return $response; + } + + /** + * Check if the response content is HTML output of the Symfony exception handler class. + * + * @param string $content + * @return bool + */ + private function isSymfonyExceptionHandlerOutput($content) + { + return strpos($content, '<div id="sf-resetcontent" class="sf-reset">') !== false ||+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
AuthorizationException {#5215 + #message: "This action is unauthorized." + #code: 0 + #file: "/home/gregorio/Documents/codes/laraland/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php" + #line: 165 +} ++
* Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + { + if (! $this->container->bound(ExceptionHandler::class) || + ! $passable instanceof Request) { + throw $e; + } + + $handler = $this->container->make(ExceptionHandler::class); + + $handler->report($e); + + $response = $handler->render($passable, $e); + + if (method_exists($response, 'withException')) { + $response->withException($e); + } + + return $response; + } +} ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
AuthorizationException {#5215 + #message: "This action is unauthorized." + #code: 0 + #file: "/home/gregorio/Documents/codes/laraland/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php" + #line: 165 +} ++
/** + * This extended pipeline catches any exceptions that occur during each slice. + * + * The exceptions are converted to HTTP responses for proper middleware handling. + */ +class Pipeline extends BasePipeline +{ + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + try { + return $destination($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
AuthorizationException {#5215 + #message: "This action is unauthorized." + #code: 0 + #file: "/home/gregorio/Documents/codes/laraland/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php" + #line: 165 +} ++
*/ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->container->call([$this, 'authorize']); + } + + return false; + } + + /** + * Handle a failed authorization attempt. + * + * @return void + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + protected function failedAuthorization() + { + throw new AuthorizationException('This action is unauthorized.'); + } + + /** + * Get the validated data from the request. + * + * @return array + */ + public function validated() + { + $rules = $this->container->call([$this, 'rules']); + + return $this->only(collect($rules)->keys()->map(function ($rule) { + return str_contains($rule, '.') ? explode('.', $rule)[0] : $rule; + })->unique()->toArray()); + } + + /** + * Get custom messages for validator errors. + * + * @return array+ + +
"This action is unauthorized."
+
+namespace Illuminate\Validation; + +/** + * Provides default implementation of ValidatesWhenResolved contract. + */ +trait ValidatesWhenResolvedTrait +{ + /** + * Validate the class instance. + * + * @return void + */ + public function validate() + { + $this->prepareForValidation(); + + $instance = $this->getValidatorInstance(); + + if (! $this->passesAuthorization()) { + $this->failedAuthorization(); + } elseif (! $instance->passes()) { + $this->failedValidation($instance); + } + } + + /** + * Prepare the data for validation. + * + * @return void + */ + protected function prepareForValidation() + { + // no default action + } + + /** + * Get the validator instance for the request. + * + * @return \Illuminate\Validation\Validator + */+ + + +
{ + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Bootstrap the application services. + * + * @return void + */ + public function boot() + { + $this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) { + $resolved->validate(); + }); + + $this->app->resolving(FormRequest::class, function ($request, $app) { + $this->initializeRequest($request, $app['request']); + + $request->setContainer($app)->setRedirector($app->make(Redirector::class)); + }); + } + + /** + * Initialize the form request with data from the given request. + * + * @param \Illuminate\Foundation\Http\FormRequest $form + * @param \Symfony\Component\HttpFoundation\Request $current + * @return void + */ + protected function initializeRequest(FormRequest $form, Request $current) + { + $files = $current->files->all(); ++ + + +
foreach ($callbacksPerType as $type => $callbacks) { + if ($type === $abstract || $object instanceof $type) { + $results = array_merge($results, $callbacks); + } + } + + return $results; + } + + /** + * Fire an array of callbacks with an object. + * + * @param mixed $object + * @param array $callbacks + * @return void + */ + protected function fireCallbackArray($object, array $callbacks) + { + foreach ($callbacks as $callback) { + $callback($object, $this); + } + } + + /** + * Get the container's bindings. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Get the alias for an abstract if available. + * + * @param string $abstract + * @return string + * + * @throws \LogicException+ + +
UpdateKaryawafKaryawan {#5207 + #container: Application {#3040} + #redirector: Redirector {#5205} + #redirect: null + #redirectRoute: null + #redirectAction: null + #errorBag: "default" + #json: ParameterBag {#5214} + #convertedFiles: [] + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5209} + +request: ParameterBag {#5206} + +query: ParameterBag {#5208} + +server: ServerBag {#5212} + +files: FileBag {#5211} + +cookies: ParameterBag {#5210} + +headers: HeaderBag {#5213} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: null + #pathInfo: null + #requestUri: null + #baseUrl: null + #basePath: null + #method: null + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "/api/karyawaf/karyawans/1" + : "/api/karyawaf/karyawans/1" + : "" + : "" + : "PUT" + : "html" +} ++
Application {#3040} ++
$this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) + ); + + $this->fireAfterResolvingCallbacks($abstract, $object); + } + + /** + * Fire all of the after resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireAfterResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) + ); + } + + /** + * Get all callbacks for a given type. + * + * @param string $abstract + * @param object $object + * @param array $callbacksPerType + * + * @return array + */ + protected function getCallbacksForType($abstract, $object, array $callbacksPerType) + { + $results = []; + + foreach ($callbacksPerType as $type => $callbacks) { + if ($type === $abstract || $object instanceof $type) { + $results = array_merge($results, $callbacks); + }+ + +
UpdateKaryawafKaryawan {#5207 + #container: Application {#3040} + #redirector: Redirector {#5205} + #redirect: null + #redirectRoute: null + #redirectAction: null + #errorBag: "default" + #json: ParameterBag {#5214} + #convertedFiles: [] + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5209} + +request: ParameterBag {#5206} + +query: ParameterBag {#5208} + +server: ServerBag {#5212} + +files: FileBag {#5211} + +cookies: ParameterBag {#5210} + +headers: HeaderBag {#5213} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: null + #pathInfo: null + #requestUri: null + #baseUrl: null + #basePath: null + #method: null + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "/api/karyawaf/karyawans/1" + : "/api/karyawaf/karyawans/1" + : "" + : "" + : "PUT" + : "html" +} ++
array:1 [ + 0 => Closure {#4118 + : "Illuminate\Foundation\Providers\FormRequestServiceProvider" + : FormRequestServiceProvider {#4150 …} + : { + : {} + } + } +] ++
$this->afterResolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Fire all of the resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) + ); + + $this->fireAfterResolvingCallbacks($abstract, $object); + } + + /** + * Fire all of the after resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireAfterResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) + ); + } + + /** + * Get all callbacks for a given type.+ + +
"Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan"
+
+UpdateKaryawafKaryawan {#5207 + #container: Application {#3040} + #redirector: Redirector {#5205} + #redirect: null + #redirectRoute: null + #redirectAction: null + #errorBag: "default" + #json: ParameterBag {#5214} + #convertedFiles: [] + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5209} + +request: ParameterBag {#5206} + +query: ParameterBag {#5208} + +server: ServerBag {#5212} + +files: FileBag {#5211} + +cookies: ParameterBag {#5210} + +headers: HeaderBag {#5213} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: null + #pathInfo: null + #requestUri: null + #baseUrl: null + #basePath: null + #method: null + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "/api/karyawaf/karyawans/1" + : "/api/karyawaf/karyawans/1" + : "" + : "" + : "PUT" + : "html" +} ++
$object = $this->build($concrete); + } else { + $object = $this->make($concrete); + } + + // If we defined any extenders for this type, we'll need to spin through them + // and apply them to the object being built. This allows for the extension + // of services, such as changing configuration or decorating the object. + foreach ($this->getExtenders($abstract) as $extender) { + $object = $extender($object, $this); + } + + // If the requested type is registered as a singleton we'll want to cache off + // the instances in "memory" so we can return it later without creating an + // entirely new instance of an object on each subsequent request for it. + if ($this->isShared($abstract) && ! $needsContextualBuild) { + $this->instances[$abstract] = $object; + } + + $this->fireResolvingCallbacks($abstract, $object); + + // Before returning, we will also set the resolved flag to "true" and pop off + // the parameter overrides for this build. After those two things are done + // we will be ready to return back the fully constructed class instance. + $this->resolved[$abstract] = true; + + array_pop($this->with); + + return $object; + } + + /** + * Get the concrete type for a given abstract. + * + * @param string $abstract + * @return mixed $concrete + */ + protected function getConcrete($abstract) + { + if (! is_null($concrete = $this->getContextualConcrete($abstract))) {+ + +
"Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan"
+
+UpdateKaryawafKaryawan {#5207 + #container: Application {#3040} + #redirector: Redirector {#5205} + #redirect: null + #redirectRoute: null + #redirectAction: null + #errorBag: "default" + #json: ParameterBag {#5214} + #convertedFiles: [] + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5209} + +request: ParameterBag {#5206} + +query: ParameterBag {#5208} + +server: ServerBag {#5212} + +files: FileBag {#5211} + +cookies: ParameterBag {#5210} + +headers: HeaderBag {#5213} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: null + #pathInfo: null + #requestUri: null + #baseUrl: null + #basePath: null + #method: null + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "/api/karyawaf/karyawans/1" + : "/api/karyawaf/karyawans/1" + : "" + : "" + : "PUT" + : "html" +} ++
* + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function makeWith($abstract, array $parameters = []) + { + return $this->make($abstract, $parameters); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + return $this->resolve($abstract, $parameters); + } + + /** + * {@inheritdoc} + */ + public function get($id) + { + if ($this->has($id)) { + return $this->resolve($id); + } + + throw new EntryNotFoundException; + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed+ + +
"Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan"
+
+[] ++
} + + /** + * Resolve the given type from the container. + * + * (Overriding Container::make) + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->deferredServices[$abstract]) && ! isset($this->instances[$abstract])) { + $this->loadDeferredProvider($abstract); + } + + return parent::make($abstract, $parameters); + } + + /** + * Determine if the given abstract type has been bound. + * + * (Overriding Container::bound) + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->deferredServices[$abstract]) || parent::bound($abstract); + } + + /** + * Determine if the application has booted. + * + * @return bool + */+ + +
"Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan"
+
+[] ++
} + + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @return mixed + */ + protected function transformDependency(ReflectionParameter $parameter, $parameters) + { + $class = $parameter->getClass(); + + // If the parameter has a type-hinted class, we will check to see if it is already in + // the list of parameters. If it is we will just skip it as it is probably a model + // binding and we do not want to mess with those; otherwise, we resolve it here. + if ($class && ! $this->alreadyInParameters($class->name, $parameters)) { + return $parameter->isDefaultValueAvailable() + ? $parameter->getDefaultValue() + : $this->container->make($class->name); + } + } + + /** + * Determine if an object of the given class is in a list of parameters. + * + * @param string $class + * @param array $parameters + * @return bool + */ + protected function alreadyInParameters($class, array $parameters) + { + return ! is_null(Arr::first($parameters, function ($value) use ($class) { + return $value instanceof $class; + })); + } + + /** + * Splice the given value into the parameter list. + *+ + +
"Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan"
+
+$parameters, new ReflectionMethod($instance, $method) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + * @return array + */ + public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) + { + $instanceCount = 0; + + $values = array_values($parameters); + + foreach ($reflector->getParameters() as $key => $parameter) { + $instance = $this->transformDependency( + $parameter, $parameters + ); + + if (! is_null($instance)) { + $instanceCount++; + + $this->spliceIntoParameters($parameters, $key, $instance); + } elseif (! isset($values[$key - $instanceCount]) && + $parameter->isDefaultValueAvailable()) { + $this->spliceIntoParameters($parameters, $key, $parameter->getDefaultValue()); + } + } + + return $parameters; + } + + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters+ + +
ReflectionParameter {#5194 + +name: "request" + : 0 + : "Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan" +} ++
array:1 [ + "karyawan" => "1" +] ++
use ReflectionFunctionAbstract; + +trait RouteDependencyResolverTrait +{ + /** + * Resolve the object method's type-hinted dependencies. + * + * @param array $parameters + * @param object $instance + * @param string $method + * @return array + */ + protected function resolveClassMethodDependencies(array $parameters, $instance, $method) + { + if (! method_exists($instance, $method)) { + return $parameters; + } + + return $this->resolveMethodDependencies( + $parameters, new ReflectionMethod($instance, $method) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + * @return array + */ + public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) + { + $instanceCount = 0; + + $values = array_values($parameters); + + foreach ($reflector->getParameters() as $key => $parameter) { + $instance = $this->transformDependency( + $parameter, $parameters + );+ + +
array:1 [ + "karyawan" => "1" +] ++
ReflectionMethod {#5186 + +name: "update" + +class: "Modules\Karyawaf\Http\Controllers\KaryawanController" + : { + : ReflectionParameter {#5264 + +name: "request" + : 0 + : "Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan" + } + : ReflectionParameter {#5272 + +name: "id" + : 1 + } + } + : "public" +} ++
* @param \Illuminate\Container\Container $container + * @return void + */ + public function __construct(Container $container) + { + $this->container = $container; + } + + /** + * Dispatch a request to a given controller and method. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $controller + * @param string $method + * @return mixed + */ + public function dispatch(Route $route, $controller, $method) + { + $parameters = $this->resolveClassMethodDependencies( + $route->parametersWithoutNulls(), $controller, $method + ); + + if (method_exists($controller, 'callAction')) { + return $controller->callAction($method, $parameters); + } + + return $controller->{$method}(...array_values($parameters)); + } + + /** + * Get the middleware for the controller instance. + * + * @param \Illuminate\Routing\Controller $controller + * @param string $method + * @return array + */ + public function getMiddleware($controller, $method) + { + if (! method_exists($controller, 'getMiddleware')) { + return [];+ + +
array:1 [ + "karyawan" => "1" +] ++
KaryawanController {#5157} ++
"update"
+
+protected function runCallable() + { + $callable = $this->action['uses']; + + return $callable(...array_values($this->resolveMethodDependencies( + $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) + ))); + } + + /** + * Run the route action and return the response. + * + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + protected function runController() + { + return $this->controllerDispatcher()->dispatch( + $this, $this->getController(), $this->getControllerMethod() + ); + } + + /** + * Get the controller instance for the route. + * + * @return mixed + */ + public function getController() + { + if (! $this->controller) { + $class = $this->parseControllerCallback()[0]; + + $this->controller = $this->container->make(ltrim($class, '\\')); + } + + return $this->controller; + } + + /**+ + +
* + * @throws \UnexpectedValueException + */ + protected function parseAction($action) + { + return RouteAction::parse($this->uri, $action); + } + + /** + * Run the route action and return the response. + * + * @return mixed + */ + public function run() + { + $this->container = $this->container ?: new Container; + + try { + if ($this->isControllerAction()) { + return $this->runController(); + } + + return $this->runCallable(); + } catch (HttpResponseException $e) { + return $e->getResponse(); + } + } + + /** + * Checks whether the route's action is a controller. + * + * @return bool + */ + protected function isControllerAction() + { + return is_string($this->action['uses']); + } + + /** + * Run the route action and return the response.+ + + +
/** + * Run the given route within a Stack "onion" instance. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($route) { + return $this->prepareResponse( + $request, $route->run() + ); + }); + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + public function gatherRouteMiddleware(Route $route) + { + $middleware = collect($route->gatherMiddleware())->map(function ($name) { + return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); + })->flatten(); + + return $this->sortMiddleware($middleware); + } + + /**+ + + +
use Symfony\Component\Debug\Exception\FatalThrowableError; + +/** + * This extended pipeline catches any exceptions that occur during each slice. + * + * The exceptions are converted to HTTP responses for proper middleware handling. + */ +class Pipeline extends BasePipeline +{ + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + try { + return $destination($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
*/ + public function __construct(Registrar $router) + { + $this->router = $router; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->router->substituteBindings($route = $request->route()); + + $this->router->substituteImplicitBindings($route); + + return $next($request); + } +} ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#5179 + : "Illuminate\Routing\Pipeline" + : Pipeline {#5178 …} + : { + : {} + } + : { + : Closure {#5174 …} + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
public function __construct(Auth $auth) + { + $this->auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string[] ...$guards + * @return mixed + * + * @throws \Illuminate\Auth\AuthenticationException + */ + public function handle($request, Closure $next, ...$guards) + { + $this->authenticate($guards); + + return $next($request); + } + + /** + * Determine if the user is logged in to any of the given guards. + * + * @param array $guards + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function authenticate(array $guards) + { + if (empty($guards)) { + return $this->auth->authenticate(); + } + + foreach ($guards as $guard) { + if ($this->auth->guard($guard)->check()) { + return $this->auth->shouldUse($guard); + }+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#5182 + : "Illuminate\Routing\Pipeline" + : Pipeline {#5178 …} + : { + : {} + } + : { + : Closure {#5179 …} + : "Illuminate\Routing\Middleware\SubstituteBindings" + } +} ++
"api"
+
+return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param int|string $maxAttempts + * @param float|int $decayMinutes + * @return mixed + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1) + { + $key = $this->resolveRequestSignature($request); + + $maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts); + + if ($this->limiter->tooManyAttempts($key, $maxAttempts, $decayMinutes)) { + throw $this->buildException($key, $maxAttempts); + } + + $this->limiter->hit($key, $decayMinutes); + + $response = $next($request); + + return $this->addHeaders( + $response, $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts) + ); + } + + /** + * Resolve the number of attempts if the user is authenticated or not. + * + * @param \Illuminate\Http\Request $request + * @param int|string $maxAttempts + * @return int + */ + protected function resolveMaxAttempts($request, $maxAttempts) + { + if (Str::contains($maxAttempts, '|')) { + $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0]; + } ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#5183 + : "Illuminate\Routing\Pipeline" + : Pipeline {#5178 …} + : { + : {} + } + : { + : Closure {#5182 …} + : "Illuminate\Auth\Middleware\Authenticate:api" + } +} ++
60
+
+"1"
+
+return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
public function via($method) + { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then(Closure $destination) + { + $pipeline = array_reduce( + array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination) + ); + + return $pipeline($this->passable); + } + + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + return $destination($passable); + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($route) { + return $this->prepareResponse( + $request, $route->run() + ); + }); + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + public function gatherRouteMiddleware(Route $route) + { + $middleware = collect($route->gatherMiddleware())->map(function ($name) { + return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); + })->flatten(); + + return $this->sortMiddleware($middleware); + } + + /** + * Sort the given middleware by priority. + *+ + +
return $route; + } + + /** + * Return the response for the given route. + * + * @param Route $route + * @param Request $request + * @return mixed + */ + protected function runRoute(Request $request, Route $route) + { + $request->setRouteResolver(function () use ($route) { + return $route; + }); + + $this->events->dispatch(new Events\RouteMatched($route, $request)); + + return $this->prepareResponse($request, + $this->runRouteWithinStack($route, $request) + ); + } + + /** + * Run the given route within a Stack "onion" instance. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware)+ + +
Route {#4248} ++
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + */ + public function dispatch(Request $request) + { + $this->currentRequest = $request; + + return $this->dispatchToRoute($request); + } + + /** + * Dispatch the request to a route and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function dispatchToRoute(Request $request) + { + return $this->runRoute($request, $this->findRoute($request)); + } + + /** + * Find the route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + */ + protected function findRoute($request) + { + $this->current = $route = $this->routes->match($request); + + $this->container->instance(Route::class, $route); + + return $route; + } + + /** + * Return the response for the given route. + *+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Route {#4248} ++
* @return mixed + */ + public function respondWithRoute($name) + { + $route = tap($this->routes->getByName($name))->bind($this->currentRequest); + + return $this->runRoute($this->currentRequest, $route); + } + + /** + * Dispatch the request to the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + */ + public function dispatch(Request $request) + { + $this->currentRequest = $request; + + return $this->dispatchToRoute($request); + } + + /** + * Dispatch the request to a route and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function dispatchToRoute(Request $request) + { + return $this->runRoute($request, $this->findRoute($request)); + } + + /** + * Find the route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + */ + protected function findRoute($request)+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + } + + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter() + { + return function ($request) { + $this->app->instance('request', $request); + + return $this->router->dispatch($request); + }; + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + public function terminate($request, $response) + { + $this->terminateMiddleware($request, $response); + + $this->app->terminate(); + } + + /** + * Call the terminate method on any terminable middleware. + *+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
use Symfony\Component\Debug\Exception\FatalThrowableError; + +/** + * This extended pipeline catches any exceptions that occur during each slice. + * + * The exceptions are converted to HTTP responses for proper middleware handling. + */ +class Pipeline extends BasePipeline +{ + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + try { + return $destination($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
{ + $this->config = $config; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->setTrustedProxyHeaderNames($request); + $this->setTrustedProxyIpAddresses($request); + + return $next($request); + } + + /** + * Sets the trusted proxies on the request to the value of trustedproxy.proxies + * + * @param \Illuminate\Http\Request $request + */ + protected function setTrustedProxyIpAddresses($request) + { + $trustedIps = $this->proxies ?: $this->config->get('trustedproxy.proxies'); + + // We only trust specific IP addresses + if (is_array($trustedIps)) { + return $this->setTrustedProxyIpAddressesToSpecificIps($request, $trustedIps); + } + + // We trust any IP address that calls us, but not proxies further + // up the forwarding chain. + // TODO: Determine if this should only trust the first IP address + // Currently it trusts the entire chain (array of IPs),+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#4106 + : "Illuminate\Routing\Pipeline" + : Pipeline {#4119 …} + : { + : {} + } + : { + : Closure {#4125 …} + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* The additional attributes passed to the middleware. + * + * @var array + */ + protected $attributes = []; + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next, ...$attributes) + { + $this->attributes = $attributes; + + $this->clean($request); + + return $next($request); + } + + /** + * Clean the request's data. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clean($request) + { + $this->cleanParameterBag($request->query); + + if ($request->isJson()) { + $this->cleanParameterBag($request->json()); + } else { + $this->cleanParameterBag($request->request); + } + } + + /**+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#4117 + : "Illuminate\Routing\Pipeline" + : Pipeline {#4119 …} + : { + : {} + } + : { + : Closure {#4106 …} + : "App\Http\Middleware\TrustProxies" + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
* The additional attributes passed to the middleware. + * + * @var array + */ + protected $attributes = []; + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next, ...$attributes) + { + $this->attributes = $attributes; + + $this->clean($request); + + return $next($request); + } + + /** + * Clean the request's data. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clean($request) + { + $this->cleanParameterBag($request->query); + + if ($request->isJson()) { + $this->cleanParameterBag($request->json()); + } else { + $this->cleanParameterBag($request->request); + } + } + + /**+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#4123 + : "Illuminate\Routing\Pipeline" + : Pipeline {#4119 …} + : { + : {} + } + : { + : Closure {#4117 …} + : "Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull" + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
class ValidatePostSize +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Illuminate\Http\Exceptions\PostTooLargeException + */ + public function handle($request, Closure $next) + { + $max = $this->getPostMaxSize(); + + if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { + throw new PostTooLargeException; + } + + return $next($request); + } + + /** + * Determine the server 'post_max_size' as bytes. + * + * @return int + */ + protected function getPostMaxSize() + { + if (is_numeric($postMaxSize = ini_get('post_max_size'))) { + return (int) $postMaxSize; + } + + $metric = strtoupper(substr($postMaxSize, -1)); + $postMaxSize = (int) $postMaxSize; + + switch ($metric) { + case 'K': + return $postMaxSize * 1024; + case 'M':+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#4116 + : "Illuminate\Routing\Pipeline" + : Pipeline {#4119 …} + : { + : {} + } + : { + : Closure {#4123 …} + : "App\Http\Middleware\TrimStrings" + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
} + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next) + { + if ($this->app->isDownForMaintenance()) { + $data = json_decode(file_get_contents($this->app->storagePath().'/framework/down'), true); + + throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']); + } + + return $next($request); + } +} ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
// the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + list($name, $parameters) = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + return method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters];+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
Closure {#5153 + : "Illuminate\Routing\Pipeline" + : Pipeline {#4119 …} + : { + : {} + } + : { + : Closure {#4116 …} + : "Illuminate\Foundation\Http\Middleware\ValidatePostSize" + } +} ++
return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
public function via($method) + { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then(Closure $destination) + { + $pipeline = array_reduce( + array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination) + ); + + return $pipeline($this->passable); + } + + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + return $destination($passable); + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
} + + /** + * Send the given request through the middleware / router. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendRequestThroughRouter($request) + { + $this->app->instance('request', $request); + + Facade::clearResolvedInstance('request'); + + $this->bootstrap(); + + return (new Pipeline($this->app)) + ->send($request) + ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) + ->then($this->dispatchToRouter()); + } + + /** + * Bootstrap the application for HTTP requests. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + } + + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter()+ + +
$router->middlewareGroup($key, $middleware); + } + + foreach ($this->routeMiddleware as $key => $middleware) { + $router->aliasMiddleware($key, $middleware); + } + } + + /** + * Handle an incoming HTTP request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function handle($request) + { + try { + $request->enableHttpMethodParameterOverride(); + + $response = $this->sendRequestThroughRouter($request); + } catch (Exception $e) { + $this->reportException($e); + + $response = $this->renderException($request, $e); + } catch (Throwable $e) { + $this->reportException($e = new FatalThrowableError($e)); + + $response = $this->renderException($request, $e); + } + + $this->app['events']->dispatch( + new Events\RequestHandled($request, $response) + ); + + return $response; + } + + /** + * Send the given request through the middleware / router. + *+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
+ /** + * Call the booting callbacks for the application. + * + * @param array $callbacks + * @return void + */ + protected function fireAppCallbacks(array $callbacks) + { + foreach ($callbacks as $callback) { + call_user_func($callback, $this); + } + } + + /** + * {@inheritdoc} + */ + public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) + { + return $this[HttpKernelContract::class]->handle(Request::createFromBase($request)); + } + + /** + * Determine if middleware has been disabled for the application. + * + * @return bool + */ + public function shouldSkipMiddleware() + { + return $this->bound('middleware.disable') && + $this->make('middleware.disable') === true; + } + + /** + * Get the path to the cached services.php file. + * + * @return string + */ + public function getCachedServicesPath() + {+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
/** + * Execute a request. + * + * @param SymfonyRequest $request + * @return Response + */ + protected function doRequest($request) + { + if (!$this->firstRequest) { + $this->initialize($request); + } + $this->firstRequest = false; + + $this->applyBindings(); + $this->applyContextualBindings(); + $this->applyInstances(); + $this->applyApplicationHandlers(); + + $request = Request::createFromBase($request); + $response = $this->kernel->handle($request); + $this->app->make('Illuminate\Contracts\Http\Kernel')->terminate($request, $response); + + return $response; + } + + /** + * Make sure files are \Illuminate\Http\UploadedFile instances with the private $test property set to true. + * Fixes issue https://github.com/Codeception/Codeception/pull/3417. + * + * @param array $files + * @return array + */ + protected function filterFiles(array $files) + { + $files = parent::filterFiles($files); + + if (! class_exists('Illuminate\Http\UploadedFile')) { + // The \Illuminate\Http\UploadedFile class was introduced in Laravel 5.2.15, + // so don't change the $files array if it does not exist. + return $files;+ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
} + + if (empty($server['HTTP_HOST'])) { + $server['HTTP_HOST'] = $this->extractHost($uri); + } + + $server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME); + + $this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content); + + $this->request = $this->filterRequest($this->internalRequest); + + if (true === $changeHistory) { + $this->history->add($this->internalRequest); + } + + if ($this->insulated) { + $this->response = $this->doRequestInProcess($this->request); + } else { + $this->response = $this->doRequest($this->request); + } + + $this->internalResponse = $this->filterResponse($this->response); + + $this->cookieJar->updateFromResponse($this->internalResponse, $uri); + + $status = $this->internalResponse->getStatus(); + + if ($status >= 300 && $status < 400) { + $this->redirect = $this->internalResponse->getHeader('Location'); + } else { + $this->redirect = null; + } + + if ($this->followRedirects && $this->redirect) { + $this->redirects[serialize($this->history->current())] = true; + + return $this->crawler = $this->followRedirect(); + } ++ + +
Request {#5141 + #json: ParameterBag {#5214} + #convertedFiles: null + #userResolver: Closure {#5175 + : "Illuminate\Auth\AuthServiceProvider" + : AuthServiceProvider {#4105 …} + : { + : { + : null + } + } + : { + : Application {#3040 …} + } + } + #routeResolver: Closure {#5165 + : "Illuminate\Routing\Router" + : Router {#4093 …} + : { + : Route {#4248 …} + } + } + +attributes: ParameterBag {#5149} + +request: ParameterBag {#5150} + +query: ParameterBag {#5170} + +server: ServerBag {#5147} + +files: FileBag {#5145} + +cookies: ParameterBag {#5130} + +headers: HeaderBag {#5164} + #content: "nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1" + #languages: null + #charsets: null + #encodings: null + #acceptableContentTypes: array:4 [ + 0 => "text/html" + 1 => "application/xhtml+xml" + 2 => "application/xml" + 3 => "*/*" + ] + #pathInfo: "/api/karyawaf/karyawans/1" + #requestUri: "/api/karyawaf/karyawans/1" + #baseUrl: "" + #basePath: null + #method: "PUT" + #format: null + #session: null + #locale: null + #defaultLocale: "en" + -isHostValid: true + -isForwardedValid: true + : "" + : "html" +} ++
$hostname = parse_url($uri, PHP_URL_HOST); + if (!$this->isInternalDomain($hostname)) { + throw new ExternalUrlException(get_class($this) . " can't open external URL: " . $uri); + } + } + + if ($method !== 'GET' && $content === null && !empty($parameters)) { + $content = http_build_query($parameters); + } + } + + if (!ReflectionHelper::readPrivateProperty($this->client, 'followRedirects')) { + $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); + $this->debugResponse($uri); + return $result; + } + + $maxRedirects = ReflectionHelper::readPrivateProperty($this->client, 'maxRedirects', 'Symfony\Component\BrowserKit\Client'); + $this->client->followRedirects(false); + $result = $this->client->request($method, $uri, $parameters, $files, $server, $content, $changeHistory); + $this->debugResponse($uri); + return $this->redirectIfNecessary($result, $maxRedirects, 0); + } + + protected function isInternalDomain($domain) + { + if ($this->internalDomains === null) { + $this->internalDomains = $this->getInternalDomains(); + } + + foreach ($this->internalDomains as $pattern) { + if (preg_match($pattern, $domain)) { + return true; + } + } + return false; + } + + /** + * Opens a page with arbitrary request parameters.+ + +
"PUT"
+
+"http://laraland.test/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
[] ++
array:5 [ + "HTTP_USER_AGENT" => "Symfony BrowserKit" + "HTTP_HOST" => "laraland.test" + "REQUEST_TIME" => 1532744935 + "REQUEST_TIME_FLOAT" => 1532744935.4527 + "HTTPS" => false +] ++
"nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1"
+
+true
+
+* @api + * @param $method + * @param $uri + * @param array $parameters + * @param array $files + * @param array $server + * @param null $content + * @return mixed|Crawler + * @throws ExternalUrlException + * @see `_loadPage` + */ + public function _request( + $method, + $uri, + array $parameters = [], + array $files = [], + array $server = [], + $content = null + ) { + $this->clientRequest($method, $uri, $parameters, $files, $server, $content, true); + return $this->_getResponseContent(); + } + + /** + * Returns content of the last response + * Use it in Helpers when you want to retrieve response of request performed by another module. + * + * ```php + * <?php + * // in Helper class + * public function seeResponseContains($text) + * { + * $this->assertContains($text, $this->getModule('{{MODULE_NAME}}')->_getResponseContent(), "response contains"); + * } + * ?> + * ``` + * + * @api + * @return string + * @throws ModuleException+ + +
"PUT"
+
+"/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
[] ++
array:2 [ + "REQUEST_TIME" => 1532744935 + "REQUEST_TIME_FLOAT" => 1532744935.4527 +] ++
"nama=Gregorio&posisi=Gaming+Dealer&tempat_lahir=Hazelville&tanggal_lahir%5Bdate%5D=1983-03-23+18%3A20%3A56.000000&tanggal_lahir%5Btimezone_type%5D=3&tanggal_lahir%5Btimezone%5D=UTC&rekrut=2013-11-05+02%3A11%3A05&status=1"
+
+true
+
++ $parameters = $this->encodeApplicationJson($method, $parameters); + + if (is_array($parameters) || $method === 'GET') { + if (!empty($parameters) && $method === 'GET') { + if (strpos($url, '?') !== false) { + $url .= '&'; + } else { + $url .= '?'; + } + $url .= http_build_query($parameters); + } + if ($method == 'GET') { + $this->debugSection("Request", "$method $url"); + $files = []; + } else { + $this->debugSection("Request", "$method $url " . json_encode($parameters)); + $files = $this->formatFilesArray($files); + } + $this->response = (string)$this->connectionModule->_request($method, $url, $parameters, $files); + } else { + $requestData = $parameters; + if ($this->isBinaryData($requestData)) { + $requestData = $this->binaryToDebugString($requestData); + } + $this->debugSection("Request", "$method $url " . $requestData); + $this->response = (string)$this->connectionModule->_request($method, $url, [], $files, [], $parameters); + } + $printedResponse = $this->response; + if ($this->isBinaryData($printedResponse)) { + $printedResponse = $this->binaryToDebugString($printedResponse); + } + $this->debugSection("Response", $printedResponse); + } + + /** + * Check if data has non-printable bytes and it is not a valid unicode string + * + * @param string $data the text or binary data string + * @return boolean+ + +
"PUT"
+
+"/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
[] ++
* @part json + * @part xml + */ + public function sendGET($url, $params = []) + { + $this->execute('GET', $url, $params); + } + + /** + * Sends PUT request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + */ + public function sendPUT($url, $params = [], $files = []) + { + $this->execute('PUT', $url, $params, $files); + } + + /** + * Sends PATCH request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + */ + public function sendPATCH($url, $params = [], $files = []) + { + $this->execute('PATCH', $url, $params, $files); + } + + /** + * Sends DELETE request to given uri. + * + * @param $url+ + +
"PUT"
+
+"/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
[] ++
$text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $text); + $text = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $text); + $text = preg_replace('~\bdont\b~', 'don\'t', $text); + return mb_strtolower($text, 'UTF-8'); + } + + public function run(ModuleContainer $container = null) + { + $this->executed = true; + if (!$container) { + return null; + } + $activeModule = $container->moduleForAction($this->action); + + if (!is_callable([$activeModule, $this->action])) { + throw new \RuntimeException("Action '{$this->action}' can't be called"); + } + + try { + $res = call_user_func_array([$activeModule, $this->action], $this->arguments); + } catch (\Exception $e) { + $this->failed = true; + if ($this->getMetaStep()) { + $this->getMetaStep()->setFailed(true); + } + throw $e; + } + return $res; + } + + /** + * If steps are combined into one method they can be reproduced as meta-step. + * We are using stack trace to analyze if steps were called from test, if not - they were called from meta-step. + * + * @param $step + * @param $stack + */ + protected function addMetaStep($step, $stack) + { + if (($this->isTestFile($this->file)) || ($step['class'] == 'Codeception\Scenario')) {+ + +
"/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
$text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $text); + $text = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $text); + $text = preg_replace('~\bdont\b~', 'don\'t', $text); + return mb_strtolower($text, 'UTF-8'); + } + + public function run(ModuleContainer $container = null) + { + $this->executed = true; + if (!$container) { + return null; + } + $activeModule = $container->moduleForAction($this->action); + + if (!is_callable([$activeModule, $this->action])) { + throw new \RuntimeException("Action '{$this->action}' can't be called"); + } + + try { + $res = call_user_func_array([$activeModule, $this->action], $this->arguments); + } catch (\Exception $e) { + $this->failed = true; + if ($this->getMetaStep()) { + $this->getMetaStep()->setFailed(true); + } + throw $e; + } + return $res; + } + + /** + * If steps are combined into one method they can be reproduced as meta-step. + * We are using stack trace to analyze if steps were called from test, if not - they were called from meta-step. + * + * @param $step + * @param $stack + */ + protected function addMetaStep($step, $stack) + { + if (($this->isTestFile($this->file)) || ($step['class'] == 'Codeception\Scenario')) {+ + +
array:2 [ + 0 => REST {#351} + 1 => "sendPUT" +] ++
array:2 [ + 0 => "/api/karyawaf/karyawans/1" + 1 => array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" + ] +] ++
{ + return $this->metadata->getGroups(); + } + + public function current($key) + { + return $this->metadata->getCurrent($key); + } + + public function runStep(Step $step) + { + $step->saveTrace(); + if ($this->metaStep instanceof Step\Meta) { + $step->setMetaStep($this->metaStep); + } + $this->steps[] = $step; + $result = null; + $this->metadata->getService('dispatcher')->dispatch(Events::STEP_BEFORE, new StepEvent($this->test, $step)); + try { + $result = $step->run($this->metadata->getService('modules')); + } catch (ConditionalAssertionFailed $f) { + $result = $this->test->getTestResultObject(); + if (is_null($result)) { + $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step)); + throw $f; + } else { + $result->addFailure(clone($this->test), $f, $result->time()); + } + } catch (\Exception $e) { + $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step)); + throw $e; + } + $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step)); + $step->executed = true; + return $result; + } + + public function addStep(Step $step) + { + $this->steps[] = $step;+ + +
ModuleContainer {#228} ++
*/ + public function sendGET($url, $params = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendGET', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends PUT request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendPUT() + */ + public function sendPUT($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPUT', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Sends PATCH request to given uri. + * + * @param $url + * @param array $params + * @param array $files + * @part json + * @part xml + * @see \Codeception\Module\REST::sendPATCH() + */ + public function sendPATCH($url, $params = null, $files = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('sendPATCH', func_get_args())); + } + ++ + +
Action {#5075} ++
$I->seeResponseContainsJson([ + 'data' => [ + 'nama' => $karyawan['nama'] + ] + ]); + } + + public function updateData(FunctionalTester $I) + { + Auth::user()->can('update-karyawan'); + + $karyawan = Karyawan::find(1); + + $I->sendPUT($this->endpoint . '/' . $karyawan->id, [ + 'nama' => 'Gregorio', + 'posisi' => $karyawan->posisi, + 'tempat_lahir' => $karyawan->tempat_lahir, + 'tanggal_lahir' => $karyawan->tanggal_lahir, + 'rekrut' => $karyawan->rekrut, + 'status' => $karyawan->status + ]); + + $I->seeResponseContainsJson([ + 'data' => [ + 'nama' => 'Gregorio' + ] + ]); + } + + public function deleteData(FunctionalTester $I) + { + $karyawan = Karyawan::find(1); + + $I->sendDELETE($this->endpoint . '/' . $karyawan->id); + + $I->seeResponseCodeIsSuccessful(); + $I->seeResponseContains('deleted'); + } +} ++ + +
"/api/karyawaf/karyawans/1"
+
+array:6 [ + "nama" => "Gregorio" + "posisi" => "Gaming Dealer" + "tempat_lahir" => "Hazelville" + "tanggal_lahir" => Carbon @417291656 {#4993 + : 1983-03-23 18:20:56.0 UTC (+00:00) + } + "rekrut" => "2013-11-05 02:11:05" + "status" => "1" +] ++
return; + } + + $reflectedMethod = $reflectedObject->getMethod($injectMethodName); + try { + $args = $this->prepareArgs($reflectedMethod, $defaults); + } catch (\Exception $e) { + $msg = $e->getMessage(); + if ($e->getPrevious()) { // injection failed because PHP code is invalid. See #3869 + $msg .= '; '. $e->getPrevious(); + } + throw new InjectionException( + "Failed to inject dependencies in instance of '{$reflectedObject->name}'. $msg" + ); + } + + if (!$reflectedMethod->isPublic()) { + $reflectedMethod->setAccessible(true); + } + $reflectedMethod->invokeArgs($object, $args); + } + + /** + * @param \ReflectionMethod $method + * @param $defaults + * @throws InjectionException + * @return array + */ + protected function prepareArgs(\ReflectionMethod $method, $defaults = []) + { + $args = []; + $parameters = $method->getParameters(); + foreach ($parameters as $k => $parameter) { + $dependency = $parameter->getClass(); + if (is_null($dependency)) { + if (!$parameter->isOptional()) { + if (!isset($defaults[$k])) { + throw new InjectionException("Parameter '$parameter->name' must have default value."); + } + $args[] = $defaults[$k];+ + +
+ protected function executeContextMethod($context, $I) + { + if (method_exists($this->testClassInstance, $context)) { + $this->executeBeforeMethods($context, $I); + $this->invoke($context, [$I, $this->scenario]); + $this->executeAfterMethods($context, $I); + return; + } + throw new \LogicException( + "Method $context defined in annotation but does not exist in " . get_class($this->testClassInstance) + ); + } + + protected function invoke($methodName, array $context) + { + foreach ($context as $class) { + $this->getMetadata()->getService('di')->set($class); + } + $this->getMetadata()->getService('di')->injectDependencies($this->testClassInstance, $methodName, $context); + } + protected function executeTestMethod($I) + { + if (!method_exists($this->testClassInstance, $this->testMethod)) { + throw new \Exception("Method {$this->testMethod} can't be found in tested class"); + } + + if ($this->getMetadata()->getCurrent('example')) { + $this->invoke($this->testMethod, [$I, $this->scenario, new Example($this->getMetadata()->getCurrent('example'))]); + return; + } + $this->invoke($this->testMethod, [$I, $this->scenario]); + } + + public function toString() + { + return sprintf('%s: %s', ReflectionHelper::getClassShortName($this->getTestClass()), Message::ucfirst($this->getFeature())); + } + + public function getSignature()+ + +
} + + protected function invoke($methodName, array $context) + { + foreach ($context as $class) { + $this->getMetadata()->getService('di')->set($class); + } + $this->getMetadata()->getService('di')->injectDependencies($this->testClassInstance, $methodName, $context); + } + protected function executeTestMethod($I) + { + if (!method_exists($this->testClassInstance, $this->testMethod)) { + throw new \Exception("Method {$this->testMethod} can't be found in tested class"); + } + + if ($this->getMetadata()->getCurrent('example')) { + $this->invoke($this->testMethod, [$I, $this->scenario, new Example($this->getMetadata()->getCurrent('example'))]); + return; + } + $this->invoke($this->testMethod, [$I, $this->scenario]); + } + + public function toString() + { + return sprintf('%s: %s', ReflectionHelper::getClassShortName($this->getTestClass()), Message::ucfirst($this->getFeature())); + } + + public function getSignature() + { + return get_class($this->getTestClass()) . ":" . $this->getTestMethod(); + } + + public function getTestClass() + { + return $this->testClassInstance; + } + + public function getTestMethod() + { + return $this->testMethod;+ + +
return implode("", array_slice($source, $start_line, $end_line - $start_line)); + } + + public function getSpecFromMethod() + { + $text = $this->testMethod; + $text = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\\1 \\2', $text); + $text = preg_replace('/([a-z\d])([A-Z])/', '\\1 \\2', $text); + $text = strtolower($text); + return $text; + } + + public function test() + { + $actorClass = $this->getMetadata()->getCurrent('actor'); + $I = new $actorClass($this->getScenario()); + try { + $this->executeHook($I, 'before'); + $this->executeBeforeMethods($this->testMethod, $I); + $this->executeTestMethod($I); + $this->executeAfterMethods($this->testMethod, $I); + $this->executeHook($I, 'passed'); + } catch (\Exception $e) { + $this->executeHook($I, 'failed'); + // fails and errors are now handled by Codeception\PHPUnit\Listener + throw $e; + } finally { + $this->executeHook($I, 'after'); + } + } + + protected function executeHook($I, $hook) + { + if (is_callable([$this->testClassInstance, "_$hook"])) { + $this->invoke("_$hook", [$I, $this->scenario]); + } + } + + protected function executeBeforeMethods($testMethod, $I) + {+ + +
FunctionalTester {#2992} ++
+ $status = self::STATUS_PENDING; + $time = 0; + $e = null; + + $result->startTest($this); + + foreach ($this->hooks as $hook) { + if (method_exists($this, $hook.'Start')) { + $this->{$hook.'Start'}(); + } + } + + $failedToStart = ReflectionHelper::readPrivateProperty($result, 'lastTestFailed'); + + if (!$this->ignored && !$failedToStart) { + + Timer::start(); + try { + $this->test(); + $status = self::STATUS_OK; + } catch (\PHPUnit\Framework\AssertionFailedError $e) { + $status = self::STATUS_FAIL; + } catch (\PHPUnit\Framework\Exception $e) { + $status = self::STATUS_ERROR; + } catch (\Throwable $e) { + $e = new \PHPUnit\Framework\ExceptionWrapper($e); + $status = self::STATUS_ERROR; + } catch (\Exception $e) { + $e = new \PHPUnit\Framework\ExceptionWrapper($e); + $status = self::STATUS_ERROR; + } + $time = Timer::stop(); + } + + foreach (array_reverse($this->hooks) as $hook) { + if (method_exists($this, $hook.'End')) { + $this->{$hook.'End'}($status, $time, $e); + } + }+ + + +
+ $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } + + foreach ($this as $test) { + if ($result->shouldStop()) { + break; + } + + if ($test instanceof TestCase || $test instanceof self) { + $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); + $test->setBackupGlobals($this->backupGlobals); + $test->setBackupStaticAttributes($this->backupStaticAttributes); + $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); + } + + $test->run($result); + } + + foreach ($hookMethods['afterClass'] as $afterClassMethod) { + if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { + \call_user_func([$this->name, $afterClassMethod]); + } + } + + $this->tearDown(); + + $result->endTestSuite($this); + + return $result; + } + + /** + * @param bool $runTestInSeparateProcess + * + * @throws Exception + */+ + +
TestResult {#170} ++
$result->beStrictAboutOutputDuringTests((bool)$arguments['disallow_test_output']); + } + + if (empty(self::$persistentListeners)) { + $this->applyReporters($result, $arguments); + } + + if (class_exists('\Symfony\Bridge\PhpUnit\SymfonyTestsListener')) { + $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : []; + $arguments['listeners'][] = new \Symfony\Bridge\PhpUnit\SymfonyTestsListener(); + } + + $arguments['listeners'][] = $this->printer; + + // clean up listeners between suites + foreach ($arguments['listeners'] as $listener) { + $result->addListener($listener); + } + + $suite->run($result); + unset($suite); + + foreach ($arguments['listeners'] as $listener) { + $result->removeListener($listener); + } + + return $result; + } + + /** + * @param \PHPUnit\Framework\TestResult $result + * @param array $arguments + * + * @return array + */ + protected function applyReporters(\PHPUnit\Framework\TestResult $result, array $arguments) + { + foreach ($this->defaultListeners as $listener => $value) { + if (!isset($arguments[$listener])) { + $arguments[$listener] = $value;+ + +
TestResult {#170} ++
$name = $this->settings['namespace'] . ".$name"; + } + $suite->setName($name); + if (isset($this->settings['backup_globals'])) { + $suite->setBackupGlobals((bool) $this->settings['backup_globals']); + } + + if (isset($this->settings['be_strict_about_changes_to_global_state']) && method_exists($suite, 'setbeStrictAboutChangesToGlobalState')) { + $suite->setbeStrictAboutChangesToGlobalState((bool)$this->settings['be_strict_about_changes_to_global_state']); + } + $suite->setModules($this->moduleContainer->all()); + return $suite; + } + + + public function run(PHPUnit\Runner $runner, \PHPUnit\Framework\TestResult $result, $options) + { + $runner->prepareSuite($this->suite, $options); + $this->dispatcher->dispatch(Events::SUITE_BEFORE, new Event\SuiteEvent($this->suite, $result, $this->settings)); + $runner->doEnhancedRun($this->suite, $result, $options); + $this->dispatcher->dispatch(Events::SUITE_AFTER, new Event\SuiteEvent($this->suite, $result, $this->settings)); + } + + /** + * @return \Codeception\Suite + */ + public function getSuite() + { + return $this->suite; + } + + /** + * @return ModuleContainer + */ + public function getModuleContainer() + { + return $this->moduleContainer; + } + + protected function getActor()+ + +
Suite {#295} ++
TestResult {#170} ++
array:72 [ + "silent" => false + "debug" => false + "steps" => false + "html" => false + "xml" => false + "json" => false + "tap" => false + "report" => false + "colors" => true + "coverage" => false + "coverage-xml" => false + "coverage-html" => false + "coverage-text" => false + "coverage-crap4j" => false + "coverage-phpunit" => false + "groups" => [] + "excludeGroups" => [] + "filter" => false + "env" => null + "fail-fast" => false + "ansi" => true + "verbosity" => 32 + "interactive" => true + "no-rebuild" => false + "quiet" => false + "bootstrap" => false + "strict_xml" => false + "lint" => true + "backup_globals" => true + "log_incomplete_skipped" => false + "report_useless_tests" => false + "disallow_test_output" => false + "be_strict_about_changes_to_global_state" => false + "listeners" => array:1 [ + 0 => UI {#221} + ] + "addUncoveredFilesFromWhitelist" => true + "backupGlobals" => null + "backupStaticAttributes" => null + "beStrictAboutChangesToGlobalState" => null + "beStrictAboutResourceUsageDuringSmallTests" => false + "cacheTokens" => false + "columns" => 80 + "convertDeprecationsToExceptions" => true + "convertErrorsToExceptions" => true + "convertNoticesToExceptions" => true + "convertWarningsToExceptions" => true + "crap4jThreshold" => 30 + "disallowTestOutput" => false + "disallowTodoAnnotatedTests" => false + "enforceTimeLimit" => false + "failOnRisky" => false + "failOnWarning" => false + "processIsolation" => false + "processUncoveredFilesFromWhitelist" => false + "registerMockObjectsFromTestArgumentsRecursively" => false + "repeat" => false + "reportHighLowerBound" => 90 + "reportLowUpperBound" => 50 + "reportUselessTests" => true + "reverseList" => false + "stopOnError" => false + "stopOnFailure" => false + "stopOnIncomplete" => false + "stopOnRisky" => false + "stopOnSkipped" => false + "stopOnWarning" => false + "strictCoverage" => false + "testdoxExcludeGroups" => [] + "testdoxGroups" => [] + "timeoutForLargeTests" => 60 + "timeoutForMediumTests" => 10 + "timeoutForSmallTests" => 1 + "verbose" => false +] ++
$config['current_environment'] = implode(',', $currentEnvironment); + } + } + if (empty($config)) { + continue; + } + $suiteToRun = $suite; + if (!empty($envList)) { + $suiteToRun .= ' (' . implode(', ', $envArray) . ')'; + } + $this->runSuite($config, $suiteToRun, $test); + } + } + + public function runSuite($settings, $suite, $test = null) + { + $suiteManager = new SuiteManager($this->dispatcher, $suite, $settings); + $suiteManager->initialize(); + $suiteManager->loadTests($test); + $suiteManager->run($this->runner, $this->result, $this->options); + return $this->result; + } + + public static function versionString() + { + return 'Codeception PHP Testing Framework v' . self::VERSION; + } + + public function printResult() + { + $result = $this->getResult(); + $result->flushListeners(); + + $printer = $this->runner->getPrinter(); + $printer->printResult($result); + + $this->dispatcher->dispatch(Events::RESULT_PRINT_AFTER, new Event\PrintResultEvent($result, $printer)); + } + + /**+ + +
Runner {#222} ++
TestResult {#170} ++
array:72 [ + "silent" => false + "debug" => false + "steps" => false + "html" => false + "xml" => false + "json" => false + "tap" => false + "report" => false + "colors" => true + "coverage" => false + "coverage-xml" => false + "coverage-html" => false + "coverage-text" => false + "coverage-crap4j" => false + "coverage-phpunit" => false + "groups" => [] + "excludeGroups" => [] + "filter" => false + "env" => null + "fail-fast" => false + "ansi" => true + "verbosity" => 32 + "interactive" => true + "no-rebuild" => false + "quiet" => false + "bootstrap" => false + "strict_xml" => false + "lint" => true + "backup_globals" => true + "log_incomplete_skipped" => false + "report_useless_tests" => false + "disallow_test_output" => false + "be_strict_about_changes_to_global_state" => false + "listeners" => [] + "addUncoveredFilesFromWhitelist" => true + "backupGlobals" => null + "backupStaticAttributes" => null + "beStrictAboutChangesToGlobalState" => null + "beStrictAboutResourceUsageDuringSmallTests" => false + "cacheTokens" => false + "columns" => 80 + "convertDeprecationsToExceptions" => true + "convertErrorsToExceptions" => true + "convertNoticesToExceptions" => true + "convertWarningsToExceptions" => true + "crap4jThreshold" => 30 + "disallowTestOutput" => false + "disallowTodoAnnotatedTests" => false + "enforceTimeLimit" => false + "failOnRisky" => false + "failOnWarning" => false + "processIsolation" => false + "processUncoveredFilesFromWhitelist" => false + "registerMockObjectsFromTestArgumentsRecursively" => false + "repeat" => false + "reportHighLowerBound" => 90 + "reportLowUpperBound" => 50 + "reportUselessTests" => true + "reverseList" => false + "stopOnError" => false + "stopOnFailure" => false + "stopOnIncomplete" => false + "stopOnRisky" => false + "stopOnSkipped" => false + "stopOnWarning" => false + "strictCoverage" => false + "testdoxExcludeGroups" => [] + "testdoxGroups" => [] + "timeoutForLargeTests" => 60 + "timeoutForMediumTests" => 10 + "timeoutForSmallTests" => 1 + "verbose" => false +] ++
$this->dispatcher->addSubscriber($this->extensionLoader); + $this->extensionLoader->registerGlobalExtensions(); + } + + public function run($suite, $test = null, array $config = null) + { + ini_set( + 'memory_limit', + isset($this->config['settings']['memory_limit']) ? $this->config['settings']['memory_limit'] : '1024M' + ); + + $config = $config ?: Configuration::config(); + + $settings = Configuration::suiteSettings($suite, $config); + + $selectedEnvironments = $this->options['env']; + $environments = Configuration::suiteEnvironments($suite); + + if (!$selectedEnvironments or empty($environments)) { + $this->runSuite($settings, $suite, $test); + return; + } + + foreach (array_unique($selectedEnvironments) as $envList) { + $envArray = explode(',', $envList); + $config = []; + foreach ($envArray as $env) { + if (isset($environments[$env])) { + $currentEnvironment = isset($config['current_environment']) ? [$config['current_environment']] : []; + $config = Configuration::mergeConfigs($config, $environments[$env]); + $currentEnvironment[] = $config['current_environment']; + $config['current_environment'] = implode(',', $currentEnvironment); + } + } + if (empty($config)) { + continue; + } + $suiteToRun = $suite; + if (!empty($envList)) { + $suiteToRun .= ' (' . implode(', ', $envArray) . ')';+ + +
array:22 [ + "actor" => "FunctionalTester" + "modules" => array:3 [ + "enabled" => array:3 [ + 0 => array:1 [ + "Laravel5" => array:3 [ + "environment_file" => ".env.testing" + "packages" => "Modules/Karyawaf" + "cleanup" => true + ] + ] + 1 => array:1 [ + "REST" => array:1 [ + "depends" => "Laravel5" + ] + ] + 2 => "\Helper\Functional" + ] + "config" => [] + "depends" => [] + ] + "colors" => true + "bootstrap" => false + "strict_xml" => false + "lint" => true + "backup_globals" => true + "log_incomplete_skipped" => false + "report_useless_tests" => false + "disallow_test_output" => false + "be_strict_about_changes_to_global_state" => false + "coverage" => [] + "namespace" => "" + "groups" => array:1 [ + "failed" => "Tests/_output/failed" + ] + "gherkin" => [] + "extensions" => array:3 [ + "enabled" => array:1 [ + 0 => "Codeception\Extension\RunFailed" + ] + "config" => [] + "commands" => [] + ] + "class_name" => null + "path" => "/home/gregorio/Documents/codes/laraland/Modules/Karyawaf/Tests/functional/" + "extends" => null + "formats" => [] + "shuffle" => false + "error_level" => "E_ALL & ~E_STRICT & ~E_DEPRECATED" +] ++
"functional"
+
+null
+
+throw new \RuntimeException( + "Can't include into runner suite without a namespace;\n" + . "Please add `namespace` section into included codeception.yml file" + ); + } + + return $config['namespace']; + } + + protected function runSuites($suites, $skippedSuites = []) + { + $executed = 0; + foreach ($suites as $suite) { + if (in_array($suite, $skippedSuites)) { + continue; + } + if (!in_array($suite, Configuration::suites())) { + continue; + } + $this->codecept->run($suite); + $executed++; + } + + return $executed; + } + + protected function matchTestFromFilename($filename, $testsPath) + { + $testsPath = str_replace(['//', '\/', '\\'], '/', $testsPath); + $filename = str_replace(['//', '\/', '\\'], '/', $filename); + $res = preg_match("~^$testsPath/(.*?)(?>/(.*))?$~", $filename, $matches); + + if (!$res) { + throw new \InvalidArgumentException("Test file can't be matched"); + } + if (!isset($matches[2])) { + $matches[2] = null; + } + + return $matches;+ + +
"functional"
+
+list(, $suite, $test) = $result; + } + } + } + + if ($test) { + $filter = $this->matchFilteredTestName($test); + $userOptions['filter'] = $filter; + } + + $this->codecept = new Codecept($userOptions); + + if ($suite and $test) { + $this->codecept->run($suite, $test, $config); + } + + // Run all tests of given suite or all suites + if (!$test) { + $suites = $suite ? explode(',', $suite) : Configuration::suites(); + $this->executed = $this->runSuites($suites, $this->options['skip']); + + if (!empty($config['include']) and !$suite) { + $current_dir = Configuration::projectDir(); + $suites += $config['include']; + $this->runIncludedSuites($config['include'], $current_dir); + } + + if ($this->executed === 0) { + throw new \RuntimeException( + sprintf("Suite '%s' could not be found", implode(', ', $suites)) + ); + } + } + + $this->codecept->printResult(); + + if (!$input->getOption('no-exit')) { + if (!$this->codecept->getResult()->wasSuccessful()) { + exit(1); + }+ + +
array:1 [ + 0 => "functional" +] ++
[] ++
} + } + + if ($input->isInteractive()) { + $this->interact($input, $output); + } + + // The command name argument is often omitted when a command is executed directly with its run() method. + // It would fail the validation if we didn't make sure the command argument is present, + // since it's required by the application. + if ($input->hasArgument('command') && null === $input->getArgument('command')) { + $input->setArgument('command', $this->getName()); + } + + $input->validate(); + + if ($this->code) { + $statusCode = call_user_func($this->code, $input, $output); + } else { + $statusCode = $this->execute($input, $output); + } + + return is_numeric($statusCode) ? (int) $statusCode : 0; + } + + /** + * Sets the code to execute when running this command. + * + * If this method is used, it overrides the code defined + * in the execute() method. + * + * @param callable $code A callable(InputInterface $input, OutputInterface $output) + * + * @return $this + * + * @throws InvalidArgumentException + * + * @see execute() + */ + public function setCode(callable $code)+ + +
} + + /** + * Runs the current command. + * + * If an event dispatcher has been attached to the application, + * events are also dispatched during the life-cycle of the command. + * + * @return int 0 if everything went fine, or an error code + */ + protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) + { + foreach ($command->getHelperSet() as $helper) { + if ($helper instanceof InputAwareInterface) { + $helper->setInput($input); + } + } + + if (null === $this->dispatcher) { + return $command->run($input, $output); + } + + // bind before the console.command event, so the listeners have access to input options/arguments + try { + $command->mergeApplicationDefinition(); + $input->bind($command->getDefinition()); + } catch (ExceptionInterface $e) { + // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition + } + + $event = new ConsoleCommandEvent($command, $input, $output); + $e = null; + + try { + $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); + + if ($event->commandShouldRun()) { + $exitCode = $command->run($input, $output); + } else { + $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;+ + +
$command = $this->find($name); + } catch (\Exception $e) { + } catch (\Throwable $e) { + } + if (null !== $e) { + if (null !== $this->dispatcher) { + $event = new ConsoleErrorEvent($input, $output, $e); + $this->dispatcher->dispatch(ConsoleEvents::ERROR, $event); + $e = $event->getError(); + + if (0 === $event->getExitCode()) { + return 0; + } + } + + throw $e; + } + + $this->runningCommand = $command; + $exitCode = $this->doRunCommand($command, $input, $output); + $this->runningCommand = null; + + return $exitCode; + } + + public function setHelperSet(HelperSet $helperSet) + { + $this->helperSet = $helperSet; + } + + /** + * Get the helper set associated with the command. + * + * @return HelperSet The HelperSet instance associated with this command + */ + public function getHelperSet() + { + if (!$this->helperSet) { + $this->helperSet = $this->getDefaultHelperSet(); + }+ + +
$this->renderException($e, $output); + } + }; + if ($phpHandler = set_exception_handler($renderException)) { + restore_exception_handler(); + if (!is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) { + $debugHandler = true; + } elseif ($debugHandler = $phpHandler[0]->setExceptionHandler($renderException)) { + $phpHandler[0]->setExceptionHandler($debugHandler); + } + } + + if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) { + @trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED); + } + + $this->configureIO($input, $output); + + try { + $exitCode = $this->doRun($input, $output); + } catch (\Exception $e) { + if (!$this->catchExceptions) { + throw $e; + } + + $renderException($e); + + $exitCode = $e->getCode(); + if (is_numeric($exitCode)) { + $exitCode = (int) $exitCode; + if (0 === $exitCode) { + $exitCode = 1; + } + } else { + $exitCode = 1; + } + } finally { + // if the exception handler changed, keep it + // otherwise, unregister $renderException + if (!$phpHandler) {+ + +
return $commandClass::getCommandName(); + } + + /** + * To cache Class ArgvInput + * + * @inheritDoc + */ + public function run(InputInterface $input = null, OutputInterface $output = null) + { + if ($input === null) { + $input = $this->getCoreArguments(); + } + + if (!ini_get('register_argc_argv') && empty($_SERVER['argv'])) { + //register_argc_argv is always off on HHVM, but it has no effect + throw new ConfigurationException('register_argc_argv must be set to On for running Codeception'); + } + + return parent::run($input, $output); + } + + /** + * Add global a --config option. + * + * @return InputDefinition + */ + protected function getDefaultInputDefinition() + { + $inputDefinition = parent::getDefaultInputDefinition(); + $inputDefinition->addOption( + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config') + ); + return $inputDefinition; + } + + /** + * Search for --config Option and if found will be loaded + * + * example:+ + +
$app->add(new Codeception\Command\Clean('clean')); +$app->add(new Codeception\Command\GenerateGroup('generate:groupobject')); +$app->add(new Codeception\Command\GeneratePageObject('generate:pageobject')); +$app->add(new Codeception\Command\GenerateStepObject('generate:stepobject')); +$app->add(new Codeception\Command\GenerateEnvironment('generate:environment')); +$app->add(new Codeception\Command\GenerateFeature('generate:feature')); +$app->add(new Codeception\Command\GherkinSnippets('gherkin:snippets')); +$app->add(new Codeception\Command\GherkinSteps('gherkin:steps')); +$app->add(new Codeception\Command\DryRun('dry-run')); +$app->add(new Codeception\Command\ConfigValidate('config:validate')); + +// Suggests package +if (class_exists('Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand')) { + $app->add(new Codeception\Command\Completion()); +} else { + $app->add(new Codeception\Command\CompletionFallback()); +} + +$app->registerCustomCommands(); +$app->run(); ++ + + +
Key | +Value | +
LANG | +"en_US.UTF-8"
+
+ |
+
LESS | +"-F -g -i -M -R -S -w -X -z-4"
+
+ |
+
DISPLAY | +":0"
+
+ |
+
OLDPWD | +"/home/gregorio"
+
+ |
+
INVOCATION_ID | +"0a5aa167da604be2acc343c14c76b187"
+
+ |
+
EDITOR | +"vim"
+
+ |
+
GPG_TTY | +"/dev/pts/0"
+
+ |
+
MOZ_PLUGIN_PATH | +"/usr/lib/mozilla/plugins"
+
+ |
+
XDG_VTNR | +"1"
+
+ |
+
GIT_EDITOR | +"/home/gregorio/.bin/git_editor"
+
+ |
+
SSH_AUTH_SOCK | +"/run/user/1000/gnupg/S.gpg-agent.ssh"
+
+ |
+
XDG_SESSION_ID | +"c1"
+
+ |
+
USER | +"gregorio"
+
+ |
+
PAGER | +"less"
+
+ |
+
LSCOLORS | +"Gxfxcxdxbxegedabagacad"
+
+ |
+
PWD | +"/home/gregorio/Documents/codes/laraland"
+
+ |
+
HOME | +"/home/gregorio"
+
+ |
+
JOURNAL_STREAM | +"9:15868"
+
+ |
+
GTK_MODULES | +"canberra-gtk-module"
+
+ |
+
"/var/spool/mail/gregorio"
+
+ |
+ |
VISUAL | +"vim"
+
+ |
+
WINDOWPATH | +"1"
+
+ |
+
SHELL | +"/bin/zsh"
+
+ |
+
TERM | +"rxvt-256color"
+
+ |
+
SHLVL | +"3"
+
+ |
+
XDG_SEAT | +"seat0"
+
+ |
+
LOGNAME | +"gregorio"
+
+ |
+
DBUS_SESSION_BUS_ADDRESS | +"unix:path=/run/user/1000/bus"
+
+ |
+
XDG_RUNTIME_DIR | +"/run/user/1000"
+
+ |
+
XAUTHORITY | +"/home/gregorio/.Xauthority"
+
+ |
+
PATH | +"/home/gregorio/etc/joshd-dotfiles/bin.symlink:/home/gregorio/.bin/diff-highlight:/home/gregorio/etc/joshd-dotfiles/bin.symlink:/home/gregorio/.bin/diff-highlight:/home/gregorio/.local/bin:/home/gregorio/.npm-packages/bin:/home/gregorio/.npm-packages/bin:/home/gregorio/.config/composer/vendor/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/gregorio/.npm-packages/bin:/home/gregorio/.fzf/bin:/home/gregorio/.scripts"
+
+ |
+
WINDOWID | +"10485770"
+
+ |
+
COLORFGBG | +"default;default"
+
+ |
+
COLORTERM | +"rxvt"
+
+ |
+
_ | +"/usr/bin/php"
+
+ |
+
PHP_SELF | +"vendor/bin/codecept"
+
+ |
+
SCRIPT_NAME | +"vendor/bin/codecept"
+
+ |
+
SCRIPT_FILENAME | +"vendor/bin/codecept"
+
+ |
+
PATH_TRANSLATED | +"vendor/bin/codecept"
+
+ |
+
DOCUMENT_ROOT | +"" ++ |
+
REQUEST_TIME_FLOAT | +1532744935.1033
+
+ |
+
REQUEST_TIME | +1532744935
+
+ |
+
argv | +array:5 [ + 0 => "vendor/bin/codecept" + 1 => "run" + 2 => "functional" + 3 => "-c" + 4 => "Modules/Karyawaf" +] ++ |
+
argc | +5
+
+ |
+
SHELL_VERBOSITY | +0
+
+ |
+
APP_ENV | +"testing"
+
+ |
+
APP_KEY | +"base64:0qzWgXyeH+Eje5Ta3NEh/pZnyJeJo2GW/gCKK+0FVkU="
+
+ |
+
APP_DEBUG | +"true"
+
+ |
+
DB_CONNECTION | +"sqlite"
+
+ |
+
DB_HOST | +"sqlite"
+
+ |
+
DB_DATABASE | +":memory:"
+
+ |
+
DB_USERNAME | +"" ++ |
+
DB_PASSWORD | +"" ++ |
+
Key | +Value | +
SHELL_VERBOSITY | +0
+
+ |
+
APP_ENV | +"testing"
+
+ |
+
APP_KEY | +"base64:0qzWgXyeH+Eje5Ta3NEh/pZnyJeJo2GW/gCKK+0FVkU="
+
+ |
+
APP_DEBUG | +"true"
+
+ |
+
DB_CONNECTION | +"sqlite"
+
+ |
+
DB_HOST | +"sqlite"
+
+ |
+
DB_DATABASE | +":memory:"
+
+ |
+
DB_USERNAME | +"" ++ |
+
DB_PASSWORD | +"" ++ |
+
I am Stronger than thou
` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will *not* be true for strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `I am Stronger than thou
` + * - `` + * + * But will ignore strings like: + * + * - `Home` + * - `