Coupon code generator using the strategy pattern in PHP Below is the implementation in PHP. I aim to have a different coupon code and a different discount returned, based on the type of book (vintage or new). 

&lt;?php

interface BookOffer {
    function generateCoupon();
    function generateDiscount();
}


class VintageBookOffer implements BookOffer {
    function generateCoupon() {
        return "VINTAGECOUPONCODE";
    }

    function generateDiscount() {
        return 10.0;
    }
}


class NewBookOffer implements BookOffer {
    function generateCoupon() {
        return "NEWBOOKCOUPONCODE";
    }

    function generateDiscount() {
        return 5.0;
    }
}


class OfferGenerator {

    function generateOffer($bookType) {

        if($bookType == "vintage") {
            $bookObject = new VintageBookOffer();
        }
        else if($bookType == "newbook") {
            $bookObject = new NewBookOffer();
        }

        return $bookObject;
    }
}


$bookType1 = "vintage";
$bookType2 = "newbook";


$offerGenerator = new OfferGenerator();
$bookOffer1 = $offerGenerator-&gt;generateOffer($bookType1);
$bookOffer2 = $offerGenerator-&gt;generateOffer($bookType2);


echo "You chose book type " . $bookType1 . ". Your coupon code is " . $bookOffer1-&gt;generateDiscount() . ", and your discount is " . $bookOffer1-&gt;generateCoupon();

echo "You chose book type " . $bookType2 . ". Your coupon code is " . $bookOffer2-&gt;generateDiscount() . ", and your discount is " . $bookOffer2-&gt;generateCoupon();

?&gt;


Does this look correct? The only reason I think it might be incorrect is because it does not use type hinting, which is frequently seen in the Strategy Pattern.
It's correct. But if you want to restrict return types to something specific (and I would, because db) you could write interface functions like this:

function generateCoupon(): string;
function generateDiscount(): int;


http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration

http://php.net/manual/en/functions.returning-values.php