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

Magic _call method #25

Closed
jonnywilliamson opened this issue Sep 3, 2015 · 2 comments
Closed

Magic _call method #25

jonnywilliamson opened this issue Sep 3, 2015 · 2 comments

Comments

@jonnywilliamson
Copy link
Contributor

In the BaseObject class file is this:

    public function __call($name, $arguments)
    {
        $action = substr($name, 0, 3);

        if ($action === 'get') {
            $property = snake_case(substr($name, 3));
            $response = $this->get($property, false);

            if ($response) {
                // Map relative property to an object
                $relations = $this->relations();
                if (isset($relations[$property])) {
                    return new $relations[$property]($response);
                }

                return $response;
            }

            throw new TelegramUndefinedPropertyException();
        }

        return false;
    }

Does the $arguments parameter have any use? I can't see it being used, but I just wanted to check.

@irazasyed
Copy link
Owner

Nope, It doesn't have any use but it's required though. Otherwise it throws FatalErrorException.

@jonnywilliamson
Copy link
Contributor Author

Thank you.

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