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

Non-static functions #22

Open
mattrabe opened this issue Jan 19, 2017 · 3 comments
Open

Non-static functions #22

mattrabe opened this issue Jan 19, 2017 · 3 comments

Comments

@mattrabe
Copy link

In implementing this I have run into numerous issues, but the central issue I'm seeing seems to relate to the fact that all of the functions in src/Alexa.php are public, non-static functions, yet your readme indicates that they should be called statically. You list Alexa::say("Hello") and Alexa::slot('choice') in your readme, but both functions are non-static. Simply changing say() to a public static function resolves the issue for that function, but the slot() function references $this within itself, and therefore cannot be changed to a static function. Are there unpushed commits or something else I am missing here?

@develpr
Copy link
Collaborator

develpr commented Jan 31, 2017

Just to check, did you register the facades as outlined here? https://github.com/develpr/alexa-app#2-adding-the-facadesaliases-for-alexa-and-alexaroute-optional - long story short without registering those you wouldn't be able to do things like Alexa::say(..., etc.

I'm guessing you perhaps have, and that the issue is "deeper", but I wanted to double check!

@mattrabe
Copy link
Author

Yes, I did enable the facades in bootstrap/app.php like this:

$app->withFacades();
class_alias(\Develpr\AlexaApp\Facades\AlexaRouter::class, 'AlexaRoute');
class_alias(\Develpr\AlexaApp\Facades\Alexa::class, 'Alexa');

@mattrabe
Copy link
Author

For what it's worth I've forked this repo and made changes on a new branch lumen-5.1.7 so that I am able to use static functions at least in some cases in Lumen 5.1.7: https://github.com/mattrabe/alexa-app/tree/lumen-5.1.7

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

No branches or pull requests

2 participants