Package com.dubture.getcomposer.core.objects

Examples of com.dubture.getcomposer.core.objects.Autoload


    }

    @Override
    public IPath resolve(IResource resource)
    {
        Autoload autoload = phpPackage.getAutoload();
       
        if (autoload == null || autoload.getPsr0() == null || autoload.getPsr0().getFirst() == null) {
            Logger.debug("Unable to resolve namespace without autoload information " + phpPackage.getName());
            return null;
        }
        
        String targetDir = phpPackage.getTargetDir();
        IPath ns = null;
        IPath path = resource.getFullPath();
        IPath composerPath = getPath();
       
       
        IPath psr0Path = composerPath.append(autoload.getPsr0().getFirst().getNamespace());
        int segments = psr0Path.segmentCount();
        
        if (path.matchingFirstSegments(psr0Path) == segments) {
            
            if (targetDir != null && targetDir.length() > 0) {
View Full Code Here


    return new ComposerPackages();
  }

  @Override
  public String getNamespace(IPath path) {
    Autoload autoload = getComposerPackage().getAutoload();

    // look for psr4 first
    String namespace = getPsrNamespace(path, autoload.getPsr4());
   
    if (namespace == null) {
      namespace = getPsrNamespace(path, autoload.getPsr0());
    }
   
    return namespace;
  }
View Full Code Here

  private void parsePackage(ComposerPackage pkg, List<String> paths, String prefix) {
    if (prefix != null && !prefix.equals("") && !prefix.endsWith("/")) {
      prefix += "/";
    }

    Autoload a = pkg.getAutoload();

    // psr-0
    for (Namespace namespace : a.getPsr0()) {
      for (Object path : namespace.getPaths()) {
        addPath(prefix + path, paths);
      }
    }

    // psr-4
    for (Namespace namespace : a.getPsr4()) {
      for (Object path : namespace.getPaths()) {
        addPath(prefix + path, paths);
      }
    }

    // classmap
    for (Object path : a.getClassMap()) {
      String cleanedPath = getDirectory(prefix + (String) path);
      addPath(cleanedPath, paths);
    }

    // files
    for (Object path : a.getFiles()) {
      String cleanedPath = getDirectory(prefix + (String) path);
      addPath(cleanedPath, paths);
    }
  }
View Full Code Here

TOP

Related Classes of com.dubture.getcomposer.core.objects.Autoload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.