<?php
	namespace Mocha\Oop\MethodImplementations;

	use Mocha\Core\InstanceReference;
	use Mocha\Core\KnownAttributeGuids;
	use Mocha\Core\KnownClassGuids;
	use Mocha\Core\KnownRelationshipGuids;
	use Mocha\Core\OmsContext;
	use Mocha\Oms\Oms;
	use Mocha\Oop\MethodImplementation;

	use Phast\UUID;

	class GetInstancesMethodImplementation extends MethodImplementation
	{
		protected function executeInternal(Oms $oms, OmsContext $context, InstanceReference $method, ?array $parms)
		{
			$returnsWorkSet = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Instances_Method__returns__Work_Set);
			$usesInstancesOfClass = $oms->getRelatedInstance($method, KnownRelationshipGuids::Get_Instances_Method__selects_instances_of__Class);

			$usesInstances = $oms->getInstancesOf($usesInstancesOfClass);
			$context->setWorkData($returnsWorkSet, $usesInstances);
			return $returnsWorkSet;
		}
	}

?>