Last active
August 25, 2022 09:37
-
-
Save kkreft/600eba2952443dc7c8b2f94674ea2f23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Foo { | |
public function foo(string $message): string; | |
} | |
interface Bar { | |
public function process(string $message): string; | |
} | |
final class FooService implements Foo { | |
private const PREFIX = 'foo'; | |
private Bar $bar; | |
public function __construct(Bar $bar) { | |
$this->bar = $bar; | |
} | |
public function foo(string $message): string | |
{ | |
$fullText = self::PREFIX . '_' . $message; | |
return $this->bar->process($fullText); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment