code: protected function createTemplatesDirIterator($templatesDir)
      {
          if (empty($templatesDir) || !is_dir($templatesDir)) {
              throw new \Exception('Invalid templates directory provided');
          }
  
          $this->directoryIterator = new DirectoryIterator(rtrim($templatesDir, '/'));
      }
docs: Sets the class property $templatesDirectoryPath
  
  @param string $templatesDir ; The path to the template files directory
  @throws \Exception