src/Textpattern/Composer/Installer/Plugin/Manifest.php
protected function code()
    {
        $files = $out = [];

        if (isset($this->manifest->code->file)) {
            $files = array_map([$this, 'path'], (array) $this->manifest->code->file);
        } else {
            if (($cwd = getcwd()) !== false && chdir($this->dir)) {
                $files = (array) glob('*.php');
            }
        }

        $pathFrom = (string) new FindTextpattern() . '/index.php';

        foreach ($files as $path) {
            if (file_exists($path) && is_file($path) && is_readable($path)) {
                $includePath = $this->getRelativePath($pathFrom, realpath($path));

                if ($includePath !== $path) {
                    $out[] = "include txpath.'/".addslashes($includePath)."';";
                } else {
                    $out[] = "include '".addslashes($includePath)."';";
                }
            }
        }

        if (isset($cwd) && $cwd !== false) {
            chdir($cwd);
        }

        return implode("\n", $out);
    }
protected function code()
    {
        $files = $out = [];

        if (isset($this->manifest->code->file)) {
            $files = array_map([$this, 'path'], (array) $this->manifest->code->file);
        } else {
            if (($cwd = getcwd()) !== false && chdir($this->dir)) {
                $files = (array) glob('*.php');
            }
        }

        $pathFrom = (string) new FindTextpattern() . '/index.php';

        foreach ($files as $path) {
            if (file_exists($path) && is_file($path) && is_readable($path)) {
                $includePath = $this->getRelativePath($pathFrom, realpath($path));

                if ($includePath !== $path) {
                    $out[] = "include txpath.'/".addslashes($includePath)."';";
                } else {
                    $out[] = "include '".addslashes($includePath)."';";
                }
            }
        }

        if (isset($cwd) && $cwd !== false) {
            chdir($cwd);
        }

        return implode("\n", $out);
    }
protected function code ( ) { $ files = $ out = [ ] ; if ( isset ( $ this -> manifest -> code -> file ) ) { $ files = array_map ( [ $ this , 'path' ] , ( array ) $ this -> manifest -> code -> file ) ; } else { if ( ( $ cwd = getcwd ( ) ) !== false && chdir ( $ this -> dir ) ) { $ files = ( array ) glob ( '*.php' ) ; } } $ pathFrom = ( string ) new FindTextpattern ( ) . '/index.php' ; foreach ( $ files as $ path ) { if ( file_exists ( $ path ) && is_file ( $ path ) && is_readable ( $ path ) ) { $ includePath = $ this -> getRelativePath ( $ pathFrom , realpath ( $ path ) ) ; if ( $ includePath !== $ path ) { $ out [ ] = "include txpath.'/" . addslashes ( $ includePath ) . "';" ; } else { $ out [ ] = "include '" . addslashes ( $ includePath ) . "';" ; } } } if ( isset ( $ cwd ) && $ cwd !== false ) { chdir ( $ cwd ) ; } return implode ( "\n" , $ out ) ; }
Plugin code template.

Generates PHP source code that either imports
.php files in the directory or the files
specified with the 'file' property of 'code'.

@return string
Plugin code template .