Changeset 1710

Show
Ignore:
Timestamp:
07/16/08 16:13:43 (2 months ago)
Author:
mikey
Message:

abstract common base functionality into net::stubbles::xml::xsl::util::stubXSLAbstractCallback (preparation for enhancement #159)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework/trunk/src/main/php/net/stubbles/xml/xsl/util/stubXSLImageDimensions.php

    r1296 r1710  
    77 * @subpackage  xml_xsl_util 
    88 */ 
    9 stubClassLoader::load('net::stubbles::xml::stubXMLStreamWriter', 
    10                       'net::stubbles::xml::xsl::stubXSLCallbackException
     9stubClassLoader::load('net::stubbles::xml::xsl::stubXSLCallbackException', 
     10                      'net::stubbles::xml::xsl::util::stubXSLAbstractCallback
    1111); 
    1212/** 
     
    1616 * @subpackage  xml_xsl_util 
    1717 */ 
    18 class stubXSLImageDimensions extends stubBaseObject 
     18class stubXSLImageDimensions extends stubXSLAbstractCallback 
    1919{ 
    2020    /** 
     
    2828                       ); 
    2929    /** 
    30      * the stream writer to use 
    31      * 
    32      * @var  stubXMLStreamWriter 
    33      */ 
    34     protected $xmlStreamWriter; 
    35     /** 
    3630     * path to images 
    3731     * 
     
    3933     */ 
    4034    protected $path            = null; 
    41  
    42     /** 
    43      * constructor 
    44      * 
    45      * @param  stubXMLStreamWriter  $xmlStreamWriter  the xml stream writer to create the document with 
    46      * @Inject 
    47      */ 
    48     public function __construct(stubXMLStreamWriter $xmlStreamWriter) 
    49     { 
    50         $this->xmlStreamWriter = $xmlStreamWriter; 
    51     } 
    5235 
    5336    /** 
     
    7356    public function getImageDimensions($imageFile) 
    7457    { 
    75         if (is_array($imageFile) == true) { 
    76             $imageFileName = $imageFile[0]->value; 
    77         } else { 
    78             $imageFileName = $imageFile; 
    79         } 
    80          
     58        $imageFileName = $this->parseValue($imageFile); 
    8159        if (null !== $this->path) { 
    8260            $imageFileName = $this->path . '/' . $imageFileName; 
  • framework/trunk/src/main/php/net/stubbles/xml/xsl/util/stubXSLRequestParams.php

    r1609 r1710  
    99stubClassLoader::load('net::stubbles::ipo::request::stubRequest', 
    1010                      'net::stubbles::ipo::request::validator::stubPassThruValidator', 
    11                       'net::stubbles::xml::stubXMLStreamWriter
     11                      'net::stubbles::xml::xsl::util::stubXSLAbstractCallback
    1212); 
    1313/** 
     
    1717 * @subpackage  xml_xsl_util 
    1818 */ 
    19 class stubXSLRequestParams extends stubBaseObject 
     19class stubXSLRequestParams extends stubXSLAbstractCallback 
    2020{ 
    21     /** 
    22      * the stream writer to use 
    23      * 
    24      * @var  stubXMLStreamWriter 
    25      */ 
    26     protected $xmlStreamWriter; 
    2721    /** 
    2822     * request instance 
     
    3327 
    3428    /** 
    35      * constructor 
     29     * sets the request instance to be used 
    3630     * 
    37      * @param  stubXMLStreamWriter  $xmlStreamWriter  xml stream writer to create the document with 
    38      * @param  stubRequest          $request          request instance 
     31     * @param  stubRequest  $request  request instance 
    3932     * @Inject 
    4033     */ 
    41     public function __construct(stubXMLStreamWriter $xmlStreamWriter, stubRequest $request) 
     34    public function setRequest(stubRequest $request) 
    4235    { 
    43         $this->xmlStreamWriter = $xmlStreamWriter; 
    44         $this->request         = $request; 
     36        $this->request = $request; 
    4537    } 
    4638 
     
    6254        ); 
    6355         
    64         $doc = $this->xmlStreamWriter->asDom(); 
    65         $this->xmlStreamWriter->clear(); 
    66         return $doc; 
     56        return $this->createDomDocument(); 
    6757    } 
    6858 
  • framework/trunk/src/test/php/net/stubbles/xml/xsl/util/stubXSLRequestParamsTestCase.php

    r1703 r1710  
    4646        $this->mockXMLStreamWriter = new stubDomXMLStreamWriter(); 
    4747        $this->mockRequest         = $this->getMock('stubRequest'); 
    48         $this->xslRequestParams    = new stubXSLRequestParams($this->mockXMLStreamWriter, $this->mockRequest); 
     48        $this->xslRequestParams    = new stubXSLRequestParams($this->mockXMLStreamWriter); 
     49        $this->xslRequestParams->setRequest($this->mockRequest); 
    4950    } 
    5051