ScriptReorganizer
[ class tree: ScriptReorganizer ] [ index: ScriptReorganizer ] [ all elements ]

Source for file Route.php

Documentation is available at Route.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * ScriptReorganizer Strategy :: Route
  7.  *
  8.  * PHP version 5
  9.  *
  10.  * LICENSE: This library is free software; you can redistribute it and/or modify it
  11.  * under the terms of the GNU Lesser General Public License as published by the Free
  12.  * Software Foundation; either version 2.1 of the License, or (at your option) any
  13.  * later version.
  14.  *
  15.  * @category   Tools
  16.  * @package    ScriptReorganizer
  17.  * @subpackage Strategy
  18.  * @author     Stefano F. Rausch <stefano@rausch-e.net>
  19.  * @copyright  2005 Stefano F. Rausch <stefano@rausch-e.net>
  20.  * @license    http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  21.  * @version    SVN: $Id: Route.php 21 2005-09-26 15:55:48Z stefanorausch $
  22.  * @link       http://pear.php.net/package/ScriptReorganizer
  23.  * @filesource
  24.  */
  25.  
  26. /**
  27.  * Implements <kbd>ScriptReorganizer_Strategy</kbd>
  28.  */
  29. require_once 'ScriptReorganizer/Strategy.php';
  30.  
  31. /**
  32.  * Basic strategy
  33.  *
  34.  * Reorganizes scripts by replacing two or more consecutive blank lines with a single
  35.  * one.
  36.  *
  37.  * @category   Tools
  38.  * @package    ScriptReorganizer
  39.  * @subpackage Strategy
  40.  * @author     Stefano F. Rausch <stefano@rausch-e.net>
  41.  * @copyright  2005 Stefano F. Rausch <stefano@rausch-e.net>
  42.  * @license    http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  43.  * @version    Release: @package_version@
  44.  * @link       http://pear.php.net/package/ScriptReorganizer
  45.  */
  46. class ScriptReorganizer_Strategy_Route implements ScriptReorganizer_Strategy
  47. {
  48.     // {{{ public function reformat( & $content, $eol )
  49.     
  50.     /**
  51.      * Performs the main reorganization of the script's content
  52.      *
  53.      * @param  string &$content a string representing the script's content
  54.      * @param  string $eol a string representing the EOL identifier to use
  55.      * @return string a string representing the reorganized content
  56.      */
  57.     public function reformat$content$eol )
  58.     {
  59.         $multiBlankLines '"([ \t]*[' $eol ']){3,}"';
  60.         $result preg_replace$multiBlankLines$eol $eol$content );
  61.         
  62.         return $result;
  63.     }
  64.     
  65.     // }}}
  66. }
  67.  
  68. /*
  69.  * Local variables:
  70.  * tab-width: 4
  71.  * c-basic-offset: 4
  72.  * c-hanging-comment-ender-p: nil
  73.  * End:
  74.  */
  75.  
  76. ?>

Documentation generated on Mon, 11 Mar 2019 14:10:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.