While I was trying to translate my website I came across a problem. I first used to translate something from an array with many keys but now I want to do it with a function.
So here is my code which obviously doesn't work:
class Foo extends Database {
   private $crumb = 'Hello';
   public function breadcrumb( callable $translate ) {
       return $translate($this->crumb);
       // So: $bar->translate($this->crumb);
   }
}
class Bar extends Database {
   private $translation = ['Hello'=>'Hallo']; // Array made out of words comming from a database
   public function translate($word) {
      return $this->translation[$word];
   }
}
On a page:
<?php
$foo = new Foo();
$bar = new Bar();
?>
<h1><? echo $foo->breadcrumb($bar->translate()); ?></h1> <!-- Expected result <h1>Hallo</h1> --> 
As you can see I have the classes already extended by another class so extending Foo with Bar isn't possible. 
So my problem is how can I call a method inside another class's method? I have this problem in a couple of other classes too.
I found a few things like below but still didn't help me.
 
     
    