@@ -50,7 +50,7 @@ abstract class AbstractAdapter implements RendererInterface
5050 /**
5151 * Instance de Locator lorsque nous devons tenter de trouver une vue qui n'est pas à l'emplacement standard.
5252 */
53- protected ? LocatorInterface $ locator = null ;
53+ protected LocatorInterface $ locator ;
5454
5555 /**
5656 * Le nom de la mise en page utilisée, le cas échéant.
@@ -70,25 +70,19 @@ abstract class AbstractAdapter implements RendererInterface
7070 /**
7171 * {@inheritDoc}
7272 *
73- * @param array $config Configuration actuelle de l'adapter
74- * @param bool $debug Devrions-nous stocker des informations sur les performances ?
73+ * @param array $config Configuration actuelle de l'adapter
74+ * @param string|null $viewPath Dossier principal dans lequel les vues doivent être cherchées
75+ * @param bool $debug Devrions-nous stocker des informations sur les performances ?
7576 */
76- public function __construct (protected array $ config , $ viewPathLocator = null , protected bool $ debug = BLITZ_DEBUG )
77+ public function __construct (protected array $ config , $ viewPath = null , protected bool $ debug = BLITZ_DEBUG )
7778 {
7879 helper ('assets ' );
7980
80- if (! empty ($ viewPathLocator )) {
81- if (is_string ($ viewPathLocator )) {
82- $ this ->viewPath = rtrim ($ viewPathLocator , '\\/ ' ) . DS ;
83- } elseif ($ viewPathLocator instanceof LocatorInterface) {
84- $ this ->locator = $ viewPathLocator ;
85- }
81+ if (is_string ($ viewPath ) && is_dir ($ viewPath = rtrim ($ viewPath , '\\/ ' ) . DS )) {
82+ $ this ->viewPath = $ viewPath ;
8683 }
8784
88- if (! $ this ->locator instanceof LocatorInterface && ! is_dir ($ this ->viewPath )) {
89- $ this ->viewPath = '' ;
90- $ this ->locator = service ('locator ' );
91- }
85+ $ this ->locator = service ('locator ' );
9286
9387 $ this ->ext = preg_replace ('#^\.# ' , '' , $ config ['extension ' ] ?? $ this ->ext );
9488 }
@@ -264,7 +258,7 @@ protected function getRenderedFile(?array $options, string $view, ?string $ext =
264258
265259 $ file = Helpers::ensureExt ($ file , $ ext );
266260
267- if (! is_file ($ file ) && $ this -> locator instanceof LocatorInterface ) {
261+ if (! is_file ($ file )) {
268262 $ file = $ this ->locator ->locateFile ($ view , 'Views ' , $ ext );
269263 }
270264
0 commit comments