namespace IlluminateView;
use Closure;
use IlluminateSupportArr;
use IlluminateSupportStr;
use InvalidArgumentException;
use IlluminateContractsSupportArrayable;
use IlluminateViewEnginesEngineResolver;
use IlluminateContractsEventsDispatcher;
use IlluminateContractsContainerContainer;
use IlluminateContractsViewFactory as FactoryContract;
// super cool namespace
class Factory implements FactoryContract
{// factory implements the Factory Contract
protected $engines;// The engine implementation
protected $finder;//The view finder implementation,this protected
protected $events;// the event dispatcher instance
protected $container;//The IoC container instance
protected $shared = [];//Data that should be available to all templates.
// this mind may be too expensive
protected $aliases = [];// array of registered view name aliases.
protected $names = [];//all of the registered view names.
protected $extensions = ['blade.php' => 'blade', 'php' => 'php'];
// The extension to engine bindings.
protected $composers = [];//The view composer events
protected $sections = [];//All of the finished, captured sections
protected $sectionStack = [];//The stack of in-progress sections.
protected $renderCount = 0;// The number of active rendering operations.
public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events)
{// create a new view factory instance.
$this->finder = $finder;
$this->events = $events;
$this->engines = $engines;// get this engines
$this->share('__env', $this);
}//share env
public function file($path, $data = [], $mergeData = [])
{// get the data
$data = array_merge($mergeData, $this->parseData($data));
// array_merge
$this->callCreator($view = new View($this, $this->getEngineFromPath($path), $path, $path, $data));
// callCreator
return $view;
}// Get the evaluated view contents for the given view.



