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
Add method to convert namespaced class names to plugin split names #8224
Conversation
2b5a6dd
to
47e12fe
Compare
@@ -74,6 +74,59 @@ public static function className($class, $type = '', $suffix = '') | |||
} | |||
|
|||
/** | |||
* Returns the plugin split name of a class | |||
* |
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.
Adding some examples here will make me understand what this method is for :P
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.
I've added some examples down below.
22c2c34
to
d4145fe
Compare
👍 |
85e7454
to
b457769
Compare
@@ -69,6 +69,26 @@ public function testClassname($class, $type, $suffix = '', $existsInBase = false | |||
} | |||
|
|||
/** | |||
* testClassname | |||
* | |||
* $checkCake and $existsInCake are derived from the input parameters |
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 comment doesn't make sense in the context of the function.
Other than readability, what do you see this method being used for? |
784dd88
to
5705dc6
Compare
This method can be used to get the name of the plugin to which a class belongs. This is for example being used in UseMuffin/Webservice to detect other classes in the plugin. As the plugin can be detected based on the panel class. |
5705dc6
to
23d0b32
Compare
Another use case would be https://github.com/cakephp/debug_kit/blob/master/src/DebugPanel.php#L34 . With this method defining a plugin would not be necessary. |
👍 Looks good |
Add method to convert namespaced class names to plugin split names
Thanks! |
This method is pretty much the opposite of
App::className
and can be useful for all kinds of reasons.