original_string: public function addLocation($scope, $path)
      {
          if ($path instanceof SplFileInfo) {
              $path = array('base' => $path->getPathname());
          } else if (is_string($path)) {
              if ($path == '') {
                  throw new InvalidArgumentException('Invalid resource path: path must not be empty.');
              }
  
              $path = array('base' => $path);
          } else if (!is_array($path) && !($path instanceof \ArrayAccess)) {
              throw new InvalidArgumentException('Invalid path');
          }
  
          foreach ($this->types as $type) {
              if (isset($path[$type])) {
                  $this->locations[$scope][$type] = $path[$type];
  
                  if ($type != 'base') {
                      unset($path[$type]);
                  }
  
                  continue;
              }
  
              if (!isset($path['base'])) {
                  if (!isset($this->locations[$scope]['base'])) {
                      continue;
                  }
  
                  $path['base'] = $this->locations[$scope]['base'];
              }
  
              $this->locations[$scope][$type] = $path['base'] . '/' . $type;
          }
  
          unset($path['base']);
  
          foreach ($path as $type => $extraPath) {
              $this->locations[$scope][$type] = $extraPath;
          }
  
          return $this;
      }
code: public function addLocation($scope, $path)
      {
          if ($path instanceof SplFileInfo) {
              $path = array('base' => $path->getPathname());
          } else if (is_string($path)) {
              if ($path == '') {
                  throw new InvalidArgumentException('Invalid resource path: path must not be empty.');
              }
  
              $path = array('base' => $path);
          } else if (!is_array($path) && !($path instanceof \ArrayAccess)) {
              throw new InvalidArgumentException('Invalid path');
          }
  
          foreach ($this->types as $type) {
              if (isset($path[$type])) {
                  $this->locations[$scope][$type] = $path[$type];
  
                  if ($type != 'base') {
                      unset($path[$type]);
                  }
  
                  continue;
              }
  
              if (!isset($path['base'])) {
                  if (!isset($this->locations[$scope]['base'])) {
                      continue;
                  }
  
                  $path['base'] = $this->locations[$scope]['base'];
              }
  
              $this->locations[$scope][$type] = $path['base'] . '/' . $type;
          }
  
          unset($path['base']);
  
          foreach ($path as $type => $extraPath) {
              $this->locations[$scope][$type] = $extraPath;
          }
  
          return $this;
      }
code_tokens: public function addLocation ( $ scope , $ path ) { if ( $ path instanceof SplFileInfo ) { $ path = array ( 'base' => $ path -> getPathname ( ) ) ; } else if ( is_string ( $ path ) ) { if ( $ path == '' ) { throw new InvalidArgumentException ( 'Invalid resource path: path must not be empty.' ) ; } $ path = array ( 'base' => $ path ) ; } else if ( ! is_array ( $ path ) && ! ( $ path instanceof \ ArrayAccess ) ) { throw new InvalidArgumentException ( 'Invalid path' ) ; } foreach ( $ this -> types as $ type ) { if ( isset ( $ path [ $ type ] ) ) { $ this -> locations [ $ scope ] [ $ type ] = $ path [ $ type ] ; if ( $ type != 'base' ) { unset ( $ path [ $ type ] ) ; } continue ; } if ( ! isset ( $ path [ 'base' ] ) ) { if ( ! isset ( $ this -> locations [ $ scope ] [ 'base' ] ) ) { continue ; } $ path [ 'base' ] = $ this -> locations [ $ scope ] [ 'base' ] ; } $ this -> locations [ $ scope ] [ $ type ] = $ path [ 'base' ] . '/' . $ type ; } unset ( $ path [ 'base' ] ) ; foreach ( $ path as $ type => $ extraPath ) { $ this -> locations [ $ scope ] [ $ type ] = $ extraPath ; } return $ this ; }
docstring: Add a location
  
  @param string $scope
  @param string|array $path
docstring_tokens: Add a location