compileLocator = $compileLocator; $this->userLocator = $userLocator; } /** * @param $type string * * @return InspectionInterface[] */ public function getInspections($type) { $locator = match ($type) { CompileInspectionInterface::INSPECTION_KEYWORD => $this->compileLocator, UserInspectionInterface::INSPECTION_KEYWORD => $this->userLocator, default => throw new \Exception("Unknown inspection type {$type}"), }; $inspections = []; foreach ($locator->getProvidedServices() as $className) { if ($locator->has($className)) { $inspections[] = $locator->get($className); } } return $inspections; } }