Getting stuck at HighSchoolSweetheart

Test is getting failed when printing heart with intials

class HighSchoolSweetheart
{
    public function firstLetter(string $name): string
    {
        return substr(trim($name), 0, 1);
        throw new \BadFunctionCallException("Implement the function");
    }

    public function initial(string $name): string
    {
        $name = $this->firstLetter($name);
        return ucfirst(trim($name)).".";
        throw new \BadFunctionCallException("Implement the function");
    }

    public function initials(string $name): string
    {
        $name = explode(" ", $name);
        return $this->initial($name[0]). " " . $this->initial($name[1]);
        throw new \BadFunctionCallException("Implement the function");
    }

    public function pair(string $sweetheart_a, string $sweetheart_b): string
    {
        $sweetheart_a = $this->initials($sweetheart_a);
        $sweetheart_b = $this->initials($sweetheart_b);
        $line = $sweetheart_a . "  +  " . $sweetheart_b;
return <<<END
         ******       ******
       **      **   **      **
     **         ** **         **
    **            *            **
    **                         **
    **     {$line}     **
      **                       **
        **                   **
          **               **
            **           **
              **       **
                **   **
                  ***
                   *
END;
        return $pattern;
        throw new \BadFunctionCallException("Implement the function");
    }
}
$sweetheart = new HighSchoolSweetheart();
$expected = <<<EXPECTED_HEART
         ******       ******
       **      **   **      **
     **         ** **         **
    **            *            **
    **                         **
    **     A. B.  +  C. D.     **
     **                       **
       **                   **
         **               **
           **           **
             **       **
               **   **
                 ***
                  *
    EXPECTED_HEART;

$this->assertEquals(
    $expected,
    $sweetheart->pair('Avery Bryant', 'Charlie Dixon')
);

Is there test output that shows the expected vs actual output?

Yes, this is what it’s showing.

HighSchoolSweetheartTest::testPair
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'     ******       ******\n
-   **      **   **      **\n
- **         ** **         **\n
-**            *            **\n
-**                         **\n
-**     A. B.  +  C. D.     **\n
- **                       **\n
-   **                   **\n
-     **               **\n
-       **           **\n
-         **       **\n
-           **   **\n
-             ***\n
-              *'
+'         ******       ******\n
+       **      **   **      **\n
+     **         ** **         **\n
+    **            *            **\n
+    **                         **\n
+    **     A. B.  +  C. D.     **\n
+      **                       **\n
+        **                   **\n
+          **               **\n
+            **           **\n
+              **       **\n
+                **   **\n
+                  ***\n
+                   *'

HighSchoolSweetheartTest.php:94```

You might need to remove 4 spaces from the start of each line.

Thank you after removing 4 spaces it is done now.

@fejan11 Just to make sure you see, why it works for the tests. When using HereDoc or NowDoc strings, the indentation of the closing identifier makes a difference:

    EXPECTED_HEART;
END;

You might be correct but removing few spaces it accepted my code.