original_string: public static function forTheme($theme)
      {
          $dirName = $theme->getDirName();
          if ($themeData = array_get(self::$instances, $dirName)) {
              return $themeData;
          }
  
          try {
              $themeData = self::firstOrCreate(['theme' => $dirName]);
          }
          catch (Exception $ex) {
              // Database failed
              $themeData = new self(['theme' => $dirName]);
          }
  
          return self::$instances[$dirName] = $themeData;
      }
code: public static function forTheme($theme)
      {
          $dirName = $theme->getDirName();
          if ($themeData = array_get(self::$instances, $dirName)) {
              return $themeData;
          }
  
          try {
              $themeData = self::firstOrCreate(['theme' => $dirName]);
          }
          catch (Exception $ex) {
              // Database failed
              $themeData = new self(['theme' => $dirName]);
          }
  
          return self::$instances[$dirName] = $themeData;
      }
code_tokens: public static function forTheme ( $ theme ) { $ dirName = $ theme -> getDirName ( ) ; if ( $ themeData = array_get ( self :: $ instances , $ dirName ) ) { return $ themeData ; } try { $ themeData = self :: firstOrCreate ( [ 'theme' => $ dirName ] ) ; } catch ( Exception $ ex ) { // Database failed $ themeData = new self ( [ 'theme' => $ dirName ] ) ; } return self :: $ instances [ $ dirName ] = $ themeData ; }
docstring: Returns a cached version of this model, based on a Theme object.
  @param $theme Cms\Classes\Theme
  @return self
docstring_tokens: Returns a cached version of this model based on a Theme object .