Sets the name of the file containing the includes patterns.

@param  PhingFile $incl The file to fetch the include patterns from.
@throws BuildException
489973
public function setIncludesfile(PhingFile $incl)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        $this->defaultPatterns->setIncludesFile($incl);
    }
553532
public function setSource($source)
    {
        if (is_string($source)) {
            $this->source = new PhingFile($source);
        } else {
            $this->source = $source;
        }
    }
634477
public function setExcludesfile($excl)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        $this->defaultPatterns->setExcludesFile($excl);
    }
1028904
private void cacheNameInternal(INode inode) {
    // Name is cached only for files
    if (inode.isDirectory()) {
      return;
    }
    ByteArray name = new ByteArray(inode.getLocalNameBytes());
    name = nameCache.put(name);
    if (name != null) {
      inode.setLocalName(name.getBytes());
    }
  }
1073578
public function setName($name = '')
    {
        if ('' == $name) {
            $name = 'Growl for Phing';
        }

        if (!is_string($name)) {
            throw new BuildException(
                '"name" attribute is invalid.' .
                ' Expect to be a string, actual is ' . gettype($name)
            );
        }

        $this->name = $name;
    }
1054408
public function setFile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->file = $file;
    }
1202605
private static function setIncludePaths()
    {
        if (defined('PHP_CLASSPATH')) {
            $result = set_include_path(PHP_CLASSPATH);
            if ($result === false) {
                throw new ConfigurationException("Could not set PHP include_path.");
            }
            self::$origIniSettings['include_path'] = $result; // save original value for setting back later
        }
    }
1341803
public function setCompileFile($filename)
    {
        $filename = (($this->compileFileNameMd5) ? md5(md5($filename)) : $filename);
        $this->templateCompileFile = $this->compilePath . $filename . $this->compileFileSuffix;
    }
897168
public function setSrcfile($file)
    {
        if (is_string($file)) {
            $this->inFile = new PhingFile($file);
        } else {
            $this->inFile = $file;
        }
    }
129876
public function setType($type)
    {
        $this->type = $type;

        switch ($this->type) {
            case 'pmd':
                if ($this->useFile === false) {
                    throw new BuildException('Formatter "' . $this->type . '" can only print the result to an file');
                }

                include_once 'phing/tasks/ext/phpcpd/formatter/PMDPHPCPDResultFormatter.php';

                $this->formatter = new PMDPHPCPDResultFormatter();
                break;

            case 'default':
                include_once 'phing/tasks/ext/phpcpd/formatter/DefaultPHPCPDResultFormatter.php';

                $this->formatter = new DefaultPHPCPDResultFormatter();
                break;

            default:
                throw new BuildException('Formatter "' . $this->type . '" not implemented');
        }
    }
684160
private function processFile()
    {
        $buildFailed = false;
        $savedDir = $this->dir;
        $savedPhingFile = $this->phingFile;
        $savedTarget = $this->newTarget;

        $savedBasedirAbsPath = null; // this is used to save the basedir *if* we change it

        try {
            $this->getNewProject();

            $this->initializeProject();

            if ($this->dir !== null) {
                $dirAbsPath = $this->dir->getAbsolutePath();

                // BE CAREFUL! -- when the basedir is changed for a project,
                // all calls to getAbsolutePath() on a relative-path dir will
                // be made relative to the project's basedir!  This means
                // that subsequent calls to $this->dir->getAbsolutePath() will be WRONG!

                // We need to save the current project's basedir first.
                $savedBasedirAbsPath = $this->getProject()->getBasedir()->getAbsolutePath();

                $this->newProject->setBasedir($this->dir);

                // Now we must reset $this->dir so that it continues to resolve to the same
                // path.
                $this->dir = new PhingFile($dirAbsPath);

                if ($savedDir !== null) { // has been set explicitly
                    $this->newProject->setInheritedProperty("project.basedir", $this->dir->getAbsolutePath());
                }
            } else {
                // Since we're not changing the basedir here (for file resolution),
                // we don't need to worry about any side-effects in this scanrio.
                $this->dir = $this->getProject()->getBasedir();
            }

            $this->overrideProperties();
            if ($this->phingFile === null) {
                $this->phingFile = "build.xml";
            }

            $fu = new FileUtils();
            $file = $fu->resolveFile($this->dir, $this->phingFile);
            $this->phingFile = $file->getAbsolutePath();

            $this->log(
                "Calling Buildfile '" . $this->phingFile . "' with target '" . $this->newTarget . "'",
                Project::MSG_VERBOSE
            );

            $this->newProject->setUserProperty("phing.file", $this->phingFile);

            ProjectConfigurator::configureProject($this->newProject, new PhingFile($this->phingFile));

            if ($this->newTarget === null) {
                $this->newTarget = $this->newProject->getDefaultTarget();
            }

            // Are we trying to call the target in which we are defined?
            if ($this->newProject->getBaseDir() == $this->project->getBaseDir()
                && $this->newProject->getProperty("phing.file") == $this->project->getProperty("phing.file")
                && $this->getOwningTarget() !== null
                && $this->newTarget == $this->getOwningTarget()->getName()
            ) {
                throw new BuildException("phing task calling its own parent target");
            }

            $this->addReferences();
            $this->newProject->executeTarget($this->newTarget);
        } catch (Exception $e) {
            $buildFailed = true;
            $this->log($e->getMessage(), Project::MSG_ERR);
            if (Phing::getMsgOutputLevel() <= Project::MSG_DEBUG) {
                $lines = explode("\n", $e->getTraceAsString());
                foreach ($lines as $line) {
                    $this->log($line, Project::MSG_DEBUG);
                }
            }
            // important!!! continue on to perform cleanup tasks.
        }

        // reset environment values to prevent side-effects.

        $this->newProject = null;
        $pkeys = array_keys($this->properties);
        foreach ($pkeys as $k) {
            $this->properties[$k]->setProject(null);
        }

        $this->dir = $savedDir;
        $this->phingFile = $savedPhingFile;
        $this->newTarget = $savedTarget;

        // If the basedir for any project was changed, we need to set that back here.
        if ($savedBasedirAbsPath !== null) {
            chdir($savedBasedirAbsPath);
        }

        if ($this->haltOnFailure && $buildFailed) {
            throw new BuildException("Execution of the target buildfile failed. Aborting.");
        }
    }
562349
protected function getMappedFile($from)
    {
        if (!$this->mapperElement) {
            throw new BuildException("This task requires you to use a <mapper/> element to describe how filename changes should be handled.");
        }

        $mapper = $this->mapperElement->getImplementation();
        $mapped = $mapper->main($from);
        if (!$mapped) {
            throw new BuildException("Cannot create new filename based on: " . $from);
        }
        // Mappers always return arrays since it's possible for some mappers to map to multiple names.
        $outFilename = array_shift($mapped);
        $outFile = new PhingFile($this->getOutputDirectory(), $outFilename);

        return $outFile;
    }
810377
public function main()
    {
        if ($this->prefix != null && $this->regex != null) {
            throw new BuildException("Please specify either prefix or regex, but not both", $this->getLocation());
        }

        //copy the properties file
        $allProps = [];

        /* load properties from file if specified, otherwise use Phing's properties */
        if ($this->inFile == null) {
            // add phing properties
            $allProps = $this->getProject()->getProperties();
        } elseif ($this->inFile != null) {
            if ($this->inFile->exists() && $this->inFile->isDirectory()) {
                $message = "srcfile is a directory!";
                $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                return;
            }

            if ($this->inFile->exists() && !$this->inFile->canRead()) {
                $message = "Can not read from the specified srcfile!";
                $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                return;
            }

            try {
                $props = new Properties();
                $props->load(new PhingFile($this->inFile));
                $allProps = $props->getProperties();
            } catch (IOException $ioe) {
                $message = "Could not read file " . $this->inFile->getAbsolutePath();
                $this->failOnErrorAction($ioe, $message, Project::MSG_WARN);
                return;
            }
        }

        $os = null;
        try {
            if ($this->destfile == null) {
                $os = Phing::getOutputStream();
                $this->saveProperties($allProps, $os);
                $this->log($os, Project::MSG_INFO);
            } else {
                if ($this->destfile->exists() && $this->destfile->isDirectory()) {
                    $message = "destfile is a directory!";
                    $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                    return;
                }

                if ($this->destfile->exists() && !$this->destfile->canWrite()) {
                    $message = "Can not write to the specified destfile!";
                    $this->failOnErrorAction(null, $message, Project::MSG_ERR);
                    return;
                }
                $os = new FileOutputStream($this->destfile);
                $this->saveProperties($allProps, $os);
            }
        } catch (IOException $ioe) {
            $this->failOnErrorAction($ioe);
        }
    }
677837
public function setIncludes($includes)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        if ($includes !== null && strlen($includes) > 0) {
            $tok = strtok($includes, ", ");
            while ($tok !== false) {
                $o = $this->createInclude();
                $o->setName($tok);
                $tok = strtok(", ");
            }
        }
    }
310659
private function setCodeFile()
    {
        $this->findTemplate();
        $this->_codeFile = $this->getPhpCodeDestination() . $this->getFunctionName() . '.' . $this->getPhpCodeExtension();
    }
843705
public function setFileName($fileName)
    {
        $this->fileName = $fileName;
        $this->setContentType(mime_content_type($this->fileName));
    }
491798
public function setDescFile($descfile)
    {
        if ($descfile != '' && !file_exists($descfile)) {
            throw new BuildException(
                'PEAR package xml file "' . $descfile . '" does not exist'
            );
        }

        $this->packageFile = $descfile;
    }