pathRegistered[ $namespace ] = $path; } public function getFile( string $filePath ) : ?string { $content = null; if ( ! is_array( $this->pathRegistered ) || count( $this->pathRegistered ) == 0 ) { debug_print_backtrace(); throw new \Exception("can't have bakuba folder not defined."); } foreach( $this->pathRegistered as $registeredNamespace => $registeredPath ) { //if ( substr( $filePath, 0, 7 ) == "file://" ) // $filePath = str_replace( "file://bakuba", $registeredPath, $filePath ); $realfilePath = \str_replace( "file://", "{$registeredPath}/../", $filePath ); //if ( defined("logByEcho") ) echo "[ standalone\DwAutoLoadFile::getFile] {$realfilePath}".\PHP_EOL; if ( \file_exists( $realfilePath ) ) $content = \file_get_contents( $realfilePath ); } return $content; } public function isFile( string $path ) : bool { $isAnFile = false; foreach( $this->pathRegistered as $registeredNamespace => $registeredPath ) if ( true == ( $isAnFile = \is_file( "{$registeredPath}/../$path" ) ) ) break; return $isAnFile; ; } public function isDir( string $path ) : bool { $isAnDir = false; foreach( $this->pathRegistered as $registeredNamespace => $registeredPath ) if ( true == ( $isAnDir =\is_dir( "{$registeredPath}/../$path" ) ) ) break; return $isAnDir; } public function scandir( string $folder ) : ?array { $return = null; $elements=null; foreach( $this->pathRegistered as $registeredNamespace => $registeredPath ) { if (is_dir( "{$registeredPath}/../$folder" ) ) { $elements = \scandir( "{$registeredPath}/..$folder" ); if ( \is_array( $elements ) ) $return = $elements; break; } } return $return; } ///* public function getLogDir() : string { //throw new \Exception(" no get Log dir "); //return "{$this->bakubaFolder}/../log/bakuba"; return \bakuba\kernel\agartha\DwInstall::getLocalDirectory( "./bakubaLog" ); } //*/ ///* public function __destruct() { //$this->log->trace( "." ); parent::__destruct(); foreach( $this as $key => $toDestruct ) if ( isset( $this->$key ) ) unset( $this->$key ); } //*/ public function getClassName( bool $fqcn=null ) : string { return self::getStaticClassName( $fqcn ); } public static function getStaticClassName( bool $fqcn=null ) : string { return $fqcn ? parent::getStaticClassName( $fqcn ).self::CLASS_SEPARATOR.__CLASS__ : __CLASS__ ; } } ?>