GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use TerminableInterface by jeromemacias · Pull Request #15 · stackphp/url-map

This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Conversation

@jeromemacias

@jeromemacias jeromemacias commented Dec 3, 2014

Copy link
Copy Markdown
Contributor

Add UrlMap::terminate() method.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jeromemacias
Use TerminableInterface
a7e0f7e
@jeromemacias

jeromemacias commented Dec 3, 2014

Copy link
Copy Markdown
Contributor Author

Waiting for stackphp/CallableHttpKernel#3 to add missing tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@davedevelopment

davedevelopment commented Dec 3, 2014

Copy link
Copy Markdown

Do we need to terminate them based on them being matched? I'm not sure, related to stackphp/builder#14

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jeromemacias

jeromemacias commented Dec 3, 2014

Copy link
Copy Markdown
Contributor Author

The goal of UrlMap stack is to manage only one matching app, so I think we should apply the same logic in handle() and terminate(), and ignore all non matching apps.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@davedevelopment

davedevelopment commented Dec 3, 2014

Copy link
Copy Markdown

But it's one matching app per request, the HttpCache middleware could and would fire multiple requests through the app before terminate happens.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jeromemacias
Call termintate on all apps
b130397
@jeromemacias

jeromemacias commented Dec 3, 2014

Copy link
Copy Markdown
Contributor Author

Good point ;) I updated the PR accordingly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jeromemacias
Call terminate on main app
737a41f
@jeromemacias

jeromemacias commented Dec 4, 2014

Copy link
Copy Markdown
Contributor Author

I tested the UrlMap on a Silex project, with the WebProfiler provider which use the terminate kernel event. All seems good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@davedevelopment

davedevelopment commented Dec 4, 2014

Copy link
Copy Markdown

Just thought of a really minor thing, perhaps we should keep track of the apps that have been terminated, something like:

$terminated = [];
foreach ($this->map as $path => $app) {
    if ($app instanceof TerminableInterface && !in_array($app, $terminated, true)) {
        $app->terminate($request, $response);
        $terminated[] = $app;
    }
}

Not sure if that would be overkill. I personally think terminate should be idempotent, so shouldn't matter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@davedevelopment

davedevelopment commented Dec 4, 2014

Copy link
Copy Markdown

Other than that, let's :shipit:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

igorw
igorw reviewed Dec 4, 2014
View reviewed changes
Comment thread src/Stack/UrlMap.php Outdated

@igorw igorw Dec 4, 2014

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should no longer be needed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jeromemacias
Clean dead code in UrlMap::terminate() method
99f6792
CHH added a commit that referenced this pull request Apr 16, 2015
@CHH
Merge pull request #15 from jeromemacias/master
bfc9bcf
Use TerminableInterface
@CHH
CHH merged commit bfc9bcf into stackphp:master Apr 16, 2015
@CHH

CHH commented Apr 16, 2015

Copy link
Copy Markdown
Member

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jeromemacias @davedevelopment @CHH @igorw
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.