classes/phing/types/Mapper.php
public function getImplementation()
    {
        if ($this->isReference()) {
            $o = $this->getRef();
            if ($o instanceof FileNameMapper) {
                return $o;
            }
            if ($o instanceof Mapper) {
                return $o->getImplementation();
            }

            $od = $o == null ? "null" : get_class($o);
            throw new BuildException($od . " at reference '" . $r->getRefId() . "' is not a valid mapper reference.");
        }

        if ($this->type === null && $this->classname === null && $this->container == null) {
            throw new BuildException("either type or classname attribute must be set for <mapper>");
        }

        if ($this->container != null) {
            return $this->container;
        }

        if ($this->type !== null) {
            switch ($this->type) {
                case 'chained':
                    $this->classname = 'phing.mappers.ChainedMapper';
                    break;
                case 'composite':
                    $this->classname = 'phing.mappers.CompositeMapper';
                    break;
                case 'cutdirs':
                    $this->classname = 'phing.mappers.CutDirsMapper';
                    break;
                case 'identity':
                    $this->classname = 'phing.mappers.IdentityMapper';
                    break;
                case 'firstmatch':
                    $this->classname = 'phing.mappers.FirstMatchMapper';
                    break;
                case 'flatten':
                    $this->classname = 'phing.mappers.FlattenMapper';
                    break;
                case 'glob':
                    $this->classname = 'phing.mappers.GlobMapper';
                    break;
                case 'regexp':
                case 'regex':
                    $this->classname = 'phing.mappers.RegexpMapper';
                    break;
                case 'merge':
                    $this->classname = 'phing.mappers.MergeMapper';
                    break;
                default:
                    throw new BuildException("Mapper type {$this->type} not known");
                    break;
            }
        }

        // get the implementing class
        $cls = Phing::import($this->classname, $this->classpath);

        $m = new $cls();
        $m->setFrom($this->from);
        $m->setTo($this->to);

        return $m;
    }
public function getImplementation()
    {
        if ($this->isReference()) {
            $o = $this->getRef();
            if ($o instanceof FileNameMapper) {
                return $o;
            }
            if ($o instanceof Mapper) {
                return $o->getImplementation();
            }

            $od = $o == null ? "null" : get_class($o);
            throw new BuildException($od . " at reference '" . $r->getRefId() . "' is not a valid mapper reference.");
        }

        if ($this->type === null && $this->classname === null && $this->container == null) {
            throw new BuildException("either type or classname attribute must be set for <mapper>");
        }

        if ($this->container != null) {
            return $this->container;
        }

        if ($this->type !== null) {
            switch ($this->type) {
                case 'chained':
                    $this->classname = 'phing.mappers.ChainedMapper';
                    break;
                case 'composite':
                    $this->classname = 'phing.mappers.CompositeMapper';
                    break;
                case 'cutdirs':
                    $this->classname = 'phing.mappers.CutDirsMapper';
                    break;
                case 'identity':
                    $this->classname = 'phing.mappers.IdentityMapper';
                    break;
                case 'firstmatch':
                    $this->classname = 'phing.mappers.FirstMatchMapper';
                    break;
                case 'flatten':
                    $this->classname = 'phing.mappers.FlattenMapper';
                    break;
                case 'glob':
                    $this->classname = 'phing.mappers.GlobMapper';
                    break;
                case 'regexp':
                case 'regex':
                    $this->classname = 'phing.mappers.RegexpMapper';
                    break;
                case 'merge':
                    $this->classname = 'phing.mappers.MergeMapper';
                    break;
                default:
                    throw new BuildException("Mapper type {$this->type} not known");
                    break;
            }
        }

        // get the implementing class
        $cls = Phing::import($this->classname, $this->classpath);

        $m = new $cls();
        $m->setFrom($this->from);
        $m->setTo($this->to);

        return $m;
    }
public function getImplementation ( ) { if ( $ this -> isReference ( ) ) { $ o = $ this -> getRef ( ) ; if ( $ o instanceof FileNameMapper ) { return $ o ; } if ( $ o instanceof Mapper ) { return $ o -> getImplementation ( ) ; } $ od = $ o == null ? "null" : get_class ( $ o ) ; throw new BuildException ( $ od . " at reference '" . $ r -> getRefId ( ) . "' is not a valid mapper reference." ) ; } if ( $ this -> type === null && $ this -> classname === null && $ this -> container == null ) { throw new BuildException ( "either type or classname attribute must be set for <mapper>" ) ; } if ( $ this -> container != null ) { return $ this -> container ; } if ( $ this -> type !== null ) { switch ( $ this -> type ) { case 'chained' : $ this -> classname = 'phing.mappers.ChainedMapper' ; break ; case 'composite' : $ this -> classname = 'phing.mappers.CompositeMapper' ; break ; case 'cutdirs' : $ this -> classname = 'phing.mappers.CutDirsMapper' ; break ; case 'identity' : $ this -> classname = 'phing.mappers.IdentityMapper' ; break ; case 'firstmatch' : $ this -> classname = 'phing.mappers.FirstMatchMapper' ; break ; case 'flatten' : $ this -> classname = 'phing.mappers.FlattenMapper' ; break ; case 'glob' : $ this -> classname = 'phing.mappers.GlobMapper' ; break ; case 'regexp' : case 'regex' : $ this -> classname = 'phing.mappers.RegexpMapper' ; break ; case 'merge' : $ this -> classname = 'phing.mappers.MergeMapper' ; break ; default : throw new BuildException ( "Mapper type {$this->type} not known" ) ; break ; } } // get the implementing class $ cls = Phing :: import ( $ this -> classname , $ this -> classpath ) ; $ m = new $ cls ( ) ; $ m -> setFrom ( $ this -> from ) ; $ m -> setTo ( $ this -> to ) ; return $ m ; }
Factory, returns inmplementation of file name mapper as new instance
Factory returns inmplementation of file name mapper as new instance