Retrieve the email model factory.

@throws RuntimeException If the model factory is missing.
@return FactoryInterface
499464
protected function emailFactory()
    {
        if (!isset($this->emailFactory)) {
            throw new RuntimeException(sprintf(
                'Email Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->emailFactory;
    }
264353
public function getExporter()
	{
		// Derive the class name from the driver.
		$class = '\\Joomla\\Database\\' . ucfirst($this->name) . '\\' . ucfirst($this->name) . 'Exporter';

		// Make sure we have an exporter class for this driver.
		if (!class_exists($class))
		{
			// If it doesn't exist we are at an impasse so throw an exception.
			throw new \RuntimeException('Database Exporter not found.');
		}

		/* @var  $o  DatabaseExporter */
		$o = new $class;
		$o->setDbo($this);

		return $o;
	}
1153620
public function getLogger() {
		if(!$this->isInDB()) {
			throw new RuntimeException("Can't write to a log file until we know the database ID.");
		}

		if(!$this->Environment()) {
			throw new RuntimeException("Can't write to a log file until we have an Environment.");
		}

		if($this->Environment() && !$this->Environment()->Project()) {
			throw new RuntimeException("Can't write to a log file until we have the Environment's project.");
		}

		$environment = $this->Environment();
		$project = $this->Environment()->Project();
		$filename = sprintf('%s.pipeline.%d.log', $environment->getFullName('.'), $this->ID);

		return Injector::inst()->createWithArgs('DeploynautLogFile', array($filename));
	}
1067706
public function obj()
    {
        if ($this->obj === null) {
            $formGroup = $this->formGroup();
            if ($formGroup instanceof self) {
                $prop = $formGroup->storageProperty();
                $val  = $formGroup->obj()->propertyValue($prop->ident());

                $this->obj = $prop->structureVal($val, [ 'default_data' => true ]);
                if ($this->obj === null) {
                    $this->obj = clone $prop->structureProto();
                }
            } elseif ($this->form() instanceof ObjectContainerInterface) {
                $this->obj = $this->form()->obj();
            }

            if ($this->obj === null) {
                throw new RuntimeException(sprintf(
                    'The [%1$s] widget has no data model.',
                    static::CLASS
                ));
            }
        }

        return $this->obj;
    }
378259
public static function getInstance()
    {
        if (is_null(self::$instance)) {
            throw new \RuntimeException('You must first create the singleton instance with createInstance().');
        }
        self::$instance->setGlobalsFromSugar();
        self::$instance->chdirToSugarDir();

        return self::$instance;
    }
247540
protected function widgetFactory()
    {
        if ($this->widgetFactory === null) {
            throw new RuntimeException(sprintf(
                'Widget Factory is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->widgetFactory;
    }
1277256
public function send()
    {
        $to = $this->getToForSend();
        $headers = $this->getHeadersForSend();

        if (empty($to)) {
            throw new \RuntimeException(
                'Unable to send, no To address has been set.'
            );
        }

        if ($this->hasAttachments()) {
            $message  = $this->assembleAttachmentBody();
            $headers .= PHP_EOL . $this->assembleAttachmentHeaders();
        } else {
            $message = $this->getWrapMessage();
        }

        return mail($to, $this->_subject, $message, $headers, $this->_params);
    }
59115
public function propertyInputFactory()
    {
        if (!isset($this->propertyInputFactory)) {
            throw new RuntimeException(sprintf(
                'Property Control Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->propertyInputFactory;
    }
652504
protected function getContainer(): ContainerInterface
    {
        if (null === $this->container) {
            $app = $this->getApplication();

            if (!$app instanceof Application) {
                throw new \RuntimeException('Sculpin Application not found!');
            }

            $this->container = $app->getKernel()->getContainer();
        }

        return $this->container;
    }
733672
protected function factory()
    {
        if ($this->factory === null) {
            throw new RuntimeException(
                sprintf('Model Factory is not defined for "%s"', get_class($this))
            );
        }

        return $this->factory;
    }
1211692
public function getFactory($name)
    {
        if (!isset($this->factories[$name])) {
            throw new \RuntimeException(sprintf('No factory registered with name "%s"', $name));
        }

        return $this->factories[$name];
    }
1250964
protected function modelFactory()
    {
        if ($this->modelFactory === null) {
            throw new Exception(sprintf(
                'Model Factory is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->modelFactory;
    }
336992
public function getEntityService()
    {
        if (null === $this->entityService) {
            $entityServiceClass = $this->getEntityServiceClass();
            if (!class_exists($entityServiceClass)) {
                throw new \RuntimeException("Classe $entityServiceClass inexistente!");
            }
            $this->entityService = new $entityServiceClass();
            $this->entityService->setServiceLocator($this->getServiceLocator());
        }

        return $this->entityService;
    }
341499
public function getServiceUtil()
    {
        if ($this->serviceUtil) {
            return $this->serviceUtil;
        }

        $className = $this->getServiceUtilClassName();
        $r = new ReflectionClass($className);
        $instance = $r->newInstance();

        if (!$instance instanceof ServiceUtilInterface) {
            $errMsg = sprintf('Service util not implement %s', ServiceUtilInterface::class);
            throw new Exception\RuntimeException($errMsg);
        }
        $this->serviceUtil = $instance;

        return $this->serviceUtil;
    }
1125320
private function getContactClientModel()
    {
        if (!$this->contactClientModel) {
            /* @var ContactClientModel $contactClientModel */
            $this->contactClientModel = $this->getContainer()->get('mautic.contactclient.model.contactclient');
        }

        return $this->contactClientModel;
    }
90599
public function recover()
    {
        if (! class_exists($this->class)) {
            return new RuntimeException($this->message);
        }

        try {
            $reflection = new ReflectionClass($this->class);

            $e = $reflection->newInstanceWithoutConstructor();

            if (! $e instanceof Throwable) {
                throw new RuntimeException("Class [{$this->class}] is not an exception.");
            }

            foreach ($reflection->getProperties() as $property) {
                $name = $property->getName();

                if (isset($this->properties[$name])) {
                    $value = $this->properties[$name];

                    $property->setAccessible(true);

                    $property->setValue($e, $value instanceof Serialization ? $value->recover() : $value);
                }
            }

            return $e;
        } catch (Throwable $ex) {
            return new RuntimeException($this->message);
        }
    }
1261936
protected function modelLoaderBuilder()
    {
        if (!isset($this->modelLoaderBuilder)) {
            throw new RuntimeException(sprintf(
                'Model Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->modelLoaderBuilder;
    }