Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsam poplack
9,467 Pointshow do i return the room string
I am trying to solve the objective and am stick could someone help me please?
<?php
class Render {
public static function displayDimensions($size) {
return $size[0] . ' x ' . $size[1];
}
public static function detailsKitchen($room) {
return $room . ": " . $self->displayDimensions();
}
}
?>
1 Answer
Mathieu St-Vincent
9,244 PointsYou must pass a static function as such : self::staticFunction
You needed to get the dimensions from the $room->getDimensions() method.
<?php
class Render {
public static function displayDimensions($size) {
return $size[0] . ' x ' . $size[1];
}
public static function detailsKitchen($room) {
return "Kitchen Dimensions: " . self::displayDimensions($room->getDimensions());
}
}
?>
sam poplack
9,467 Pointssam poplack
9,467 Pointsit worked but where does the getDimensions come from we didn't assign that function? im confused on that part
Mathieu St-Vincent
9,244 PointsMathieu St-Vincent
9,244 PointsThe accepted parameter $room will be an object which has a method named getDimensions.
[...]
You will need to call the static method displayDimensions from within the Render class and pass the dimensions from the $room object using the getDimensions method