1

I was looking for the implementation of setCarrier() and getCarrier(), what I found was in the beginning of Magento/Quote/Model/Quote/Address/Rate.php (link), but they are commented with no function body like below...

 * @method string getCarrier()
 * @method \Magento\Quote\Model\Quote\Address\Rate setCarrier(string $value)

And then I found a function using getCarrier() under the same php file, which is

public function importShippingRate(\Magento\Quote\Model\Quote\Address\RateResult\AbstractResult $rate)
    {
        if ($rate instanceof \Magento\Quote\Model\Quote\Address\RateResult\Error) {
            $this->setCode(
                $rate->getCarrier() . '_error'
            )->setCarrier(
                $rate->getCarrier()
            )->setCarrierTitle(
                $rate->getCarrierTitle()
            )->setErrorMessage(
                $rate->getErrorMessage()
            );
        } elseif ($rate instanceof \Magento\Quote\Model\Quote\Address\RateResult\Method) {
            $this->setCode(
                $rate->getCarrier() . '_' . $rate->getMethod()
            )->setCarrier(
                $rate->getCarrier()
            )->setCarrierTitle(
                $rate->getCarrierTitle()
            )->setMethod(
                $rate->getMethod()
            )->setMethodTitle(
                $rate->getMethodTitle()
            )->setMethodDescription(
                $rate->getMethodDescription()
            )->setPrice(
                $rate->getPrice()
            );
        }
        return $this;
    }

So I went to the \Magento\Quote\Model\Quote\Address\RateResult\AbstractResult, but the php file inside is this, an empty class.

I have checked the di.xml, but nothing related was found. Are those functions internally interpreted into some other functions?

0

That's a way to document that a function exists, but it's being generated using __call(), probably in a parent class (in this case I believe it would be Magento\Framework\DataObject).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.