This method will load the package template instance.

@param $directory
193258
private function loadPackageTemplate($directory)
    {
        $namespacedPackageClass = $this->packageLoader->loadPackage(realpath($directory));
        $this->autoLoaderManager->mergePackageLoader(realpath($directory));
        $this->package = app($namespacedPackageClass);
    }
656132
private function readDirectoryContent(string $directory): void
    {
        $items = new DirectoryIterator($directory);

        foreach ($items as $item) {

            if ($item->isFile() && $this->isFile($item->getFilename())) {
                $this->readFileContent($item->getPathname());
            }
        }
    }
1229114
public function Load($directory, $configuration_file)
    {
        $this->preferences = array();

        $this->directory = $directory;

        $this->file = $this->directory . "/$configuration_file";

        if(file_exists($this->file))
        {
            $this->preferences = parse_ini_file($this->file, true);
        }
    }
1094886
public function addFolder(string $directory, string $alias = '')
	{
		if ($alias === '')
		{
			throw new \InvalidArgumentException('Setting an alias is required in Plates');
		}

		$this->getRenderer()->addFolder($alias, $directory);

		return $this;
	}
594301
protected function createDirectory($directory)
    {
        if (!@mkdir($directory, $this->mode, true) && !is_dir($directory)) {
            throw new \RuntimeException(sprintf('The directory \'%s\' could not be created.', $directory));
        }
    }
974946
public function emptyDir($directory)
    {
        [$fs, $directory] = $this->getFilesystemAndPath($directory);

        $fs->emptyDir($directory);
    }
1049315
public static function get_template_parts( $directory, $exclude_underscore = false ) {
		if ( ! is_dir( $directory ) ) {
			return;
		}

		$files = static::get_include_files( $directory, $exclude_underscore );

		foreach ( $files['files'] as $file ) {
			$file = realpath( $file );
			$template_name = str_replace( [ trailingslashit( realpath( get_template_directory() ) ), '.php' ], '', $file );
			\get_template_part( $template_name );
		}

		foreach ( $files['directories'] as $directory ) {
			static::get_template_parts( $directory, $exclude_underscore );
		}
	}
866960
public function createEmptyDirectory($directory)
    {
        if (!is_dir($directory)) {
            mkdir($directory, 0777, true);
        } else {
            $this->deleteTree($directory, false);
        }
    }
1272235
public function setTemplateDir($dir)
    {
        $tmpDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
        if (is_dir($tmpDir) === false) {
            throw new Exception('The template directory: "' . $tmpDir . '" does not exists, create the directory or specify an other location !');
        }
        $this->templateDir[] = $tmpDir;
    }
811822
public function setDirectory($directory)
    {
        $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
        if (file_exists($this->directory) === false) {
            mkdir($this->directory, $this->fileMode, true);
        }
    }
283469
public static function loadPHPfiles($directory, $skipped=[]) {
		$content = scandir($directory);
		foreach($content as $file) {
			$defaults = [".", ".."];
			if(in_array($file, $defaults) || in_array($file, $skipped)) {
				continue;
			} else {
				if(preg_match("~php$~", $file)) {
					require_once $directory."/".$file;
				}
			}
		}
	}
1239344
public function setDirectory($directory) {

		if(false === is_string($directory)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($directory)), E_USER_ERROR);
		}

		$this -> directory = new Directory($directory);

		if(false === $this -> directory -> isWritable()) {
			return trigger_error(sprintf('Directory "%s" passed to %s() is not writable', $directory, __METHOD__), E_USER_ERROR);
		}

		return $this;
	}
66028
protected function loadTemplate($directory, $filename)
	{
		$contents = '';

		// Check to see if we have a valid template file
		if (file_exists($directory . DS . $filename))
		{
			// Store the file path
			$this->file = $directory . DS . $filename;

			// Get the file content
			ob_start();
			require_once $directory . DS . $filename;
			$contents = ob_get_contents();
			ob_end_clean();
		}

		return $contents;
	}
630329
public static function installed( $directory, $package ) {
		$command = 'composer show ' . $package . ' -D';

		try {
			App::execute( $command, $directory );
		} catch ( ProcessFailedException $e ) {
			return false;
		}

		return true;
	}
867660
protected function _loadTemplate($directory, $filename)
	{
		$contents = '';

		// Check to see if we have a valid template file
		if (file_exists($directory . DS . $filename))
		{
			// Store the file path
			$this->_file = $directory . DS . $filename;

			//get the file content
			ob_start();
			require $directory . DS . $filename;
			$contents = ob_get_contents();
			ob_end_clean();
		}

		// Try to find a favicon by checking the template and root folder
		$dirs = array(
			$directory . DS,
			PATH_ROOT . DS
		);

		foreach ($dirs as $dir)
		{
			$icon = $dir . 'favicon.ico';

			if (file_exists($icon))
			{
				$path = str_replace(PATH_ROOT . '/', '', $dir);
				$path = str_replace('\\', '/', $path);

				$this->addFavicon(rtrim(\Request::root(true), '/') . '/' . $path . 'favicon.ico');
				break;
			}
		}

		return $contents;
	}
611377
public static function load_theme_files( $directory, $exclude_underscore = false ) {
		if ( ! is_dir( $directory ) ) {
			return;
		}

		$files = static::get_include_files( $directory, $exclude_underscore );

		foreach ( $files['files'] as $file ) {
			$file = realpath( $file );
			$file = str_replace( realpath( get_template_directory() ), '', $file );
			$file = str_replace( realpath( get_stylesheet_directory() ), '', $file );
			$file = get_theme_file_path( $file );
			include_once( $file );
		}

		foreach ( $files['directories'] as $directory ) {
			static::load_theme_files( $directory, $exclude_underscore );
		}
	}
675345
protected function makeDir($directory)
    {
        if (!$this->filesystem->isDirectory($directory)) {
            $this->filesystem->makeDirectory($directory, 0777, true);
        }
    }