public interface EngineStartOperation {
void start();
}
public interface EngineStopOperation {
void stop();
}
public interface NewWhatEverMethod {
void whatEver();
}
public class Engine implements EngineStartOperation, EngineStopOperation {
@Override
public void start() {
// existing method
}
@Override
public void stop() {
// existing method
}
}
public class WhatEverEngine1 implements NewWhatEverMethod, EngineStartOperation, EngineStopOperation {
@Override
public void start() {
}
@Override
public void stop() {
}
@Override
public void whatEver() {
// new logic here
}
}
public class WhatEverEngine2 implements NewWhatEverMethod, EngineStartOperation, EngineStopOperation {
private final Engine engine;
public WhatEverEngine2(final Engine engine) {
this.engine = engine;
}
@Override
public void start() {
engine.start();
}
@Override
public void stop() {
engine.stop();
}
@Override
public void whatEver() {
// new logic here
}
}
interface EngineInterface
{
public function ArrayMerge($item_1);
public function value_search($item_1, $item_2);
}
class ArrayFunct
{
private $Engine;
function __construct(EngineInterface $Engine)
{
$this -> Engine = $Engine;
}
public function ArrMerge($array)
{
return $this -> Engine -> ArrayMerge($array);
}
public function value_search($array, $search)
{
return $this -> Engine -> key_search($array, $search);
}
}
class Engine implements EngineInterface
{
private $array_result;
private $array_count;
public function ArrMerge($array) {
// ваш функционал
return $result;
}
public function value_search($array, $search) {
// ваш функционал
return $result;
}
}
$engine = new Engine;
$ArrayFunct = new ArrayFunct($engine);