original_string: private function dispatchEvent($eventType, $filePath)
      {
          if (null !== $this->eventDispatcher) {
              $relativePath = $this->fs->makePathRelative(dirname($filePath), $this->root) . basename($filePath);
              $this->eventDispatcher->dispatch(
                  $eventType,
                  new ResourceEvent($relativePath, $this->httpRoot, $this->root)
              );
  
              if (null !== $this->imagineConfig) {
                  if (false !== strpos($relativePath, '/../') || 0 === strpos($relativePath, '../')) {
                      // outside web root, stop.
                      return;
                  }
  
                  // Create events for the imagine cache as well.
  
                  /** @var CacheManager $cacheManager */
                  /** @var FilterConfiguration $filterConfig */
                  list ($cacheManager, $filterConfig) = $this->imagineConfig;
                  $webPath = $this->httpRoot . '/' . $relativePath;
                  $cacheManager->remove($webPath);
  
                  foreach ($filterConfig->all() as $name => $filter) {
                      $url = $cacheManager->resolve($webPath, $name);
  
                      // this weird construct is here because the imagine cache manager generates absolute urls
                      // even though they're local for some unapparent reason.
                      $relativeUrl = parse_url($url, PHP_URL_PATH);
                      $url = $this->fs->makePathRelative(dirname($relativeUrl), $this->httpRoot) . basename($relativeUrl);
  
                      if (false === strpos($url, '../')) {
                          $this->eventDispatcher->dispatch(
                              $eventType,
                              new ResourceEvent($url, $this->httpRoot, $this->root)
                          );
                      }
                  }
              }
          }
      }
code: private function dispatchEvent($eventType, $filePath)
      {
          if (null !== $this->eventDispatcher) {
              $relativePath = $this->fs->makePathRelative(dirname($filePath), $this->root) . basename($filePath);
              $this->eventDispatcher->dispatch(
                  $eventType,
                  new ResourceEvent($relativePath, $this->httpRoot, $this->root)
              );
  
              if (null !== $this->imagineConfig) {
                  if (false !== strpos($relativePath, '/../') || 0 === strpos($relativePath, '../')) {
                      // outside web root, stop.
                      return;
                  }
  
                  // Create events for the imagine cache as well.
  
                  /** @var CacheManager $cacheManager */
                  /** @var FilterConfiguration $filterConfig */
                  list ($cacheManager, $filterConfig) = $this->imagineConfig;
                  $webPath = $this->httpRoot . '/' . $relativePath;
                  $cacheManager->remove($webPath);
  
                  foreach ($filterConfig->all() as $name => $filter) {
                      $url = $cacheManager->resolve($webPath, $name);
  
                      // this weird construct is here because the imagine cache manager generates absolute urls
                      // even though they're local for some unapparent reason.
                      $relativeUrl = parse_url($url, PHP_URL_PATH);
                      $url = $this->fs->makePathRelative(dirname($relativeUrl), $this->httpRoot) . basename($relativeUrl);
  
                      if (false === strpos($url, '../')) {
                          $this->eventDispatcher->dispatch(
                              $eventType,
                              new ResourceEvent($url, $this->httpRoot, $this->root)
                          );
                      }
                  }
              }
          }
      }
code_tokens: private function dispatchEvent ( $ eventType , $ filePath ) { if ( null !== $ this -> eventDispatcher ) { $ relativePath = $ this -> fs -> makePathRelative ( dirname ( $ filePath ) , $ this -> root ) . basename ( $ filePath ) ; $ this -> eventDispatcher -> dispatch ( $ eventType , new ResourceEvent ( $ relativePath , $ this -> httpRoot , $ this -> root ) ) ; if ( null !== $ this -> imagineConfig ) { if ( false !== strpos ( $ relativePath , '/../' ) || 0 === strpos ( $ relativePath , '../' ) ) { // outside web root, stop. return ; } // Create events for the imagine cache as well. /** @var CacheManager $cacheManager */ /** @var FilterConfiguration $filterConfig */ list ( $ cacheManager , $ filterConfig ) = $ this -> imagineConfig ; $ webPath = $ this -> httpRoot . '/' . $ relativePath ; $ cacheManager -> remove ( $ webPath ) ; foreach ( $ filterConfig -> all ( ) as $ name => $ filter ) { $ url = $ cacheManager -> resolve ( $ webPath , $ name ) ; // this weird construct is here because the imagine cache manager generates absolute urls // even though they're local for some unapparent reason. $ relativeUrl = parse_url ( $ url , PHP_URL_PATH ) ; $ url = $ this -> fs -> makePathRelative ( dirname ( $ relativeUrl ) , $ this -> httpRoot ) . basename ( $ relativeUrl ) ; if ( false === strpos ( $ url , '../' ) ) { $ this -> eventDispatcher -> dispatch ( $ eventType , new ResourceEvent ( $ url , $ this -> httpRoot , $ this -> root ) ) ; } } } } }
docstring: Dispatch an event for changed resources
  
  @param string $eventType
  @param string $filePath
docstring_tokens: Dispatch an event for changed resources