Skip to content

Instantly share code, notes, and snippets.

@kkreft
Last active August 25, 2022 09:37
Show Gist options
  • Save kkreft/600eba2952443dc7c8b2f94674ea2f23 to your computer and use it in GitHub Desktop.
Save kkreft/600eba2952443dc7c8b2f94674ea2f23 to your computer and use it in GitHub Desktop.
<?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