Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy the regexes to the public interface #436

Merged
merged 1 commit into from
Jul 19, 2016

Conversation

nickvergessen
Copy link
Member

No description provided.

@nickvergessen nickvergessen added this to the Nextcloud Next milestone Jul 18, 2016
@mention-bot
Copy link

@nickvergessen, thanks for your PR! By analyzing the annotation information on this pull request, we identified @LukasReschke, @DeepDiver1975 and @tanghus to be potential reviewers

@MorrisJobke
Copy link
Member

👍

@icewind1991
Copy link
Member

Wouldn't it be better to have an isUserAgent method (which accepts IRequest::ANDROID, etc) instead of exposing the implentation details of detection

@nickvergessen
Copy link
Member Author

We have a method isUserAgent which accepts an array of regexes. The problem is, you don't have the regexes publicly available to use them on this method.

I would also only consider the name public api, not the actual value?

@MorrisJobke
Copy link
Member

I would also only consider the name public api, not the actual value?

Could this be done by an abstract constant? Is this possible?

@@ -67,10 +67,20 @@ class Request implements \ArrayAccess, \Countable, IRequest {
// Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent
const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#';
const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#';
const REGEX_LOCALHOST = '/^(127\.0\.0\.1|localhost)$/';
Copy link
Member

Choose a reason for hiding this comment

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

I know this is unrelated to your PR, but what about IPv6?

Copy link
Member

Choose a reason for hiding this comment

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

Open an ticket ;)

@ChristophWurst
Copy link
Member

Could this be done by an abstract constant? Is this possible?

No, according to http://php.net/manual/en/language.oop5.interfaces.php:

It's possible for interfaces to have constants. Interface constants works exactly like class constants except they cannot be overridden by a class/interface that inherits them.

@nickvergessen
Copy link
Member Author

I mean we could also add methods that then use isUserAgent(self::CONST) but I prefer those 3 consts over 3 new methods.

@LukasReschke
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants