Gregwar\Formidable\Form::__construct PHP Method

__construct() public method

public __construct ( $pathOrContent = '', $variables = null, $cache = false, $factory = null )
    public function __construct($pathOrContent = '', $variables = null, $cache = false, $factory = null)
    {
        if (null === $factory) {
            $this->factory = new Factory();
        } else {
            $this->factory = $factory;
        }
        if ($cache !== null && $cache !== false) {
            if ($cache === true) {
                $this->cache = new \Gregwar\Cache\Cache();
            } else {
                if ($cache instanceof \Gregwar\Cache\Cache) {
                    $this->cache = $cache;
                } else {
                    throw new \InvalidArgumentException('The parameter $cache should be false, true or an instance of Gregwar\\Cache\\Cache');
                }
            }
        }
        if ($pathOrContent) {
            if (strpos($pathOrContent, "\n") !== false) {
                $this->content = $pathOrContent;
            } else {
                $this->path = $pathOrContent;
                $this->variables = $variables;
            }
        }
        $this->parse();
    }