<?php
	namespace Mocha\Oop;

	use Mocha\Core\InstanceReference;
	use Mocha\Core\OmsContext;
	use Mocha\Oms\Oms;

	abstract class MethodImplementation
	{
		public InstanceReference $MethodInstance;

		protected abstract function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms);
		public function execute(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms) : mixed
		{
			array_push($context->CallStack, $method);
			$retval = $this->executeInternal($oms, $context, $method, $parms);
			array_pop($context->CallStack);
			return $retval;
		}
	}
?>