original_string: protected function is_valid_file($path) {
          global $CFG;
  
          $realpath = realpath($path);
  
          // Additional theme directory.
          $addthemedirectory = core_component::get_plugin_types()['theme'];
          $addrealroot = realpath($addthemedirectory);
  
          // Original theme directory.
          $themedirectory = $CFG->dirroot . "/theme";
          $realroot = realpath($themedirectory);
  
          // File should end in .scss and must be in sites theme directory, else ignore it.
          $pathvalid = $realpath !== false;
          $pathvalid = $pathvalid && (substr($path, -5) === '.scss');
          $pathvalid = $pathvalid && (strpos($realpath, $realroot) === 0 || strpos($realpath, $addrealroot) === 0);
          return $pathvalid;
      }
code: protected function is_valid_file($path) {
          global $CFG;
  
          $realpath = realpath($path);
  
          // Additional theme directory.
          $addthemedirectory = core_component::get_plugin_types()['theme'];
          $addrealroot = realpath($addthemedirectory);
  
          // Original theme directory.
          $themedirectory = $CFG->dirroot . "/theme";
          $realroot = realpath($themedirectory);
  
          // File should end in .scss and must be in sites theme directory, else ignore it.
          $pathvalid = $realpath !== false;
          $pathvalid = $pathvalid && (substr($path, -5) === '.scss');
          $pathvalid = $pathvalid && (strpos($realpath, $realroot) === 0 || strpos($realpath, $addrealroot) === 0);
          return $pathvalid;
      }
code_tokens: protected function is_valid_file ( $ path ) { global $ CFG ; $ realpath = realpath ( $ path ) ; // Additional theme directory. $ addthemedirectory = core_component :: get_plugin_types ( ) [ 'theme' ] ; $ addrealroot = realpath ( $ addthemedirectory ) ; // Original theme directory. $ themedirectory = $ CFG -> dirroot . "/theme" ; $ realroot = realpath ( $ themedirectory ) ; // File should end in .scss and must be in sites theme directory, else ignore it. $ pathvalid = $ realpath !== false ; $ pathvalid = $ pathvalid && ( substr ( $ path , - 5 ) === '.scss' ) ; $ pathvalid = $ pathvalid && ( strpos ( $ realpath , $ realroot ) === 0 || strpos ( $ realpath , $ addrealroot ) === 0 ) ; return $ pathvalid ; }
docstring: Is the given file valid for import ?
  
  @param $path
  @return bool
docstring_tokens: Is the given file valid for import ?