Hi all, I need help with the function 4 of the Highschool Sweetheats exercise in php. The test doesn’t pass and couldn’t identify what is wrong in my code.
<?php
class HighSchoolSweetheart
{
public function firstLetter(string $name): string
{
$firstLetter = trim(substr($name, 0, 1));
return $firstLetter;
throw new \BadFunctionCallException("Implement the function");
}
public function initial(string $name): string
{
$initial = strtoupper($this->firstLetter($name));
$initial .= '.';
return $initial;
throw new \BadFunctionCallException("Implement the function");
}
public function initials(string $name): string
{
$fullName= explode(" ", $name);
$firstName = $fullName[0];
$lastName = $fullName[1];
$firstLetterFirstName = $this->initial($firstName);
$firstLetterLastName = $this->initial($lastName);
$initials = $firstLetterFirstName .= " $firstLetterLastName";
return $initials;
throw new \BadFunctionCallException("Implement the function");
}
public function pair(string $sweetheart_a, string $sweetheart_b): string
{
$initials_a = $this->initials($sweetheart_a);
$initials_b = $this->initials($sweetheart_b);
$heart ="
****** ******
** ** ** **
** ** ** **
** * **
** **
** $initials_a + $initials_b **
** **
** **
** **
** **
** **
** **
***
*";
return $heart;
}
}```