public function getPostageInfo()
    {
        if (null === $this->postageInfo) {
            throw new MissingPreconditionException('No postage info provided! Provide them beforehand');
        }

        // Set delivery options to postage info if they were passed to this instance
        if (null === $this->postageInfo->getDeliveryOptions() && null !== $this->getDeliveryOptions()) {
            $this->postageInfo->setDeliveryOptions($this->getDeliveryOptions());
        }

        // Set the attachment's file size for normal letters
        if (!$this->postageInfo->getLetterSize() && $this->postageInfo->isNormalLetter() && $this->attachments) {
            $size = array_reduce(
                $this->attachments,
                function ($carry, $path) {
                    $carry += filesize($path);

                    return $carry;
                },
                0
            );

            $this->postageInfo->setLetterSize(ceil($size / 1048576));
        }

        return $this->postageInfo;
    }
public function getPostageInfo()
    {
        if (null === $this->postageInfo) {
            throw new MissingPreconditionException('No postage info provided! Provide them beforehand');
        }

        // Set delivery options to postage info if they were passed to this instance
        if (null === $this->postageInfo->getDeliveryOptions() && null !== $this->getDeliveryOptions()) {
            $this->postageInfo->setDeliveryOptions($this->getDeliveryOptions());
        }

        // Set the attachment's file size for normal letters
        if (!$this->postageInfo->getLetterSize() && $this->postageInfo->isNormalLetter() && $this->attachments) {
            $size = array_reduce(
                $this->attachments,
                function ($carry, $path) {
                    $carry += filesize($path);

                    return $carry;
                },
                0
            );

            $this->postageInfo->setLetterSize(ceil($size / 1048576));
        }

        return $this->postageInfo;
    }
public function getPostageInfo ( ) { if ( null === $ this -> postageInfo ) { throw new MissingPreconditionException ( 'No postage info provided! Provide them beforehand' ) ; } // Set delivery options to postage info if they were passed to this instance if ( null === $ this -> postageInfo -> getDeliveryOptions ( ) && null !== $ this -> getDeliveryOptions ( ) ) { $ this -> postageInfo -> setDeliveryOptions ( $ this -> getDeliveryOptions ( ) ) ; } // Set the attachment's file size for normal letters if ( ! $ this -> postageInfo -> getLetterSize ( ) && $ this -> postageInfo -> isNormalLetter ( ) && $ this -> attachments ) { $ size = array_reduce ( $ this -> attachments , function ( $ carry , $ path ) { $ carry += filesize ( $ path ) ; return $ carry ; } , 0 ) ; $ this -> postageInfo -> setLetterSize ( ceil ( $ size / 1048576 ) ) ; } return $ this -> postageInfo ; }
Get the postage info

@return PostageInfo
@throws MissingPreconditionException If no postage info are given
Get the postage info