original_string: public static function resolve($name)
      {
          $logger     = $GLOBALS['logger'];
          $app        = $GLOBALS['app'];
          $staticPath = 'public';
          
          if ($app->getConfiguration()->isLocal()) {
              $staticPath = 'views';
          }
  
          $session    = $app->getSessionManager()->getActiveSession();
          $category   = $session->getAttribute('category');
          $basePath   = '/'.$staticPath.'/resources/'.$category;
          $commonPath = '/'.$staticPath.'/resources/common';
  
          $searchFolder = '.';
          
          $isUrl = false;
  
          if(preg_match('/.*\.js$/', $name)) {
              $searchFolder = 'scripts';
          } else if(preg_match('/.*\.css$/', $name)) {
              $searchFolder = 'styles';
          } else if(preg_match('/.*\.(?:jpg|jpeg|gif|png)$/', $name)) {
              $searchFolder = 'images';
          } else {
              $isUrl = true;
              $name  = DIRECTORY_SEPARATOR.$app->getConfiguration()->getApplicationContext().DIRECTORY_SEPARATOR.$name;
          }
  
          if ($isUrl) {
              return $name;
          }
  
          if (file_exists(getcwd().$basePath.'/'.$searchFolder.'/'.$name)) {
              return '/'.$app->getConfiguration()->getApplicationContext().$basePath.'/'.$searchFolder.'/'.$name;
          } else if (file_exists(getcwd().$commonPath.'/'.$searchFolder.'/'.$name)) {
              return '/'.$app->getConfiguration()->getApplicationContext().$commonPath.'/'.$searchFolder.'/'.$name;
          }
          return $name;
      }
code: public static function resolve($name)
      {
          $logger     = $GLOBALS['logger'];
          $app        = $GLOBALS['app'];
          $staticPath = 'public';
          
          if ($app->getConfiguration()->isLocal()) {
              $staticPath = 'views';
          }
  
          $session    = $app->getSessionManager()->getActiveSession();
          $category   = $session->getAttribute('category');
          $basePath   = '/'.$staticPath.'/resources/'.$category;
          $commonPath = '/'.$staticPath.'/resources/common';
  
          $searchFolder = '.';
          
          $isUrl = false;
  
          if(preg_match('/.*\.js$/', $name)) {
              $searchFolder = 'scripts';
          } else if(preg_match('/.*\.css$/', $name)) {
              $searchFolder = 'styles';
          } else if(preg_match('/.*\.(?:jpg|jpeg|gif|png)$/', $name)) {
              $searchFolder = 'images';
          } else {
              $isUrl = true;
              $name  = DIRECTORY_SEPARATOR.$app->getConfiguration()->getApplicationContext().DIRECTORY_SEPARATOR.$name;
          }
  
          if ($isUrl) {
              return $name;
          }
  
          if (file_exists(getcwd().$basePath.'/'.$searchFolder.'/'.$name)) {
              return '/'.$app->getConfiguration()->getApplicationContext().$basePath.'/'.$searchFolder.'/'.$name;
          } else if (file_exists(getcwd().$commonPath.'/'.$searchFolder.'/'.$name)) {
              return '/'.$app->getConfiguration()->getApplicationContext().$commonPath.'/'.$searchFolder.'/'.$name;
          }
          return $name;
      }
code_tokens: public static function resolve ( $ name ) { $ logger = $ GLOBALS [ 'logger' ] ; $ app = $ GLOBALS [ 'app' ] ; $ staticPath = 'public' ; if ( $ app -> getConfiguration ( ) -> isLocal ( ) ) { $ staticPath = 'views' ; } $ session = $ app -> getSessionManager ( ) -> getActiveSession ( ) ; $ category = $ session -> getAttribute ( 'category' ) ; $ basePath = '/' . $ staticPath . '/resources/' . $ category ; $ commonPath = '/' . $ staticPath . '/resources/common' ; $ searchFolder = '.' ; $ isUrl = false ; if ( preg_match ( '/.*\.js$/' , $ name ) ) { $ searchFolder = 'scripts' ; } else if ( preg_match ( '/.*\.css$/' , $ name ) ) { $ searchFolder = 'styles' ; } else if ( preg_match ( '/.*\.(?:jpg|jpeg|gif|png)$/' , $ name ) ) { $ searchFolder = 'images' ; } else { $ isUrl = true ; $ name = DIRECTORY_SEPARATOR . $ app -> getConfiguration ( ) -> getApplicationContext ( ) . DIRECTORY_SEPARATOR . $ name ; } if ( $ isUrl ) { return $ name ; } if ( file_exists ( getcwd ( ) . $ basePath . '/' . $ searchFolder . '/' . $ name ) ) { return '/' . $ app -> getConfiguration ( ) -> getApplicationContext ( ) . $ basePath . '/' . $ searchFolder . '/' . $ name ; } else if ( file_exists ( getcwd ( ) . $ commonPath . '/' . $ searchFolder . '/' . $ name ) ) { return '/' . $ app -> getConfiguration ( ) -> getApplicationContext ( ) . $ commonPath . '/' . $ searchFolder . '/' . $ name ; } return $ name ; }
docstring: Resolve Script Path based on name.
  
  @param mixed $name Name of the script to resolve.
  
  @access public
  @return void
docstring_tokens: Resolve Script Path based on name .