Read Inheritance class in abstract class

Hey Everyone,

I have a short question. I am writing an inheritance class based on a Abstract class.

class AddAttachmentToMailIntegration extends AbstractIntegration
{

    public function getName()
    {
        return 'AddAttachmentToMail';
    }

    /**
     * Return's authentication method such as oauth2, oauth1a, key, etc.
     *
     * @return string
     */

    public function getAuthenticationType()
    {
        return 'none';
    }

    public function prepareRequest($url, $parameters, $method, $settings, $authType)
    {
        $headers = [
            'Content-Type: application/x-www-form-urlencoded;charset=UTF-8',
        ];

        return [$parameters, $headers];
    }

    public function getAttachments($url)
    {
        return $this->makeRequest($url, '', 'GET');
    }

I overwrite the prepareRequest class in my inherance.

In the make request function is prepareRequest called.

   public function makeRequest($url, $parameters = [], $method = 'GET', $settings = [])
    {
        // If not authorizing the session itself, check isAuthorized which will refresh tokens if applicable
        if (empty($settings['authorize_session'])) {
            $this->isAuthorized();
        }

        $method   = strtoupper($method);
        $authType = (empty($settings['auth_type'])) ? $this->getAuthenticationType() : $settings['auth_type'];

        list($parameters, $headers) = $this->prepareRequest($url, $parameters, $method, $settings, $authType);

        if (empty($settings['ignore_event_dispatch'])) {
            $event = $this->dispatcher->dispatch(
                PluginEvents::PLUGIN_ON_INTEGRATION_REQUEST,
                new PluginIntegrationRequestEvent($this, $url, $parameters, $headers, $method, $settings, $authType)
            );

            $headers    = $event->getHeaders();
            $parameters = $event->getParameters();
        }

Will it use the class from the Abstract class or the inherited class?

This should go without saying, but, why don’t you try it and see.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.