classes/phing/tasks/system/AppendTask.php
private function appendFiles(Writer $writer, $files, PhingFile $dir = null)
    {
        if (!empty($files)) {
            $this->log(
                "Attempting to append " . count(
                    $files
                ) . " files" . ($dir !== null ? ", using basedir " . $dir->getPath() : "")
            );
            $basenameSlot = Register::getSlot("task.append.current_file");
            $pathSlot = Register::getSlot("task.append.current_file.path");
            foreach ($files as $file) {
                try {
                    if (!$this->checkFilename($file, $dir)) {
                        continue;
                    }

                    if ($dir !== null) {
                        $file = is_string($file) ? new PhingFile($dir->getPath(), $file) : $file;
                    } else {
                        $file = is_string($file) ? new PhingFile($file) : $file;
                    }
                    $basenameSlot->setValue($file);
                    $pathSlot->setValue($file->getPath());
                    $this->appendFile($writer, $file);
                } catch (IOException $ioe) {
                    $this->log(
                        "Unable to append contents of file " . $file . ": " . $ioe->getMessage(),
                        Project::MSG_WARN
                    );
                } catch (NullPointerException $npe) {
                    $this->log(
                        "Unable to append contents of file " . $file . ": " . $npe->getMessage(),
                        Project::MSG_WARN
                    );
                }
            }
        }
    }
private function appendFiles(Writer $writer, $files, PhingFile $dir = null)
    {
        if (!empty($files)) {
            $this->log(
                "Attempting to append " . count(
                    $files
                ) . " files" . ($dir !== null ? ", using basedir " . $dir->getPath() : "")
            );
            $basenameSlot = Register::getSlot("task.append.current_file");
            $pathSlot = Register::getSlot("task.append.current_file.path");
            foreach ($files as $file) {
                try {
                    if (!$this->checkFilename($file, $dir)) {
                        continue;
                    }

                    if ($dir !== null) {
                        $file = is_string($file) ? new PhingFile($dir->getPath(), $file) : $file;
                    } else {
                        $file = is_string($file) ? new PhingFile($file) : $file;
                    }
                    $basenameSlot->setValue($file);
                    $pathSlot->setValue($file->getPath());
                    $this->appendFile($writer, $file);
                } catch (IOException $ioe) {
                    $this->log(
                        "Unable to append contents of file " . $file . ": " . $ioe->getMessage(),
                        Project::MSG_WARN
                    );
                } catch (NullPointerException $npe) {
                    $this->log(
                        "Unable to append contents of file " . $file . ": " . $npe->getMessage(),
                        Project::MSG_WARN
                    );
                }
            }
        }
    }
private function appendFiles ( Writer $ writer , $ files , PhingFile $ dir = null ) { if ( ! empty ( $ files ) ) { $ this -> log ( "Attempting to append " . count ( $ files ) . " files" . ( $ dir !== null ? ", using basedir " . $ dir -> getPath ( ) : "" ) ) ; $ basenameSlot = Register :: getSlot ( "task.append.current_file" ) ; $ pathSlot = Register :: getSlot ( "task.append.current_file.path" ) ; foreach ( $ files as $ file ) { try { if ( ! $ this -> checkFilename ( $ file , $ dir ) ) { continue ; } if ( $ dir !== null ) { $ file = is_string ( $ file ) ? new PhingFile ( $ dir -> getPath ( ) , $ file ) : $ file ; } else { $ file = is_string ( $ file ) ? new PhingFile ( $ file ) : $ file ; } $ basenameSlot -> setValue ( $ file ) ; $ pathSlot -> setValue ( $ file -> getPath ( ) ) ; $ this -> appendFile ( $ writer , $ file ) ; } catch ( IOException $ ioe ) { $ this -> log ( "Unable to append contents of file " . $ file . ": " . $ ioe -> getMessage ( ) , Project :: MSG_WARN ) ; } catch ( NullPointerException $ npe ) { $ this -> log ( "Unable to append contents of file " . $ file . ": " . $ npe -> getMessage ( ) , Project :: MSG_WARN ) ; } } } }
Append an array of files in a directory.

@param Writer $writer The FileWriter that is appending to target file.
@param array $files array of files to delete; can be of zero length
@param PhingFile $dir directory to work from

@return void
Append an array of files in a directory .