<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* @bundles/CoreBundle/Factory/ModelFactory.php */
class __TwigTemplate_194e76ccc395608f4d58b7b21930d59b4e57f33fd553fe5aa4de2c14b2e9175c extends Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "<?php

namespace Mautic\\CoreBundle\\Factory;

use Mautic\\CoreBundle\\Model\\AbstractCommonModel;
use Symfony\\Component\\DependencyInjection\\ContainerInterface;

class ModelFactory
{
    private \$container;

    public function __construct(ContainerInterface \$container)
    {
        \$this->container = \$container;
    }

    /**
     * @param \$modelNameKey
     *
     * @return AbstractCommonModel
     */
    public function getModel(\$modelNameKey)
    {
        // Shortcut for models with the same name as the bundle
        if (false === strpos(\$modelNameKey, '.')) {
            \$modelNameKey = \"\$modelNameKey.\$modelNameKey\";
        }

        \$parts = explode('.', \$modelNameKey);

        if (2 !== count(\$parts)) {
            throw new \\InvalidArgumentException(\$modelNameKey.' is not a valid model key.');
        }

        [\$bundle, \$name] = \$parts;

        // The container is now case sensitive
        \$containerKey = sprintf('mautic.%s.model.%s', \$bundle, \$name);

        if (\$this->container->has(\$containerKey)) {
            return \$this->container->get(\$containerKey);
        }

        throw new \\InvalidArgumentException(\$containerKey.' is not a registered container key.');
    }

    /**
     * Check if a model exists.
     *
     * @param \$modelNameKey
     */
    public function hasModel(\$modelNameKey)
    {
        try {
            \$this->getModel(\$modelNameKey);

            return true;
        } catch (\\InvalidArgumentException \$exception) {
            return false;
        }
    }
}
";
    }

    public function getTemplateName()
    {
        return "@bundles/CoreBundle/Factory/ModelFactory.php";
    }

    public function getDebugInfo()
    {
        return array (  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "@bundles/CoreBundle/Factory/ModelFactory.php", "/var/www/mautic/app/bundles/CoreBundle/Factory/ModelFactory.php");
    }
}
