PHP Facade Pattern
<p>I tried to learn Facade pattern, but got stuck with a problem. PHP doesnt output $totalprice from PrintPrice method. Also, here is additional information: var_dump after initializing and object gives me:</p>

<pre><code>private 'SkiRent' =&gt; 
object(SkiRent)[2]
private 'SkiResortTicketSystem' =&gt; 
object(SkiResortTicketSystem)[3]
private 'HotelBookingSystem' =&gt; 
object(HotelBookingSystem)[4]
private 'totalprice' =&gt; null
</code></pre>

<p>but var_dump after calling HaveGoodRest gives me blank page.
I wonder if you could help me, here is the code:</p>

<pre><code>&lt;?php
class SkiRent
{
public function RentBoots($feetSize, $skierLevel)
{
    return 20*$skierLevel*100/$feetSize;
}
public function RentSki($weight, $skierLevel)
{
    return 40*$skierLevel*100/$weight;
}
public function RentPole($height)
{
    return 5*$height/100;
}
};

class SkiResortTicketSystem
{
public function BuyOneDayTicket()
{
    return 115;
}
public function BuyHalfDayTicket()
{
    return 60;
}
};

class HotelBookingSystem
{
public function BookRoom($roomQuality)
{
    switch ($roomQuality)
    {
        case 3:
            return 250;
        case 4:
            return 500;
        case 5:
            return 900;
        default:
            throw new ArgumentException("roomQuality should be in [3;5]");       
    }

    }
};

class SkiResortFacade
{
private $SkiRent;
private $SkiResortTicketSystem;
private $HotelBookingSystem;
private $totalprice;

function __construct()
{
  $this-&gt;SkiRent = new SkiRent(); 
  $this-&gt;SkiResortTicketSystem = new SkiResortTicketSystem();
  $this-&gt;HotelBookingSystem  = new HotelBookingSystem();
}

function HaveGoodRest($height, $weight, $feetSize, $skierLevel, $roomQuality)
{
    $skiPrice = $SkiRent-&gt;RentSki($weight, $skierLevel);
    var_dump($skiPrice);
    $skiBootsPrice = $SkiRent-&gt;RentBoots($feetSize,$skierLevel);
    $polePrice = $SkiRent-&gt;RentPole($height);
    $oneDayTicketPr = $SkiResortTicketSystem-&gt;BuyOneDayTicket();
    $hotelPrice = $HotelBookingSystem-&gt;BookRoom($roomQuality);

    $this-&gt;totalprice = $skiPrice + $skiBootsPrice + $polePrice + $oneDayTicketPr + $hotelPrice;
}

public function HaveRestWithOwnSkis($roomQuality)
{
    $oneDayTicketPr = $SkiResortTicketSystem-&gt;BuyOneDayTicket();
    $hotelPrice = $HotelBookingSystem-&gt;BookRoom($roomQuality);
    return $oneDayTicketPr + $hotelPrice;
}

public function PrintPrice()
{
    echo $this-&gt;totalprice;
}

};

$rest = new SkiResortFacade();
var_dump($rest);
$height = 181.5;
$weight = 70.1;
$feetSize = 45.2;
$skierLevel = 1.2;
$roomQuality = 3;
$rest-&gt;HaveGoodRest($height, $weight, $feetSize, $skierLevel, $roomQuality);
var_dump($rest);
$rest-&gt;PrintPrice();
?&gt;
</code></pre>
